Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

Economical EtherCAT Motion Controller (6-1) -- Data Storage | Register of Modbus, Table, Flash & VR.


--XPLC006E Function Introduction--

XPLC006E  is a kind of multi-axis economical EtherCAT bus motion controller developed by ZMotion Technology, and XPLC series motion controllers can be applied in all kinds of occasions that need offline or online operation.

6-image 1.png

XPLC006E has 6 motor axes itself, and motion control of 12 axes at most can be achieved (including virtual axes). Also, it supports 12-axis linear interpolation, electronic cam, electronic gear, synchronous follow, virtual axis setting, etc.

In addition, XPLC006E cost-effective controller supports multi-task run synchronously. At the same time, it can do simulation on PC directly. There are several valid programming methods, such as, Basic / PLC ladder diagram / HMI configuration in ZDevelop software and commonly used upper computer software.

For PC upper computer API programming, following interfaces are supported: C#, C++, LabVIEW, VB, matlab, Qt, Linux, .Net, iMAC, Python, ROS, etc.

6-image 2.png

→Actually, according to different axis numbers, there are XPLC004E, XPLC006E and XPLC008E

There is one note: XPLC006E belongs to bus motion controller, which means it only supports EtherCAT bus axes, pulse axes and encoder axes are invalid. Then, it uses EtherCAT bus and drive to communication with refresh cycle of 1ms.

//



--XPLC864E2 Function Introduction--

Let's see  XPLC864E2 , it is upgraded on the basis of XPLC006E, which means, it supports all functions of XPLC006E mentioned above, and usages are basically the same. However, some resource spaces are better than XPLC006E. What's more, XPLC864E2 supports 32 inputs, 32 outputs, 2 ADs and 2 DAs in hardware level, pulse axis and bus axis can be hybrid used. The number of real axes is 8 totally. Except EtherCAT interface, in hardware of output, signal output of 8 axes in pulse direction can be configured, and be with 2 encoder inputs set by input configuration.

Same, XPLC864E2 supports PLC, Basic and HMI configuration programming methods. For PC upper computer API programming, following interfaces are supported: C#, C++, LabVIEW, VB, matlab, Qt, Linux, .Net, iMAC, Python, ROS, etc.

6-image 3.png

6-imgae 4.png


//

Let's enter the main idea ~ 






01   TABLE Register

TABLE is a very large array that comes with the controller, the data type is 32-bit floating point (4 series and above are 64-bit floating point), please note is doesn't support power failure storage. When writing a program, the TABLE array does not need to be defined again and can be used directly. The index subscript starts from 0, and it is valid to assign value and read in bulk.

Some instructions of ZBasic can directly read the values in TABLE as parameters, such as CAM, CAMBOX, CONNFRAME, CONNREFRAME, MOVE_TURNABS, B_SPLINE, CAN, CRC16, DTSMOOTH, PITCHSET, HW_PSWITCH, etc.

Parameters sampled by the oscilloscope are also stored in TABLE. Therefore, in the development and application, pay attention to the allocation and use of multiple TABLE areas, and do not overlap with the data storage area sampled by the oscilloscope.

1) TABLE instruction reads and writes data:

TABLE(0) = 10                       ′assign TABLE(0) as 10

TABLE(10,100,200,300)               ′Mass assignment, assign TABLE(10) as 100, assign TABLE(11) as 200, assign TABLE(12) as 300

2) TABLE size can be read by TSIZE instruction, and can be modified (can't be over TABLE max space).

PRINT   TSIZE                       ′print controller TABLE size

TSIZE = 10000       ′set TABLE size, which can’t be over max controller TABLE size

3) TABLESTRING instruction prints data in TABLE according to character string format.

TABEL(100,68,58,92)

PRINT TABLESTRING(100,3)    ′print data in string form, then convert to ASCII code.

PTINT RESULT: D:\

