XPCIE1032H Functionality Overview
The XPCIE1032H is a PCI Express-based EtherCAT bus motion control card, offering optional 6-64 axis motion control and supporting multiple high-speed digital inputs and outputs. It easily achieves multi-axis synchronous control and high-speed data transmission. The XPCIE1032H integrates powerful motion control functions, combined with the MotionRT7 real-time motion control soft core, solving the pain point of non-real-time development in high-speed, high-precision applications using PC Windows. Its command interaction speed is 10 times faster than traditional PCI/PCIe.
The XPCIE1032H supports PWM and PSO functions, and features 16 inputs and 16 outputs of general-purpose I/O ports. All output ports are high-speed outputs, configurable as either 4 PWM outputs or 16 high-speed PSO hardware compare outputs. The input ports include 8 high-speed inputs, configurable as either 4 high-speed color mark latches or 2 encoder inputs.
The XPCIE1032H is equipped with the MotionRT7 real-time kernel and uses the local LOCAL interface for connection. Through high-speed intra-kernel interaction, it can achieve faster instruction interaction, with the interaction time for a single instruction or multiple instructions reaching about 3-5us.
The combination of XPCIE1032H and the MotionRT7 real-time kernel offers the following advantages:
1. Supports development using multiple host computer languages; all product series can call the same API function library.
2. Utilizing intra-core interaction, motion commands can be invoked rapidly, with response times down to the microsecond level, 10 times faster than traditional PCI/PCIe;
3. Solves the problem of non-real-time performance of traditional PCI/PCIe motion control cards in Windows environments;
4. Supports 1D/2D/3D PSO (high-speed hardware position comparison output), suitable for applications such as vision-based aerial photography, precision dispensing, and laser energy control;
5. Provides a high-speed input interface for easy position latching;
6. Supports hybrid linkage and hybrid interpolation of EtherCAT bus and pulse output.
➜ When developing projects using XPCIE1032H and MotionRT7, the following steps are typically required:
1. Install the driver to recognize the XPCIE1032H;
2. Open and execute the file "MotionRT710.exe" to configure parameters and run the real-time motion control kernel;
3. Connect to the controller using ZDevelop software for parameter monitoring. Please use the PCI/LOCAL connection method and ensure that the ZDevelop software version is 3.10 or higher.
4. Complete the development of the control program and connect it to the motion control card via a local link to achieve real-time motion control.
➜ Comparison of test data results with traditional PCI/PCIe cards and PLCs:
The test results show that the XPCIE1032H motion control card, in conjunction with the MotionRT7 real-time motion control kernel, exhibits very stable command interaction efficiency in the LOCAL link (internal kernel interaction) mode. When the number of tests increased from 10,000 to 100,000, the interaction time for a single command and the interaction time for multiple commands did not fluctuate significantly, making it very suitable for high-speed and high-precision applications.
XPCIE1032H controller card installation
§ Turn off the computer power.
§ Open the computer case, select an unused XPC I/O slot, and use a screwdriver to remove the corresponding baffle strip.
Insert the motion control card into the slot and tighten the fixing screws on the baffle strip.
For XPCIE1032H driver installation and connection establishment, please refer to the previous article "EtherCAT Ultra-High-Speed Real-Time Motion Control Card XPCIE1032H Host Computer C# Development (Part 1): Driver Installation and Connection Establishment".
I. Developing motion control projects using C#
1. Unzip the downloaded installation package and find "Zmcaux.cs", "zauxdll.dll", and "zmotion.dll" and put them into the project file.
(1) Place “Zmcaux.cs” in the project root directory file, at the same level as the bin directory.
(2) "zauxdll.dll", "zmotion.dll" are placed in bin → Debug.
2. Open the newly created project file in Visual Studio. In the Solution Explorer on the right, click "Show All". Then, right-click the zmcaux.cs file and click "Include in Project".
3. Double-click Form1 in Form1.cs to open the code editing interface. At the beginning of the file, write using cszmcaux and declare the controller handle g_handle.
II. Introduction to PC Functions
The PC function manual is also included in the CD-ROM materials. The specific path is as follows: "CD-ROM materials\8.PC functions\function library 2.1\ZMotion function library programming manual V2.1.pdf".
III. Introduction to Synchronized Follow-up Movement
MOVESYNC (Motion Synchronization)
This movement can be broken down into two parts (synchronization + following). The entire process consists of synchronization and following; the synchronization process is to catch up with the target and achieve the same speed as the target.
Follow-up process: This is the process of maintaining a relatively stationary motion with respect to the product after the synchronization process is completed. During this process, other motion actions can be incorporated to achieve process actions such as dispensing and sorting.
Key points of synchronized motion tracking
1. The synchronization + following process is generally divided into three stages: acceleration stage (synchronization process), synchronization stage (following process), and deceleration stage (reset process);
2. Acceleration Time: Applied to the synchronization process, indicating how long synchronization should take after motion triggering, measured in milliseconds (ms).
3. Uniform speed time: Applied to the following process, indicating the duration of the following process after the synchronous motion ends, in milliseconds (ms). It's important to consider its compatibility with the machining action time; if the following time is less than the machining time, some machining processes may not be completed during the following process (leading to trajectory deviation).
4. Deceleration time: Acts on deceleration and indicates the return time after processing is completed and the machine returns to the designated position to wait for the next trigger process. The unit is milliseconds (ms).
IV. Routine Description
1. The C# example interface is shown below.
2. Simplified diagram of routine implementation logic.
3. Call the ZAux_FastOpen() interface in the constructor of Form1 to automatically link the controller during system initialization.
·
//LOCAL Link private void button4_Click(object sender, EventArgs e){ if (G_CardHandle == (IntPtr)0) { btn_Close_Click(sender, e); } zmcaux.ZAux_FastOpen(5, comboBox1.Text, 1000, out G_CardHandle); if (G_CardHandle != (IntPtr)0) { this.Text = "Linked"; timer1.Enabled = true; } else { MessageBox.Show("Link failed, please select the correct LOCAL!"); }}
4. The timer runs to obtain latch position information.
·
private void timer2_Tick(object sender, EventArgs e){ int iret = 0; float[] MarkNum = new float[2]; float[] RegistPos = new float[1000]; iret = zmcaux.ZAux_Direct_GetTable(G_CardHandle, Convert.ToInt32(Text_TabStart.Text), 1, MarkNum); // Get the number of latch triggers m_RegistCount = (int)MarkNum[0]; this.DataGridView2.Rows[0].Cells[1].Value = m_RegistCount.ToString(); // Display to list if (m_RegistCount > m_RegistShow) // The number of latches is greater than the number of displays { int iNum = m_RegistCount - m_RegistShow; iret = zmcaux.ZAux_Direct_GetTable(G_CardHandle, Convert.ToInt32(Text_TabStart.Text) + 1 + m_RegistShow, iNum, RegistPos); //Get the number of latch triggers for (int i = 0; i < iNum; i++) { this.DataGridView2.Rows[m_RegistShow + i + 1].Cells[1].Value = RegistPos[i].ToString(); } m_RegistShow = m_RegistCount; } else if (m_RegistCount < m_RegistShow) //Latch loop overflow { int iNum = Convert.ToInt32(Text_TabNum.Text) - m_RegistShow - 1; iret = zmcaux.ZAux_Direct_GetTable(G_CardHandle, Convert.ToInt32(Text_TabStart.Text) + 1 + m_RegistShow, iNum, RegistPos); // Get the number of latch triggers for (int i = 0; i < iNum; i++) { this.DataGridView2.Rows[m_RegistShow + i + 1].Cells[1].Value = RegistPos[i].ToString(); } m_RegistShow = 0; }}
5. The synchronous follow thread triggers and executes the synchronous follow action.
·
public void SubMoveSync(){ int iret = 0; int[] iAxisList = new int[2] { 0, 1 }; int[] iTime = new int[3]; iTime[0] = Convert.ToInt32(TextAccTime.Text); iTime[1] = Convert.ToInt32(TextSyncTime.Text); iTime[2] = Convert.ToInt32(TextBackTime.Text); float[] fWaitPos = new float[2]; fWaitPos[0] = Convert.ToSingle(TextXpos.Text); fWaitPos[1] = Convert.ToSingle(TextYpos.Text); float fOffPos = Convert.ToSingle(TextOffpos.Text); float fPdAxisPos = 0; // Current belt shaft position float[] fMakrPos = new float[2]; // Current position of the latch encoder of the processed product int iMaxNum = Convert.ToInt32(Text_TabNum.Text); float imode = 0; if (radioBtnX.Checked) { imode = 0 + (float)(Convert.ToSingle(TextAngle.Text) / 180.0 * Math.PI); // Follow in X direction } else { imode = 10 + (float)(Convert.ToSingle(TextAngle.Text) / 180.0 * Math.PI); // Follow in Y direction } while (true) { if ((m_RegistCount != 0) && (iWorkCount < iMaxNum)) // The number of latches that have been triggered is less than the total number of latches { iret = zmcaux.ZAux_Direct_GetTable(G_CardHandle, Convert.ToInt32(Text_TabStart.Text) + 1 + iWorkCount, 1, fMakrPos); // Get the current latch position ready for processing } else if (iWorkCount > iMaxNum) // The latch coordinates have overflowed, and the data is stored before the latch { iWorkCount = iWorkCount - m_RegistCount; // Retrieve values starting from the next loop if (iWorkCount < m_RegistCount) { iret = zmcaux.ZAux_Direct_GetTable(G_CardHandle, Convert.ToInt32(Text_TabStart.Text) + 1 + iWorkCount, 1, fMakrPos); // Get the current latch position to be processed } else { continue; } } // The latch event has not been triggered if (m_RegistCount == 0 || m_RegistCount == iWorkCount) { continue; } // Wait for the conveyor belt position to move beyond the starting follow position do { iret = zmcaux.ZAux_Direct_GetMpos(G_CardHandle, 2, ref fPdAxisPos); // Get the current encoding axis position } while (fPdAxisPos < fOffPos + fMakrPos[0]); iret = zmcaux.ZAux_Direct_MoveSync(G_CardHandle, imode, iTime[0], fMakrPos[0] + fOffPos, 2, 2, iAxisList, fWaitPos); // Synchronize the acceleration segment, iret = zmcaux.ZAux_Direct_MoveSync(G_CardHandle, imode, iTime[1], fMakrPos[0] + fOffPos, 2, 2, iAxisList, fWaitPos); // Synchronize the constant speed segment, constant speed time iret = zmcaux.ZAux_Direct_MoveSync(G_CardHandle, imode, iTime[2], 0, -1, 2, iAxisList, fWaitPos); // End synchronization and move to the standby position int Axisidle = 0; do { iret = zmcaux.ZAux_Direct_GetIfIdle(G_CardHandle, iAxisList[0], ref Axisidle); //Wait for the main axis to finish following. } while (Axisidle == 0); iWorkCount++; }}
V. Debugging and Operation
1. Follow in the X direction (the same applies to the Y direction), input the X direction following parameters.
As shown in the figure below, the latch is triggered by input 0. After multiple triggers, the data is provided to the synchronous follower and the synchronous follower waveform is triggered. In the waveform diagram, the X follower axis achieves synchronization within the first 5 seconds, and then maintains the same speed relative to the belt axis within 2 seconds. After the follower ends, it returns to its original position within 5 seconds.
This concludes our presentation on synchronous belt following using EtherCAT XPCIE1032H ultra-high-speed real-time motion control card in C#.
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.