XPCIE1032H is one EtherCAT PCI Express motion control card developed by Zmotion Technology.
And one software kernel is built.
In lesson 1: we have learnt how to install MotionRT7 software drive.
Here, lesson 2 mainly shows:
[How to Start MotionRT7]
[How to Connect C#]
[One C# Routine of Speed Test]
XPCIE1032H Video Introduction: https://youtu.be/B1ktSxIRa44
XPCIE1032H Drive Install Video Help: https://youtu.be/0C96S5_hVf0
XPCIE1032H C# Routine Speed Test: https://youtu.be/MYc8r18zh5U
--XPCIE1032H Hardware Info--
Axis Control: 4-64 axes
IO control: high-speed digital IO for latch, PWM, PSO, encoder IN.
Interface: EtherCAT (motion control & IO expansion)
Development: PC programming languages -- C#, C++, Labview, Python, etc.
--XPCIE1032H Software “MotionRT7”--
High-speed kernel interaction brings faster command interaction: one single command & multi-command interaction time (once) can reach about 3-5us (below shows the test result).
--XPCIE1032H Card & MotionRT7 Soft Kernel--
P 1D/2D/3D PSO (high-speed hardware position comparison output): suit to vision fly-shooting, precise dispensing, laser energy control, etc.
P EtherCAT & pulse axes: hybrid linkage, and hybrid interpolation.
P in PC Windows development, it can achieve real-time, and the instruction interaction speed is faster 10 times than traditional PCI / PCIe.
[How to Start MotionRT7]
After MotionRT7 is installed.
1) Open MotionRT7 folder (you downloaded when installing the drive), find “MotionRT710.exe”, run it.
2) Click “Start”
3) Save XPCIE card “Config”
a. at first, stop it, then click UpdateCard to update the card information.
b. click “-->” , it will save current configuration. You can use it directly next time.
c. after saved, please remember to click OK.
[How to Connect to C#]
Step 1: New Build C# Project (VS2022)
Step 2: Get Zmotion C# Library File
Download Add.: https://www.zmotionglobal.com/download_list_21.html
Contact Us: https://www.zmotionglobal.com/contactus.html
Step 3: Add Zmotion C# Library File into C# Project
1) Compress downloaded C# library file, then find these 3 files “Zmcaux.cs”, “zauxdll.dll”, “Zmotion.dll”.
a. put “Zmcaux.cs” into project root directory file, that is, it is same level ass bin.
b. put “zaux.dll” and “zmotion.dll” into bin – Debug.
2) Open new built project by VS, in right “solution resource manager”, click “show all”. Then, right click the zmcaux.cs file – add into project.
3) Double click Form1 of Form1.cs file, the code editing interface will appear. At the beginning of file, please write using cszmcaux, and state the controller / card handle g_handle.
Step 4: Get & Learn Zmotion PC C# Function Command
Zmotion all motion controllers and control cards use the same set of API function commands.
In C#, call corresponding commands to achieve needed motions.
“PC Programming Manual” Download Add.: https://www.zmotionglobal.com/download_list_17.html
Contact Us: https://www.zmotionglobal.com/contactus.html
[One C# Routine of Speed Test]
Following will one C# routine based on XPCIE1032H control card and MotionRT7 drive.
This routine tests the one-command interaction speed and multi-command interaction speed.
--Before--
Before that:
Step 1: let’s see which commands it will use.
Ø ZAux_FastOpen: connect to controller
Ø ZAux_Direct_GetDpos: read axis current position
Ø ZAux_DirectCommand: send character string command to controller directly
Ø ZAux_Close: disconnect
Step 2: design UI interface
In form design interface, please find needed control, then drag them into window to design UI interface.
*C# Routine UI*
--While--
Below shows specific routine codes ( full code file, please contact us ).
a. “connect” button triggers connection: connect to controller through LOCAL
private void button4_Click(object sender, EventArgs e) { //connect by LOCAL interface int ret = zmcaux.ZAux_FastOpen(5, "LOCAL", 1000, out g_handle); if (ret == 0) { label2.Text = "Connected"; label2.BackColor = Color.Green; MessageBox.Show("Controller Connected!", "Note"); } else { MessageBox.Show("Controller Connect Failed, Pleasse Choose Correct LOCAL!"); } }
b. event process function of
“single-command interaction period”test button: calculate one command’s interaction cycle and total time-consumption.
private void SingleRun(object sender, EventArgs e) { float dpos = 0; DateTime beforeDT = System.DateTime.Now; for (int i = 0; i < 10000; i++) { zmcaux.ZAux_Direct_GetDpos(g_handle, 0, ref dpos); } DateTime afterDT = System.DateTime.Now; TimeSpan ts = afterDT - beforeDT; label14.Text = (ts.TotalMilliseconds).ToString(); label12.Text = ((ts.TotalMilliseconds * 1000) / 10000).ToString(); label16.Text = dpos.ToString(); }
c.
event process function of
“multi-command interaction period”test button: calculate multi-command’s interaction cycle and total time-consumption.
private void MuchRun(object sender, EventArgs e) { int[] status = { 0, 0, 0, 0 }; float[] dpos = { 0, 0, 0, 0 }; uint[] num = { 0, 0, 0, 0 }; string cmd; int star = 0; StringBuilder cmdBuff = new StringBuilder(2048); string[] tmp = new string[12]; cmd = "?dpos(0),dpos(1),dpos(2),dpos(3),axisstatus(0),axisstatus(1),axisstatus(2),axisstatus(3),in(0),in(1),in(2),in(3)"; DateTime beforeDT = System.DateTime.Now; for (int i = 0; i < 10000; i++) { zmcaux.ZAux_DirectCommand(g_handle, cmd, cmdBuff, 2048); } DateTime afterDT = System.DateTime.Now; TimeSpan ts = afterDT - beforeDT; label15.Text = (ts.TotalMilliseconds).ToString(); label13.Text = ((ts.TotalMilliseconds * 1000) / 10000).ToString(); string s = cmdBuff.ToString(); string[] arrS = new string[20]; for (int i = 0; i < s.Length; i++) { if (s[i] != 32) { arrS[star] += s[i]; } else { star++; continue; } } label24.Text = arrS[0]; label25.Text = arrS[1]; label26.Text = arrS[2]; label27.Text = arrS[3]; label28.Text = arrS[4]; label30.Text = arrS[5]; label32.Text = arrS[6]; label34.Text = arrS[7]; if (Convert.ToInt32(arrS[8]) == 0) { label29.BackColor = Color.Red; label29.Text = "OFF"; } else { label29.BackColor = Color.Green; label29.Text = "ON"; } if (Convert.ToInt32(arrS[9]) == 0) { label31.BackColor = Color.Red; label31.Text = "OFF"; } else { label31.BackColor = Color.Green; label31.Text = "ON"; } if (Convert.ToInt32(arrS[10]) == 0) { label33.BackColor = Color.Red; label33.Text = "OFF"; } else { label33.BackColor = Color.Green; label33.Text = "ON"; } if (Convert.ToInt32(arrS[11]) == 0) { label35.BackColor = Color.Red; label35.Text = "OFF"; } else { label35.BackColor = Color.Green; label35.Text = "ON"; } }
d.
“disconnect”
button triggers disconnection: disconnect to controller
private void button1_Click(object sender, EventArgs e) { zmcaux.ZAux_Close(g_handle); g_handle = (IntPtr)0; label2.Text = "Unconnected"; label2.BackColor = Color.Red; }
--After--
*Test Effect*:
*Video Showing*: https://youtu.be/MYc8r18zh5U
ABOUT ZMOTION
That's all, thank you for your reading -- Zmotion EtherCAT Super High-Speed Motion Control Card XPCIE1032H (2) | C# Connection & Speed Test Routine
Note: Copyright belongs to Zmotion Technology, if there is reproduction, please indicate article source. Thank you.
Zmotion Technology provides motion control card, motion controller, vision motion controller, expansion module and HMI. (more keywords for Zmotion: EtherCAT motion control card, EtherCAT motion controller, motion control system, vision controller, motion control PLC, robot controller, vision positioning...)
Have a good day, best wishes, see you next time.