4) When TABLE is used as parameter to pass, uses are basically same. Save data into TABLE firstly, then use instruction to call data in TABLE.

(1) For example: CAM cam

CAM(start point, end point, table multiplier, distance)

start point: TABLE No. of starting point, where stores the first point.

end point: TABLE No. of ending point

table multiplier: the position is multiplied by this ratio, generally set to the pulse equivalent

distance: refer to motion distance

(2) Example of usage:

TABLE(10,0,80,75,40,50,20,50,30,65,0)    'TABLE starts to store data from 10, assign TABLE (10) as  0, assign TABLE (11) as 80

CAM(10,17,100,500)          'Motion track is from TABLE(10) to TABLE(17)

(3) There are two ways to view the data in TABLE:

→ enter “?*TABLE(10,8)” on the online command, starting from TABLE(10), 8 data in turn.

6-image 5.png

→ Check the DT (TABLE) data in the register, starting from 10, and there are 8 numbers.

6-image 6.png





02     MODBUS Register

MODBUS register conforms to MODBUS standard communication protocol, there are bit register and word register. And all the third party's equipment with MODBUS standard protocol can be communicated with controller, the data is passed through MODBUS register. (MODBUS register doesn't support power failure storage, but it is valid to write and read in bulk)

--Bit register: MODBUS_BIT, for touch screen, it is called MODBUS_0X, Boolean type.

--Word register: MODBUS_REG, MODBUS_LONG, MODBUS_IEEE, MODBUS_STRING. For touch screen, it is called MODBUS_4X, see the below:

6-image 7.png

The MODBUS word register in the controller occupies the same variable space, one LONG occupies two REG addresses, and one IEEE also occupies two REG addresses. When using, pay attention to stagger the word Register No. address.

→MODBUS_LONG(0) occupies two REG addresses, MODBUS_REG(0) and MODBUS_REG(1).

→MODBUS_LONG(1) occupies two REG addresses, MODBUS_REG(1) and MODBUS_REG(2).

→MODBUS_IEEE(0) occupies two REG addresses, MODBUS_REG(0) and MODBUS_REG(1).

→MODBUS_IEEE(1) occupies two REG addresses, MODBUS_REG(1) and MODBUS_REG(2).

Therefore, pay attention not to overlap MODBUS_REG, MODBUS_LONG, MODBUS_IEEE addresses in users application programs.

4X space diagram:

6-image 8.png

Routine:

MODBUS_REG(0)=0                     ′initialize as 0

MODBUS_REG(1)=0                     ′initialize as 0

MODBUS_LONG(0)=70000           ′assign modbus_long as 70000, range of modbus_reg is  -32768~32767

?MODBUS_REG(0), MODBUS_REG(1) ′print reg(0) -- 4464, reg(1) is 1, long(0)=reg(1)*2^16+reg(0)

In the process of serial port setting (SETCOM parameter), when the register is selected as VR, a VR is mapped to a MODBUS_REG at this time. And the VR is a 32-bit floating point type, MODBUS_REG is a 16-bit integer type with signs. But the data transmitted from VR to MODBUS_REG will lose the fractional part. When VR data exceeds plus or minus 15 digits, the MODBUS_REG data will be changed.

MODBUS_REG transmits data to VR without problems, see the following routines, and see the SETCOM instruction for more information.

Routine:

VR(0)=0          ′initialize VR(0) and MODBUS_REG(0) as 0

MODBUS_REG(0)=0

SETCOM(38400, 8,1,0,0,4,0)     ′VR is mapped into MODBUS_REG

VR(0)=100.345                ′set VR(0) = 100.345

?MODBUS_REG(0)             ′print result is 100, VR had been mapped to REG, but REG is integer type, which means fractional part will lose

MODBUS_REG(0)=200          ′set REG(0) as 200

?VR(0)              ′print result is 200, REG changes, VR also changes.

