Easy to use motion control card: Basic file download and continuous trajectory machining

Today, positive motion technology will share with you the download and operation of ". bas" file of ECI3808 motion control card.

1, ECI3808 hardware introduction

1. Function introduction

ECI3808 series control card supports up to 12 axis linear interpolation, arbitrary arc interpolation, spatial arc interpolation, spiral interpolation, electronic cam, electronic gear, synchronous follow, virtual shaft, mechanical finger command, etc; The optimized network communication protocol can realize real-time motion control.

ECI3808 series motion control card supports Ethernet and RS232 communication interface to connect with the computer, receive the instructions of the computer, and connect each expansion module through CAN bus to expand the input and output points or motion axis.

The application program of ECI3808 series motion control card can be developed by using VC, VB, VS, C + +, c# and other software. The dynamic library zmotion.dll is required when the program runs. During debugging, ZDevelop software can be connected to the controller at the same time, so as to facilitate debugging and observation.

2. Hardware interface

3. Basic information of controller

2, C + + for motion control development

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

(1) In VS2015 menu "file" → "new" → "project", start the create project wizard.

(2) Select the development language as "Visual C + +" and the program type as "MFC application".

(3) Click next.

(4) Select "dialog based" as the type. Next or finish.

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

A. Enter the CD data provided by the manufacturer, find the "8.PC function" folder, and click to enter.

B. Select the function library 2.1 folder.

C. Select the Windows Platforms folder.

D. Select the corresponding function library as required. Here, select the 64 bit library.

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

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

(6) Copy the C + + library files and related header files provided by the manufacturer to the new project.

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

A. Right click the project file, and then select Add → existing item.

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

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

At this point, the new project is completed and MFC project development can be carried out.

2. Check the PC function manual and be familiar with relevant function interfaces.

(1) The PC function manual is also in the CD-ROM, and the specific path is as follows: "CD-ROM \ 8.PC function \ function library 2.1\ZMotion function library programming manual V2.1.pdf"

(2) Link controller to get the link handle.

ZAux_OpenEth() interface description:

(3) Download the ". bas" file to the interface description running in the controller.

(4) Pause and resume the interface description of the Basic program inside the controller.

3. Download and start operation of ". bas" motion control file.

(1) The routine interface is as follows.

(2) Convert the graphics in CAD drawings into ". bas" motion control code through "CD data" – > "tool software".

A. Open the tool software and click file - > import. Select the CAD drawing in dxf format to be converted and open it.

B. After opening, the effect is as follows.

C. Click "file" – > "export" to export ". bas" file. At that time, it can be downloaded to the control card for motion control of the above tracks.

D. For the specific use of CAD mapping software, please refer to the following website.

Link: https://t.1yb.co/EA7G

(3) the interface function ZAux_ of the calling link controller in the event handling function of the link button. Openeth() links with the controller. After the link is successful, start timer 1 to monitor the controller status.

//Ethernet connection controller

void CTest_BusInitDlg::OnOpenEth()        


    char   buffer[256]; 

    int32 iresult;

    if(NULL != g_handle)



        g_handle = NULL;


    //Get IP address


    buffer[255] = '\0';

    //Connect controller

    iresult = ZAux_OpenEth(buffer, &g_handle);

    if(ERR_SUCCESS != iresult)


       g_handle = NULL;

       MessageBox(_T("link failure"));

       SetWindowText("Not linked");




    //Turn on timer 1

    SetTimer( 1, 100, NULL );


(4) The axis status of the controller is monitored by timer 1.

void CTest_BusInitDlg::OnTimer(UINT_PTR nIDEvent)  //Timer refresh


    int32 ret = 0;

    CString tempstr;  

    if(nIDEvent == 1 && g_handle !=0)


        //Get axis parameters for axis 0

        ZAux_Direct_GetAtype(g_handle, 0, &m_atype);

        ZAux_Direct_GetUnits(g_handle, 0, &m_units);

        ZAux_Direct_GetMspeed(g_handle, 0, &m_speed);

        ZAux_Direct_GetAccel(g_handle, 0, &m_accel);



        //Get axis parameters of axis 1

        ZAux_Direct_GetAtype(g_handle, 1, &m_Atype1);

        ZAux_Direct_GetUnits(g_handle, 1, &m_untis1);

        ZAux_Direct_GetMspeed(g_handle, 1, &m_speed1);

        ZAux_Direct_GetAccel(g_handle, 1, &m_accel1);

        ZAux_Direct_GetDpos(g_handle, 1, &m_dpos1);

        ZAux_Direct_GetIfIdle(g_handle, 1, &m_idle1);





