Share this

Easy-to-use motion control card (10): Continuous interpolation and small segment look-ahead

2026-04-06 05:46:16 · · #1

Today, the Motion Assistant will share with you how to use C++ to operate the ECI3808 motion control card for continuous interpolation motion and small line segment look-ahead.

ECI3808 Hardware Introduction

1. Function Introduction

The ECI3808 series control cards support up to 12 axes of linear interpolation, arbitrary circular interpolation, spatial circular interpolation, helical interpolation, electronic cams, electronic gears, synchronous following, virtual axes, and robot commands; they also employ optimized network communication protocols to achieve real-time motion control.

The ECI3808 series motion control card supports Ethernet and RS232 communication interfaces to connect to a computer, receive commands from the computer, and can connect to various expansion modules via CAN bus to expand the number of input/output points or motion axes.

Applications for the ECI3808 series motion control card can be developed using software such as VC, VB, VS, C++, and C#. The program requires the dynamic library zmotion.dll to run. During debugging, the ZDevelop software can be connected to the controller simultaneously for convenient debugging and observation.

2. Hardware Interface

General purpose input circuit

General purpose output port circuit

AD/DA Interface Description

Local Pulse Axis Description

Auxiliary encoder CN15

3. Controller Basic Information

II. Motion Control Development using C++

1. Create a new MFC project and add function libraries.

(1) In the VS2015 menu, go to "File" → "New" → "Project" to start the Project Creation Wizard.

(2) Select “Visual C++” as the development language and “MFC Application” as the program type.

(3) Click Next.

(4) Select "Dialog-based" as the type, then click Next or Finish.

(5) Locate the CD-ROM data provided by the manufacturer. The path is as follows (64-bit library as an example).

A. Locate the "8.PC Functions" folder in the CD-ROM provided by the manufacturer and click to enter.

B. Select the "Function Library 2.1" folder.

C. Select the "Windows Platform" folder.

D. Select the appropriate function library as needed; here, we choose the 64-bit library.

E. Unzip the C++ compressed file, which contains the corresponding C++ function library.

F. The specific path to the function library is as follows.

(6) Copy the C++ library files and related header files provided by the vendor into the newly created project.

(7) Add static libraries and related header files to the project.

A. First, right-click the project file, then select: "Add" → "Existing Item".

B. In the pop-up window, add the static library and related header files in sequence.

(8) Declare the header files used and define the controller connection handle.

The project is now complete and ready for MFC project development.

2. Review the PC function manual and familiarize yourself with the relevant function interfaces.

(1) 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"

(2) Link controller, obtain link handle.

ZAux_OpenEth() Interface Description:

(3) The corresponding function interface for look-ahead settings is as follows.

◆For detailed information on the interface, please refer to the PC function manual.

3. MFC Development Controller Continuous Interpolation Motion and Small Line Segment Look-Ahead Function

(1) The routine interface is as follows.

(2) In the event handling function of the link button, the interface function ZAux_OpenEth() of the link controller is called to link with the controller. After the link is successfully linked, timer 1 is started to monitor the status of the controller.

·

// Network port connection controller void CSingle_move_Dlg::OnOpen(){ char buffer[256]; int32 iresult; // If already connected, disconnect first if(NULL != g_handle) { ZAux_Close(g_handle); g_handle = NULL; } // Select and get the IP address from the IP drop-down box GetDlgItemText(IDC_IPLIST,buffer,255); buffer[255] = '\0'; // Start the connection controller iresult = ZAux_OpenEth(buffer, &g_handle); if(ERR_SUCCESS != iresult) { g_handle = NULL; MessageBox(_T("Connection failed")); SetWindowText("Not connected"); return; } // Start timer 1 if connection is successful SetWindowText("Connected"); SetTimer( 1, 100, NULL ); }

(3) Monitor the controller status through a timer.