When using the MODBUS protocol to communicate with other devices, it is necessary to transfer data in the MODBUS register, such as communication with a touch screen. When MODBUS communication is not performed, the MODBUS register can also be used as a local array of the controller.

The controller directly corresponds to the input IN port from the MODBUS_BIT address 10000, 20000 corresponds to the output OUT port (note that the read IO is the original state, the INVERT_IN inversion input instruction does not work), 30000 corresponds to the register S of PLC program.

MODBUS_IEEE addresses starting from 10000 correspond to the axis DPOS range, starting from 11000 correspond to the axis MPOS range, starting from 12000 correspond to the axis VP_SPEED range, MODBUS_REG addresses starting from 13000 correspond to the analog DA output range, and starting from 14000 correspond to the analog AD input range.

6-image 9.png






03       VR Register

The VR register has a power-down storage function and can be read and written infinitely, but the data space is small, like XPLC006E series controllers, there are 1024 addresses. The VR space of the latest series of controllers is 8000, which is used to save data that needs to be modified continuously, such as axis parameters, coordinates, etc., the data type is 32-bit floating point (4 series and above are 64-bit floating point).

Use VR_INT to force an integer, and VRSTRING to force a string. VR, VR_INT, VRSTRING share a space, and the address space is overlapping. Read and write methods of VR and VR_INT are the same, VRSTRING saves ASCII code, and one character occupies one VR.

The principle of VR's power-off storage is that the controller has a power shortage memory inside, but the data capacity is small, so the data with a large amount of data or data that needs to be saved for a long time is best to be written into the FLASH block or exported to a U disk.

The VR register can also be used for the RTEX controller to transmit reading and writing data, write parameter through DRIVE_WRITE, and read through "DRIVE_READ". For details, see RTEX instruction of ZBasic Program Manual.

All data in the VR can be cleared through CLEAR instruction, and then CLEAR_BIT instruction will set a certain position of VR to 0, READ_BIT instruction will read a certain bit data of VR register, SET_BIT instruction will set a certain position of VR to 1.

Example 1: VR usage method

VR(0)                                       ′assign

aaa = VR(0)                             ′read

Example 2: data conversion in VR register

VR(100)=10.12

VR_INT(100) = VR(100)            ′data conversion

?VR_INT(100)                 ′print result: 10, from floating to integer type

Example 3: VRSTRING stores character string

VRSTRING(0,4) = “abc”        ′save character string, starting from VR(0)

PRINT VRSTRING(0,4)         ′print result: abc

6-image 10.png






04       FLASH Register

Strictly speaking, FLASH is not a register, but it is closely related to the register. The important data will be saved into FLASH.

FLASH has a power-down storage function, and the number of reading and writing limit is 100,000 times, and data will not be lost if it is not powered on for a long time. It is generally used to store large data that does not require frequent reading and writing, such as processing files.

When reading and writing, pay attention to ensure that the names and order of variables, arrays, etc. to be operated are highly consistent. If they are inconsistent, data will be cluttered.

When FLASH is used, it is numbered as per block, including save data (variables, arrays, etc. ) and read data. The number of blocks can be checked through "FLASH_SECTES" instruction. FLASH blocks and block data size of controllers are different, the size of each are checked through FLASH_SECTSIZE instruction.

Also, view it through online and command line, storage size of one certain model controller as shown below -- FLASH Block numbers & Flash Total Size

6-image 11.png

Parameters set by CAN communication, IP address, APP_PASS, LOCK password and other system parameters are stored in FLASH.

Note: data must be written write into FLASH before reading, otherwise an alarm WARN will be prompted.

How to use FLASH:

GLOBAL   VAR                         ′variable definition

GLOBAL   ARRAY1(200)            ′array definition

DIM    ARRAY2(100)

′data is stored in FLASH block: Write VAR, ARRAY1, ARRAY2 data into FLASH block 1 in turn

FLASH_WRITE 1, VAR, ARRAY1, ARRAY2