(5) Download the bas file to the controller ROM through the event handler function of the file download button. (Note: ". Bas" file can also be downloaded through our ZDevelop software)

//Download BAS file to controller ROM

void CTest_BusInitDlg::OnDownload()          


    int32   ret;

    CString m_strOpenFileName;

    CFile  openfile;

    if(NULL == g_handle)


        MessageBox(_T("Controller not connected"));



    CFileDialog fileopen(true, ".bas", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,  "Basic Files (*.bas)|*.bas|All Files (*.*)|*.*||", NULL);

    if (fileopen.DoModal() == IDOK)


        //Gets the open file name and path

        m_strOpenFileName = fileopen.GetPathName();

        if (!openfile.Open(fileopen.GetPathName(), openfile.modeRead | openfile.modeNoInherit, NULL))


            this->MessageBox("Open Failed!");





        //Download BAS program to ROM

        ret = ZAux_BasDown(g_handle, m_strOpenFileName, 1);

        if (ret != 0)


            this->MessageBox("DownLoad File Failed!");



        //The file name is obtained by string segmentation

        char* pchar = (LPSTR)(LPCSTR)m_strOpenFileName;

        CString strTmp = strtok(pchar, "\\"); 




           if (strTmp==_T(""))


           strcpy(&FileName, (LPSTR)(LPCSTR)strTmp);




(6) The controller is realized through the event processing functions of start, stop, pause and continue buttons.

//Run the ZBasic file in the controller

void CTest_BusInitDlg::OnBnClickedRun()


    int ret = 0;

    char Temp[100] = "Run \"";

    //Synthesize the command string of "run" file2.bas ", 0"

    strcat(Temp, &FileName);

    strcat(Temp, "\", 0");

    //Stop task 0

    ZAux_Execute(g_handle, "STOPTASK 0", NULL, 0);

    //Open task 0

    ZAux_Execute(g_handle, Temp, NULL, 0);


//Stop the task of the controller running ZBasic

void CTest_BusInitDlg::OnBnClickedStop()


    //Stop task 0

    ZAux_Execute(g_handle, "STOPTASK 0", NULL, 0);

    //Stop all axis movements

    ZAux_Execute(g_handle, "RAPIDSTOP(2)", NULL, 0);



void CTest_BusInitDlg::OnBnClickedpause()


    //Pause the BASIC program running inside the controller


    //Pause spindle movement

    ZAux_Direct_MovePause(g_handle, 0, 0);


//Continue running

void CTest_BusInitDlg::OnBnClickedResume()


    //Continue to run the BASIC program running inside the controller


    //Continue spindle movement

    ZAux_Direct_MoveResume(g_handle, 0);


3, Commissioning and monitoring

Compile and run the routine, and connect the controller through ZDevelop software to monitor the controller status.

1.ZDevelop software connects the controller and opens the debugging mode to view the file name of ". bas" file in the controller.

2. Capture the waveform of continuous small line segments through the oscilloscope function of ZDevelop software. The following is the comparison between oscilloscope waveform and CAD drawing.

A. The operation of ECI3808 is as follows: (the Rom of ECI3808 is only 4KB, so the downloaded Basic file cannot exceed 4KB)

B. The operation of ZMC308B controller is as follows: (the Rom of ECI3808 is only 4KB, so the downloaded Basic file cannot exceed 4KB. Therefore, the operation of the following tracks needs to be realized with the help of ZMC308B controller)

3.ZDevelop software debugging video.

Easy to use motion control card (VI) basic file download and continuous trajectory processing

This time, the simple and easy-to-use motion control card of forward motion technology (VI): Basic file download and continuous trajectory processing, which is shared here.

For more interesting content, please pay attention to the "public assistant" official account, and you need the relevant development environment and routine code. Please consult the sales engineer of the sports technology.

This article is original by positive motion technology. You are welcome to reprint it and learn together to improve China's intelligent manufacturing level. The copyright of this article belongs to rightmovement technology. If you reprint it, please indicate the source of the article.

Posted on Mon, 08 Nov 2021 09:22:30 -0500 by garry