Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

Source Codes of IO Read & Write Speed Testing For You

Note: For PART ONE -- PART THREE, please refer to former article "How to Test Your IO Card Read & Write by C#?".

Article Guidance
Zmotion Technology

We Zmotion Technology tested  IO reading and writing speed with C# for your reference. Specifically, the hardware we used is ECI motion control card EIO00XX series IO card, ECI0032 & ECI0064, for other models of ECI00XX series, they are with same usages and results.

Information will be shown from these aspects: 
PART ONE
  What is ECI0032 / ECI0064 IO Card?

  

PART TWO
  How to Check ECIO Control Card "IN" & "OP" Functions?


PART THREE
  How to Check Develop ECIO Card by C#?

  

PART FOUR
  Test Routine Codes: Quick to Read Multi-IO States in C#

  

PART FIVE
  Test Result



“Related”

*PC (C#) Function Library: https://www.zmotionglobal.com/download_list_21.html *

*PC (C#) Development Examples: https://www.zmotionglobal.com/download_list_15.html *

*Hardware – ECIO IO Card Cards: https://www.zmotionglobal.com/pro_list_95.html *

*Software – RTSys (one free development software, you can download to try it under simulation, please refer to user manual): https://www.zmotionglobal.com/pro_info_282.html *


03
  How to Develop ECIO Card by C#?
Zmotion Technology

Step 1: Create One Project

In VS menu, create one project at first – click “File” – “New” – “Project”.


Step 2: Select Development Language

Please select Visual C#, .NET Framework 4, and Windows application program.


Step 3: Obtain Zmotion PC C# API Func tion Library

A.      You can download from here or contact us directly.

18.png

B.      Copy Zmotion C# library file and corresponding files into new created project.

          a. copy “zmcaux.cs” file into new created project.

       b. put “zaux.dll” and “Zmotion.dll" files into folder bin – debug.

C.    Open the new built project in VS, and in “solution resources manager”, click “show all”, then click “zacaux.cs” file, click “include in project”.

D.     Double click Form1 of Form1.cs, code editing interface appears, then write “using cszmcaux” at the beginning, and state the controller handle g_handle.

19.png


Step 4: Develop Your Project

A.      Get Zmotion PC Programming Manual

You can check which commands you need in the manual.

Zmotion PC programming manual can be obtained from here ( Zmotion – download – software manual – PC manual), and there are many examples, mainly about Windows, if you need Linux and Wince platforms, please contact us.

B.      Commands Related to Read & Write IO

--How to Connect to Controller--

20.png

--How to Read Multi-IN State Quickly--

21.png

--How to Read Multi-OP State Quickly--

22.png




04
  Test Routine Codes: Quick to Read Multi-IO States in C#
Zmotion Technology

23.png

This is the example HMI interface, next see corresponding C# codes.

Note: full project can be obtained by us.

A.      Connect to controller by API function ZAux_OpenEth().

B.      Open timer 1 to watch controller IO states.

//update IO information by timer

 private void timer1_Tick(object sender, EventArgs e)

 {

    int j,k;

    int TestNum = 50;

    //quick to read multiple inputs, test the time

    byte[] InState = new byte[4];

    DateTime beforeDT = System.DateTime.Now;

    for(int count = 0; count < TestNum; count++)

    {

        zmcaux.ZAux_GetModbusIn(g_handle, 0, 32, InState);

        /*for (int i = 0; i < 32; i++)

        {

            j = i / 8;

            k = i % 8;

            if (((InState[j] >> k) & 1) == 1)

            {

                InStatus[i].BackColor = Color.FromArgb(200, 255, 200);

            }

            else

            {

                InStatus[i].BackColor = Color.FromArgb(255, 200, 200);

            }

        }*/

    }

    DateTime afterDT = System.DateTime.Now;

    //calculate the time difference between beforeDT and afterDT

    TimeSpan ts = afterDT - beforeDT;

    InMoitoring.Text = "IN State_Refresh: " + (ts.TotalMilliseconds*1000/ TestNum).ToString() + " us    ";

 

    //quick to read multiple outputs, test the time

    byte[] OutState = new byte[4];

    DateTime beforeDTOP = System.DateTime.Now;

    for (int count = 0; count < TestNum; count++)

    {

        zmcaux.ZAux_GetModbusOut(g_handle, 0, 32, OutState);

        /*for (int i = 0; i < 32; i++)

        {

            j = i / 8;

            k = i % 8;

            if (((OutState[j] >> k) & 1) == 1)

            {

                OutStatus[i].BackColor = Color.FromArgb(200, 255, 200);

            }

            else

            {

                OutStatus[i].BackColor = Color.FromArgb(255, 200, 200);

            }

        }*/

    }

    DateTime afterDTOP = System.DateTime.Now;

    //calculate the time difference between beforeDTOP and afterDTOP

    ts = afterDTOP - beforeDTOP;

    OutMoitoring.Text = "OP State_Refresh: " + (ts.TotalMilliseconds*1000 / TestNum).ToString() + " us    ";

          

    for (int i = 0; i < 32; i++)

    {

        j = i / 8;

        k = i % 8;

        if (((InState[j] >> k) & 1) == 1)

        {

            InStatus[i].BackColor = Color.FromArgb(200, 255, 200);

        }

        else

        {

            InStatus[i].BackColor = Color.FromArgb(255, 200, 200);

        }

    }

    for (int i = 0; i < 32; i++)

    {

        j = i / 8;

        k = i % 8;

        if (((OutState[j] >> k) & 1) == 1)

        {

            OutStatus[i].BackColor = Color.FromArgb(200, 255, 200);

        }

        else

        {

            OutStatus[i].BackColor = Color.FromArgb(255, 200, 200);

        }

    }

 }


C.      Read multiple IN states, test the speed.

D.      Read multiple OP states, test the speed.

E.      Write multiple OP states, test the speed.




0 5
Test Result