′FLASH block data read: read the data of FLASH block 1 into VAR, ARRAY1, ARRAY2 in sequence

FLASH_READ 1, VAR, ARRAY1, ARRAY2  'The reading order is consistent with the writing order






05 Cutosmized Parameters

(1) Variable Definition

Variable is the parameter that can be self-defined by users. It is used to temporarily save communication data with external equipment or data that's processed by task inside. Namely, it saves data that is with property, like, name or data type, etc. There is no need to assign address allocation between variables and memory addresses.

Variable definition instruction: global variable (GLOBAL), file module variable (DIM), local variable (LOCAL).

→Global variable (GLOBAL): it can be used in any file of project.

→File module variable (DIM): it only can be used in file inside project.

→Local variable (LOCAL): it is mainly used in the SUB, which means it is invalid in other files.

Variable can be assigned without definition, now variable is the DIM by default, and variable definition command needs to be written in the beginning of program, which means ensure it is executed firstly after powered on, otherwise, invalid variables may happen.

Example:

GLOBAL   g_var2                  ′define the global variable g_var2

    DIM   VAR1                     ′define file module variable VAR1

SUB   aaa()

    LOCAL   v1                      ′define local variable V1

    v1=100

END SUB

(2) Constant Definition

The value of a variable varies depending on the data that is substituted for that variable. The relative fixed value is a constant. Once the value of the constant is defined, it cannot be modified, which means it can only be read.

CONST defines a constant once time, and the definition and assignment must be the same line. Constant can be defined as global constant GLOBAL CONST. GLOBAL is used in any file, but there is no way to write LOCAL CONST. Constant is different from variable, it doesn't save the information in memories. There are many common constants, such as, Boolean type, Character String type, Time type, Date type, Integer type, etc.

Example:

CONST    MAX_VALUE = 100000      ′define file constant

GLOBAL CONST    MAX_AXIS = 6    ′define global constant

(3) Array Definition

Array assignment means that the data of the same attribute are collectively defined, and the number of data is designated. The pieces of data that make up the array are called "elements".

GLOBAL and DIM are relative instructions, but LOCAL definition is not supported.

Pay attention to array space designation, it can't be over definition range. Otherwise, program will appear error that indicates the array space limits.

Example:

DIM  array(15)                          ′define file array, valid 15 arrays, number 0~14

GLOBAL  array2(10)                  ′define global array, valid 10 arrays, number 0~9






06 Data Type

The data type refers to the specific provisions on the form and range of the value represented by the variable. When the variable is declared, the size of the data type is determined according to the size of the data range in the memory. The larger the data range in the memory, the larger the range of values that can be represented (data type of instruction input or variable output are determined by instructions).

The data type of self-defined variable belongs to dynamic type. When integer is assigned to variable, the variable is integer type. When floating type is assigned to variable, the variable is floating point type.

Self-defined array' s data types are single-precision floating point and double-precision floating point. Please refer to below floating point introduction.

(1) Single-precision floating point 32-bit:

Single-precision floating point data format: VR, MODBUS_IEEE, TABLE and self-defined array and variable (ZMC3XX series controller and former series)

6-image 12.png

(2) Double-precision floating point 64-bit:

Double-precision floating point data format: TABLE and self-defined array and variable (ZMC4XX series controller and following series)

6-image 13.png

(3) Common register data type form:

6-image 14.png

The memory capacity required for all data does not match the total data size (capacity value) of each data because the head position of the data allocated to the memory is automatically allocated to the multiple position of the "calibration value (boundary value)" for each whitespace occurs between data types. Even if the kinds of data types are the same, the overall occupied data size still varies depending on the order of the data types.

Note data types when operating data of different types, otherwise data will be lost if types are not matched.







Copyright © 2013-2024 Shenzhen Zmotion Technology Co.,Ltd Design by Zmotion    粤ICP备13037187号 Motion Controller-Motion Control Card

Contact Us-Youtube