Share this

Motion with a Custom Electronic Cam Curve: EtherCAT Ultra-High-Speed ​​Real-Time Motion Control Card XPCIE1032H Host Computer C# Development (Part Thirteen)

2026-04-06 05:26:47 · · #1

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, paired with the MotionRT7 real-time motion control kernel, exhibits very stable command interaction efficiency in LOCAL linking (internal kernel interaction). Even when the number of tests increased from 10,000 to 100,000, the interaction time for single and multiple commands remained relatively stable, making it highly suitable for high-speed, high-precision applications. XPCIE1032H control 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. Customizing Electronic Cam Curves in C#

The motion human-machine interface for custom electronic cam curves is shown below.

Depending on your needs, you can choose to import the corresponding cam table data or use custom data. 1. Call the interface ZAux_FastOpen() in the constructor of Form1 to automatically connect the controller during system initialization.

·

private void button1_Click(object sender, EventArgs e){ zmcaux.ZAux_OpenEth(IP_List.Text, out g_handle); if (g_handle != (IntPtr)0) { timer1.Enabled = true; // Set the connection status button status.BackColor = System.Drawing.Color.Green; status.Text = "Connected"; } else { MessageBox.Show("Controller connection failed, please check if MotionRT7 is enabled!", "Warning"); // Set the connection status button status.BackColor = System.Drawing.Color.Red; status.Text = "Disconnected"; }}

2. Update parameter information using a timer.

·

//Timer private void timer1_Tick(object sender, EventArgs e){ if(g_handle != null) { float dpos = 0, speed = 0; zmcaux.ZAux_Direct_GetDpos(g_handle, Convert.ToInt32(textBox_axis.Text),ref dpos); label_dpos.Text = Convert.ToString(dpos); zmcaux.ZAux_Direct_GetSpeed(g_handle, Convert.ToInt32(textBox_axis.Text), ref speed); label_speed.Text = Convert.ToString(speed); } else { status.BackColor = System.Drawing.Color.Red; status.Text = "Disconnected"; }}

3. Using pre-loaded cam table data, perform cam motion using CAM commands.

·

//Cam table movement starts private void button3_Click(object sender, EventArgs e){ if (g_handle == null) return; zmcaux.ZAux_Direct_SetUnits(g_handle, Convert.ToInt32(textBox_axis.Text),Convert.ToSingle(textBox_unit.Text)); zmcaux.ZAux_Direct_SetSpeed(g_handle, Convert.ToInt32(textBox_axis.Text), Convert.ToSingle(textBox_speed.Text)); zmcaux.ZAux_Direct_SetAccel(g_handle, Convert.ToInt32(textBox_axis.Text), Convert.ToSingle(textBox_accel.Text)); zmcaux.ZAux_Direct_SetDecel(g_handle, Convert.ToInt32(textBox_axis.Text), Convert.ToSingle(textBox_decel.Text)); zmcaux.ZAux_Direct_SetAtype(g_handle, Convert.ToInt32(textBox_axis.Text), 1); // Perform electronic cam motion // Set the total motion time to 5s zmcaux.ZAux_Direct_Cam(g_handle, Convert.ToInt32(textBox_axis.Text),0, CamNum, Convert.ToSingle(textBox_unit.Text), Convert.ToSingle(textBox_speed.Text)*5);}

4. Load externally imported cam table data.

·

private void button_data_Click(object sender, EventArgs e){ dataGridView_data.Columns.Clear(); DataGridViewTextBoxColumn ActPos = new DataGridViewTextBoxColumn(); ActPos.Name = "ActPos"; ActPos.DataPropertyName = "ActPos"; ActPos.HeaderText = "Position"; dataGridView_data.Columns.Add(ActPos); OpenFileDialog ZaoLangFile = new OpenFileDialog(); ZaoLangFile.Filter = "Text file(*.txt;)| *.txt;| All files| *.*; "; ZaoLangFile.ValidateNames = true; ZaoLangFile.CheckPathExists = true; ZaoLangFile.CheckFileExists = true; if (ZaoLangFile.ShowDialog() == DialogResult.OK) { string strFileName = ZaoLangFile.FileName; //Other code//FileStream FileRead = new FileStream(strFileName, FileMode.OpenOrCreate, FileAccess.Read); string DataTest = File.ReadAllText(strFileName); string[] strArray = DataTest.Split(new string[] { "\r\n" }, StringSplitOptions.None); for (int i = 0; i < strArray.Length - 1; i++) { int index = dataGridView_data.Rows.Add(); dataGridView_data.Rows[index].Cells[0].Value = strArray[i]; } float[] Tablelist = new float[strArray.Length]; for (int i = 0; i < strArray.Length - 1; i++) { Tablelist[i] = Convert.ToSingle(strArray[i]); } zmcaux.ZAux_Direct_SetTable(g_handle,0,strArray.Length,Tablelist); //Record how much data is currently written to the cam table CamNum = strArray.Length - 2; }}

5. Custom cam table data loading.

·

private void button6_Click(object sender, EventArgs e){ dataGridView_data.Columns.Clear(); DataGridViewTextBoxColumn ActPos = new DataGridViewTextBoxColumn(); ActPos.Name = "ActPos"; ActPos.DataPropertyName = "ActPos"; ActPos.HeaderText = "Position"; dataGridView_data.Columns.Add(ActPos); float[] CustomTable = new float[100]; for (int i = 0; i < 100; i++) { CustomTable[i] = (float )((Math.Sin(Math.PI*2*i/100) / (Math.PI*2)) + i / 100) * 500; int index = dataGridView_data.Rows.Add(); dataGridView_data.Rows[index].Cells[0].Value = CustomTable[i]; } zmcaux.ZAux_Direct_SetTable(g_handle, 0, 100, CustomTable); CamNum = 100;}

IV. Debugging and Monitoring 01 Electronic Cam

1. Components: Electronic cam is a software system that uses constructed cam curves to simulate mechanical cams, achieving the same relative motion between the camshaft and spindle as a mechanical cam system. It uses a controller to control a servo motor to simulate the function of a mechanical cam, without the need for additional mechanical structures. Electronic cam is also known as Electronic CAM.

2. Working principle

Electronic cams belong to multi-axis synchronous motion. This type of motion is based on a master shaft plus one or more slave shaft systems and is developed from mechanical cams. Electronic cams are mostly used in periodic curvilinear motion applications. As shown in the figure below, a mechanical cam can derive a motion trajectory of rotation angle and machining position according to the cam profile. This trajectory is an arc. This arc is decomposed into countless straight line trajectories, which are combined to obtain a series of motion trajectories that approximate an arc. Electronic cams can directly load the motion parameters of this trajectory into motion commands to control the axis to move along the target trajectory.

A motion program for an electronic cam is set and loaded into the controller. The position signal is fed back to the controller through the encoder. The controller processes the received position signal and outputs it to the servo driver. The servo driver controls multiple axes to move synchronously to complete the preset trajectory.

3. Advantages

(1) The use of electronic cams improves the control precision of the machine, increases the control distance, reduces the failure rate, and improves the reliability; (2) It simplifies the mechanism, makes the mechanism more flexible, and makes debugging and maintenance easier.

(3) Electronic cams use software to control signals. Changing the relevant motion parameters of the program can change the motion curve. It is highly flexible in application, reliable in operation, and simple to operate. It does not require additional mechanical components and therefore does not suffer from wear.

02 Synchronous Tracking

Synchronous tracking is a common cam application. Its action is similar to "tracking shear," both requiring the slave axis (servo) to be in sync with the main axis during operation. The difference is that "tracking shear" is mainly used for fixed-length cutting of continuous materials, while "synchronous tracking" is used for random materials (that is, the timing of the items' appearance is not fixed). Therefore, the start signal is based on the sensor, and after being triggered, it only tracks once. Once the set distance is reached, it automatically returns to the starting position. It will only start tracking again when the next trigger signal is received. It is often used in production lines, such as synchronous painting, bottle and can filling, and item gripping applications.

03 Automatic Cam

Automatic cams are a type of cam motion, mainly for master-slave following motion between two axes. Users can establish the motion relationship between the master and slave axes by simply setting a few related parameters. The positional relationship is not stored in a table, but is set by command parameters for each following distance and speed change process. During the motion, the speed of the slave axis is automatically calculated to match the master axis. Common motion processes include following acceleration, deceleration, and synchronization.

Automatic cam commands include MOVELINK, MOVESLINK, FLEXLINK, etc., and common applications include tracking shears, flying shears, and rotary shears.

This example demonstrates the use of CAM cam table motion. The `ZAux_Direct_Cam(ZMC_HANDLE handle, int iaxis, int istartpoint, int iendpoint, float ftablemulti, float fDistance)` instruction determines the axis motion based on data stored in the TABLE. These TABLE data values ​​correspond to the position of the motion trajectory, which is an absolute position relative to the starting point of the motion. Note: Two or more `ZAux_Direct_Cam` instructions can operate on the same TABLE data area simultaneously. The total motion time is determined by the set speed and the fourth parameter. The actual motion speed is automatically matched according to the TABLE trajectory and time. The TABLE data needs to be set manually; the first data is the guide point, and it is recommended to set it to 0. TABLE data * ftablemulti = the number of pulses emitted. Ensure that the distance parameter *units passed in the instruction is an integer number of pulses; otherwise, floating-point numbers will cause slight errors in the motion. The following figure shows the actual trajectory of a wave generator's motion, loaded into the controller's CAM table by importing cam table data, and completed within the set specified time.

As shown in the figure below, the running data is the motion data of the internally customized sin waveform. As can be seen from the figure, the trajectory of the moving small line segment data is completed within a specified time.

Read next

CATDOLL 126CM Alisa (TPE Body + Hard Silicone Head) Customer Photos

Height: 126cm Weight: 23kg Shoulder Width: 32cm Bust/Waist/Hip: 61/58/66cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22