Application Background: With the increasing market demand for screening, the term "disc screening machine" has appeared more frequently in the industrial control and electronics industries. Currently, most disc screening machines on the market are single-station applications, where a large disc completes the screening work at one station.
For applications with few cameras and limited categories, the use of space is not very efficient. Is it possible to make more efficient use of the machine space? Also, can a production line-style facility with a small number of cameras control multiple cameras simultaneously?
Positive motion technology solutions:
In response to existing market demands, Zhengdong has promoted and deployed a program dedicated to the rational utilization of machine space. The XPCIE1028 control card has been upgraded and extended for screening applications, enabling control of two workstations with a single card (i.e., dual-disc screening). The two workstations are completely independent, and the screening efficiency tested has reached 12,000+.
01. Introduction to the XPCIE1028 Controller Card
The XPCIE1028 is a newly launched motion control card from Zheng Motion Technology, featuring a new XPCIE bus interface, designed for high-speed vision screening and capable of controlling multiple stepper motors or digital servo motors.
The XPCIE1028 motion control card is suitable for applications such as multi-axis point-to-point motion, interpolation motion, trajectory planning, handwheel control, encoder position detection, I/O control, and position latching.
The XPCIE1028 motion control card features 8 high-speed inputs and up to 16 high-speed hardware position comparison outputs, enabling it to easily achieve various real-time motion controls required by visual sorting machines, such as visual capture and high-speed, precise trigger control, as well as high stability.
02. Development of project filtering using C++ and MFC.
1. Create a new MFC project. In the toolbar menu, select "File" → "New" → "Project" to start the Project Creation Wizard.
2. Click Next to modify the project name and project save path.
3. Click Create, select "Dialog-based" as the type, and click "Next" until completion. The project will be created successfully.
4. Based on the library files provided by the manufacturer, add the corresponding bit versions of zauxdll2.h, zauxdll.lib, zauxdll.dll, zmotion.dll, zmotion.lib, zmotion.h, zmc_xp.h, zmc_xp.lib, and zmc_xp.dll to the project folder and include them in the project.
5. Add a filter for the sports library and related header files to the project.
6. In the pop-up window, add the filtered sports library and related header files in sequence.
7. Add header file references to `<your_name>`: `#include "zmotion.h"`, `#include "zauxdll2.h"`, and `#include "zmc_xp.h"`.
8. Once the above steps are completed and the relevant instruction interfaces in the header file are correctly entered, and the compilation is successful, the filtering program can be developed and applied.
03. Introduction to the screening and material sorting process and related functions
1. Operating Instructions
When writing a screening program on the host computer, first connect the control card using the ZAux_FastOpen instruction, then load the screening program using the PC_INT_CARD instruction, and then configure parameters such as axis, camera, and discharge. After the parameters are set, select the camera result sending mode and communication mode, and then start running the screening program. When the feed sensor senses the feed, it simulates the result processed by the camera and sends the result processed by the camera to the control card. When the material moves to the position of the corresponding discharge port, the corresponding OUT port will be triggered to discharge the material.
2. Instruction Description
04. Implementation of Master Discharge Routine via Host Computer Calling Instructions
Triggering material feeding via a host computer call command can achieve rapid material feeding I/O action when there are many cameras. However, there is a point to note: if the material feeding command (PC_MODBUS_SET) is issued too late and the material has already passed the set material feeding position, the material feeding will be skipped, causing subsequent materials to fail to trigger the corresponding I/O port for feeding.
1. Connect the control card and load the filtering program
·
iret = ZAux_FastOpen(5, "LOCAL1", 1000, &c_value::g_handle); MessageBox("Control card connection successful!"); int ret = PC_INT_CARD(c_value::g_handle); // Initialize filtering function while (ret != 0){ ret = PC_INT_CARD(c_value::g_handle); // Initialize filtering function }
2. Set camera, material feeding, and other parameters and run the program.
·
int ret = 0; // Define an array to store the axis parameter settings (in order: axis type -> pulse equivalent -> rotational stroke (360°) -> speed -> acceleration -> deceleration -> direction -> encoder direction (0 for positive direction, 1 for negative direction)) float axis_param[10]{1,1000,360,50,1000,1000,0,0}; // Set the axis parameters of the main disk ret=PC_SAVE_PARAM(c_value::g_handle, axis_param,0); // Set the two cameras of the main disk ret = PC_SET_CAM_NUM(c_value::g_handle,2,0); // Set the three-way discharge of the main disk ret = PC_SET_OP_NUM(c_value::g_handle,3,0); // Set the trigger parameters of the two cameras of the main disk ret = PC_SAVE_POS(c_value::g_handle, 0, 100.2, 3, 1500, -1,0);ret = PC_SAVE_POS(c_value::g_handle, 1, 150.5, 4, 1500, -1,0);//Set the parameters for triggering the 3-way feed of the master disk ret = PC_SAVE_POSNG(c_value::g_handle,0,255.5,6,1500,1,0,0);ret = PC_SAVE_POSNG(c_value::g_handle, 1, 305.5, 7, 1500, 1, 0,0);ret = PC_SAVE_POSNG(c_value::g_handle, 2, 345.5, 8, 1500, 1, 0,0);//Set the communication parameters of the master disk's network port to register 0, with an initial value of 0 (0 represents the first discharge port (NG), 1 represents the second discharge port (OK), and 2 represents the third discharge port (RETEST)) ret = PC_TCP_MODE(c_value::g_handle,0,0,0);//Set the communication mode of the master disk's visual processing results to modbus_tcp ret = PC_SET_MODE(c_value::g_handle, 2,0);//Run the master disk filtering program ret = PC_CAM_RUN_TASK(c_value::g_handle, 0);while (ret != 0){ ret = PC_CAM_RUN_TASK(c_value::g_handle,0);}MessageBox("Start running!");Check1_Shake.SetCheck(TRUE);c_value::G_run_test = 1;//Start the discharge thread to issue discharge commands CWinThread* blowTest = AfxBeginThread(blow_test,this);
3. Material feeding thread
·
// Material feeding thread UINT CMFCApplication1Dlg::blow_test(LPVOID p){ int cam_num = 0; // Intermediate value, stores the previous camera trigger count for comparison with the current one int cam_tempnum = 0; while (c_value::G_run_test != 0) { // Read the execution count of the specified camera PC_READ_CURCAM_RUN(c_value::g_handle, 1, cam_num); if (cam_num > cam_tempnum) { // Simulate the camera processing result as 'ok', specify the 'ok' hopper for material feeding PC_MODBUS_SET(c_value::g_handle,1,0); cam_tempnum++; } } return 0;}
If you need to use the secondary disk, write "1" in the last parameter (i.e., vice) of the call to the host computer interface to set the relevant parameters of the secondary disk and start or stop the secondary disk filtering program; the material arrangement of the secondary disk is the same as the material arrangement steps of the main disk in the example.
05. Using the Filtering and Debugging Tools
I. Method 1
After the host computer calls the PC_INT_CARD instruction to load the filtering program into the control card, in the MotionRT7 driver file provided by the manufacturer, double-click to open the file named "xplcterm", and finally double-click to open the executable program "xplcterm.exe".
II. Method 2
1. After the host computer calls the PC_INT_CARD instruction to load the filtering program into the control card, open the RTSys software and connect the control card.
2. In "Tools", click "Plug-ins" and then "XPlc Screen".
The main disk's filter parameter settings and viewing interface are shown in the following figure.
3. To enable the secondary drive in the software, click "Enable Secondary Drive," then click the "Secondary Drive Settings" button to open the secondary drive's debugging interface.
The interface for setting and viewing the filtering parameters of the secondary disk is shown in the figure below.
4. During the execution of the example program, the number of times the main disk performs feeding, camera execution, and discharge execution over a period of time.
That concludes our presentation on the development and application of the PCIe real-time motion control card for dual-disk vision screening machines.
For more exciting content, please follow the "Zheng Motion Assistant" WeChat official account. For related development environment and example code, please contact Zheng Motion's technical sales engineer: 400-089-8936.
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.