void CTest_move2Dlg::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default if(NULL == g_handle) { MessageBox(_T("Link Broken")); return ; } if(1 == nIDEvent) { CString Xpos; CString Ypos; CString Zpos; CString Upos; CString Curspeed; float showpos[4] ={0}; float curspeed =0;

ZAux_Direct_GetAllAxisPara( g_handle,"DPOS",4,showpos); // Get the current axis position ZAux_Direct_GetVpSpeed( g_handle,0,&curspeed); // Get the current axis position

Xpos.Format("X: %.2f",showpos[0]); Ypos.Format("Y: %.2f",showpos[1]); Zpos.Format("Z: %.2f",showpos[2]); Upos.Format("U: %.2f",showpos[3]); Curspeed.Format("Current speed: %.2f",curspeed);

GetDlgItem( IDC_XPOS )->SetWindowText( Xpos ); GetDlgItem( IDC_YPOS )->SetWindowText( Ypos ); GetDlgItem( IDC_ZPOS )->SetWindowText( Zpos ); GetDlgItem( IDC_UPOS )->SetWindowText( Upos ); GetDlgItem( IDC_VPSPEED )->SetWindowText( Curspeed ); } if (2 == nIDEvent) { int status = 0; int rembuff = 0; int curmark = 0; // Determine the main axis status (i.e., the first axis of BASE) ZAux_Direct_GetIfIdle(g_handle, 0, &status); // Determine the remaining buffer for storing lines, ZAux_Direct_GetRemain_Buffer determines the buffer for spatial arcs, which is also the movement that occupies the largest buffer ZAux_Direct_GetRemain_LineBuffer(g_handle, 0, &rembuff); // Determine which movement the current movement has reached, ZAux_Direct_GetMoveCurmark(g_handle, 0, &curmark); if (status == -1) { GetDlgItem(IDC_RUNSTATUS)->SetWindowText("Motion Status: Stopped"); } else { GetDlgItem(IDC_RUNSTATUS)->SetWindowText("Motion Status: Moving"); } CString str; str.Format("Remaining Line Buffer: %d", rembuff); GetDlgItem(IDC_REBUFF)->SetWindowText(str); str.Format("Current MARK: %d", curmark); GetDlgItem(IDC_MARK)->SetWindowText(str); } CDialog::OnTimer(nIDEvent);}

(4) Perform continuous interpolation motion according to the set position distance, and perform look-ahead processing according to the set look-ahead mode.

void CTest_move2Dlg::OnStart() // Enable continuous interpolation { if(NULL == g_handle) { MessageBox(_T("Connection disconnected")); return ; } UpdateData(true);// Refresh parameters int corner_mode = 0; int axislist[4] = {0,1,2,3}; // Motion BASE axis list // Select the axes participating in the motion, the first axis is the main axis, all interpolation parameters use the main axis parameters ZAux_Direct_SetSpeed(g_handle,axislist[0],m_speed); // Speed ​​UNITS / S ZAux_Direct_SetAccel(g_handle,axislist[0],m_acc); // Acceleration ZAux_Direct_SetDecel(g_handle,axislist[0],m_dec); // Deceleration UpdateData(true);// Refresh parameters if(m_mode1 == 1) { corner_mode = corner_mode + 2; } if(m_mode2 == 1) { corner_mode = corner_mode + 8; } if(m_mode3 == 1) { corner_mode = corner_mode + 32; } ZAux_Direct_SetMerge(g_handle,axislist[0],1); // Continuous interpolation switch ZAux_Direct_SetLspeed(g_handle,axislist[0],m_lspeed); // Starting speed, corner deceleration is linearly decelerated from the starting speed ZAux_Direct_SetCornerMode(g_handle,axislist[0],corner_mode); // Corner mode ZAux_Direct_SetDecelAngle(g_handle,axislist[0],m_startang*3.14/180); // Starting deceleration angle, converted to radians ZAux_Direct_SetStopAngle(g_handle,axislist[0],m_stopang*3.14/180); ZAux_Direct_SetFullSpRadius(g_handle,axislist[0],m_fullradius); ZAux_Direct_SetZsmooth(g_handle,axislist[0],m_zsmooth);

//In the SP instruction, set a large startmovespeed and endmovespeed in the automatic corner mode. ZAux_Direct_SetStartMoveSpeed(g_handle,axislist[0], 10000); ZAux_Direct_SetEndMoveSpeed(g_handle, axislist[0], 10000); //Call the motion to determine whether to send the motion by checking whether there is any remaining buffer. ZAux_Direct_SetMovemark(g_handle,axislist[0],0); //Set MARK = 0 to determine where the current execution is by reading CURMARK. g_curseges = 0; //SetTimer(3, 50, NULL); //Create a new timer to send the motion. float xposlist[10]; float yposlist[10]; float zposlist[10]; DataDeal(xposlist, yposlist, zposlist); float dposlist[10][4]; for (int i = 0; i < 10; i++) { dposlist[i][0] = xposlist[i]; dposlist[i][1] = yposlist[i]; dposlist[i][2] = zposlist[i]; dposlist[i][3] = 0; } int iresult = 0; int iremain = 0; // Determine the buffer size for movement iresult = ZAux_Direct_GetRemain_LineBuffer(g_handle, 0, &iremain); // Different interpolation functions are used for different types; use ZAux_Direct_GetRemain_LineBuffer for linear interpolation buffer determination if (iremain > 10) { for (int i = 0; i < 10; i++) { ZAux_Direct_MoveAbs(g_handle,4,axislist,dposlist[i]); } }}

(5) Stop the current motion by using the event handler function of the stop motion button.

void CSingle_homeDlg::OnStop() //Stop movement{ // TODO: Add your control notification handler code here if(NULL == g_handle) { MessageBox(_T("Connection disconnected")); return ; } ZAux_Direct_Single_Cancel(g_handle,m_nAxis,2); //}

(6) The coordinates of the current axis are cleared by using the event handling function of the coordinate clearing button.

void CSingle_homeDlg::OnZero() // Clear coordinates to zero { if(NULL == g_handle) { MessageBox(_T("Connection disconnected")); return ; } // TODO: Add your control notification handler code here for (int i=0;i<4;i++) { ZAux_Direct_SetDpos(g_handle,i,0); // Set zero point } }

Full code download address

III. Debugging and Monitoring

Compile and run the routines, and simultaneously monitor the controller status by connecting to the controller through the ZDevelop software.

1. CornerMode Feature Preview Settings Instructions

First, it can perform overall planning of instructions, that is, overall planning of the speed of each segment. Combined with acceleration and deceleration control within the instruction segment, it can enable the machine tool to maintain high-speed operation, improve efficiency, and make the load movement smoother, eliminating the need for stop-and-go operation. The system achieves this through the Merge speed fusion function.

Secondly, it can ensure that, in order to limit mechanical impact and overcutting while operating at high speed, deceleration identification is also required. By identifying trajectory changes in advance, the system can decelerate in advance at a safe deceleration rate. This is achieved through deceleration/stop fusion function and impact suppression function.

In summary, the speed prediction function can improve the overall efficiency of the machine, reduce impact, increase flexibility, reduce wear on parts, and increase the service life of the equipment.

(1) Deceleration at corners

The corner deceleration function solves the problem that when the angle between commands is too large, if the vehicle is still running at a relatively high speed, a large mechanical impact will be generated at the angle, causing the trajectory to deviate.

The controller will identify the angle between the trajectory changes between commands in advance, compare its relationship with the deceleration/stop angle, and decide in advance whether to decelerate to ensure a smooth transition at the command connection point.

As shown in the figure, when the angle between OA and segment AB is less than the deceleration angle, no deceleration occurs in segment S1-S2. When the angle between AB and segment BC is greater than the deceleration angle, deceleration is performed, as in segment S2-S3. When the angle between BC and segment CD is greater than the stopping angle, the speed needs to be reduced to zero, as in segment S3-S4. The execution effect is as follows:

① Corner deceleration not activated

②Activate corner deceleration

→ Reached the deceleration angle but not the stopping angle, resulting in partial deceleration.

→ Reach the stopping angle and decelerate completely.

(2) Speed ​​limiter for small circle

The small circle speed limit function is used to handle situations where the running trajectory may be fitted with a small circle that deviates from the original trajectory due to a large angular deflection. Therefore, speed limiting is required at such locations.

When the small circle speed limiter is activated, there will be no speed limit if the radius of the small circle exceeds the speed limit radius, and the speed will be limited if the radius of the small circle is smaller than the speed limit radius.

(3) Automatic chamfering

The automatic chamfering function is generally used to smooth the trajectory at corners by applying a certain chamfer radius, resulting in smoother speed changes. (See figure.)

① Chamfering not enabled

② Turn on chamfering

2. ZDevelop software debugging video

This concludes our sharing of the simple and easy-to-use motion control card for positive motion technology (Part 10): continuous interpolation and small line segment look-ahead.

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.


Read next

CATDOLL 135CM Sasha

Crafted with attention to detail, this 135cm doll offers a well-balanced and realistic body shape that feels natural in...

Articles 2026-02-22