Share this

Quick Start Guide | Part 8: How to use the EtherCAT bus in motion controllers?

2026-04-06 07:24:38 · · #1

Previously, Zheng Motion Technology shared with everyone the firmware upgrade of motion controllers, ZBasic program development, ZPLC program development, application of communication with touch screens and input/output IO, application of motion controller data and storage, and use of motion controller ZCAN bus expansion modules.

Today, we will explain the basic usage of the EtherCAT bus in the positive motion technology motion controller.

Tutorial video link: "Quick Start | Part 8: How to Use the EtherCAT Bus for Motion Controllers?"

1. Material preparation and controller wiring reference

Materials preparation:

1) One computer with ZDevelop version 3.01 or later installed.

2) One controller.

3) Two 24V DC power supplies (main power supply and I/O power supply).

4) Several bus drivers + motors (or stepper drivers + motors).

5) Several controller wiring terminals.

6) Several network cables.

7) Several connecting wires.

8) Multiple expansion modules of different types (see below for wiring reference of expansion modules).

Controller Wiring Reference

2. The role of the extension module

When the controller's own axis and I/O resources are insufficient, expansion modules can be used to expand them. These modules can support pulse axes, digital input/output, and analog input/output. Only expansion modules with pulse axis interfaces support expanding the number of pulse axes; bus axes are not expandable.

According to the connection method, expansion modules can be divided into two categories: ZCAN bus expansion modules and EtherCAT expansion modules.

Based on product series, they can be divided into three main categories: ZCAN expansion modules, EtherCAT expansion modules, and ZMIO300 expansion modules.

IO digital expansion: The number of IO points for ZMC controllers 4 series and above can be expanded to 4096 points.

AIO Analog Input Expansion: The number of AIO points for ZMC controllers 4 series and above can be expanded to 520 points.

Axis expansion: Only pulse axes can be expanded. Considering cost and usage, it is not recommended to use too many axis expansion boards. You can choose a controller model that supports more pulse axes.

The controller's scalable number of I/O points can be viewed in the hardware manual or by typing ?*max in the "Command & Output" window.

3. EtherCAT bus expansion module

The EtherCAT bus expansion modules include two series: EIO expansion modules and ZMIO300-ECAT expansion modules.

The EIO1616MT supports extended digital I/O, including 16 inputs and 16 outputs.

The EIO24088 is expandable for digital I/O and pulse axes, supporting up to 8 pulse axes, including 24 inputs and 8 outputs.

The ZMIO300-ECAT expansion module is a vertical modular module that can expand digital I/O and analog I/O.

EtherCAT communication recommends using shielded twisted-pair cables for network data transmission.

EIO1616MT

EIO24088

ZMIO300-ECAT+16DO+16DI+4DA+4AD

1) EIO extension module

A. The EIO expansion module uses the EtherCAT bus for expansion, and the available models are shown in the table below:

The EIO1616 has dual power supplies (in addition to the main power supply, the I/O also needs a separate power supply), while the EIO24088 has a single power supply.

The digital I/O interface of the extension module supports NPN type by default.

Wiring the EtherCAT expansion module simply involves connecting the EtherCAT ports of each module to each other. The EIO expansion board has two EtherCAT interfaces: the EtherCAT IN port connects to the main controller, and the EtherCAT OUT port connects to the next-level expansion board or driver device. These interfaces cannot be mixed.

B. Wiring for EIO expansion module

The EIO expansion wiring reference is as follows:

ZMC432+EIO24088+EIO1616

2) ZMIO300-ECAT expansion module

A. The ZMIO300-ECAT expansion module can be paired with the following sub-modules: (See table below)

The analog input has a precision of 16 bits and offers both NPN and PNP input modes. The digital input/output ports are equipped with signal status indicator lights.

The ZMIO300-16DO/ZMIO300-16DOP digital outputs require a separate power supply.

B. Wiring for the ZMIO300-ECAT expansion module

The wiring reference for the ZMIO300-ECAT expansion module is as follows, and it is the same as the wiring method for the EIO expansion module.

The EtherCAT IN port and the EtherCAT OUT port cannot be used interchangeably.

4. EtherCAT bus usage

Motors connected to the EtherCAT bus require a program to be written to enable them. Once enabled, their application is the same as pulse motors, with identical motion commands. The initialization program is provided at the end of this article.

The initialization process mainly includes the following steps:

1. Bus Scan SLOT_SCAN (slot)

2. Axis mapping AXIS_ADDRESS, extension module IO mapping NODE_IO

3. Start the bus: SLOT_START (slot)

4. Clear drive errors DRIVE_CLEAR(0)

5. Axis enable: AXIS_ENABLE (single axis enable), WDOG (overall enable)

After successful initialization, motion control commands can be used to control the operation of the bus axis.

Extended resources must be mapped to controller local resources before they can be used.

Different EtherCAT extension modules use the same IO mapping and axis mapping methods.

IO mapping is set using the NODE_IO command (digital) and the NODE_AIO command (analog), while axis mapping is set using the AXIS_ADDRESS command.

When mapping IO, first check the controller's own maximum IO number (including external IO interfaces and interfaces within the pulse axis), and then set it using commands.

If the extended IO has the same IO number as the controller's own IO, both will work simultaneously. Therefore, the IO mapping number must not be repeated throughout the entire control system.

5. EtherCAT bus related concepts

Bus-related command parameters will use the following numbers:

Slot number

The slot number refers to the number of the bus interface on the controller, which defaults to 0. If the controller has multiple bus interfaces, use *SLOT to view the slot number.

When the motion controller supports a single bus, the slot number is 0.

When dual buses are supported, the EtherCAT bus slot number is 0 and the RTEX bus slot number is 1.

Device number (node)

The device number refers to the number of all devices connected to a slot. It starts from 0 and is automatically numbered according to the connection order of the devices on the bus. It can be viewed using the NODE_COUNT(slot) command.

Drive number

The controller will automatically identify the drivers in the slots, numbering them starting from 0 and according to the connection order of the drivers on the bus.

The drive number is different from the device number. Only the drive device number is assigned to the drive in the slot, and other devices are ignored.

6. I/O mapping

1) Digital I/O

The NODE_IO instruction sets the starting number of the digital I/O pins of a device. The starting numbers for inputs and outputs are the same for each individual device. This setting can only be done after a bus scan.

grammar:

NODE_IO(slot, node) = iobase

slot: slot number, 0 - default

node: Device ID, starting from 0.

iobase: Maps the starting I/O number; the result will only be a multiple of 8.

Example:

SLOT_SCAN(0) 'Scan bus

IF NODE_COUNT(0)>0 THEN 'Check if there is a device in slot 0'

NODE_IO(0,0)=32 'Sets the starting I/O number of device 0 on interface 0 of slot 0 to 32'

`NODE_IO(0,0)` prints the starting I/O number of device 0.

ENDIF

2) Analog I/O

The NODE_AIO instruction sets the starting number of the analog I/O pins of a device. The starting numbers for inputs and outputs of a single device are the same. It can only be read after a bus scan.

NODE_AIO(slot, node[,idir])=Aiobase

slot: slot number, 0 - default

node: Device ID, starting from 0.

idir: AD/DA selection. 0 - Default, sets both AIN and AOUT, read-only AIN; 3 - AIN; 4 - AOUT.

Example:

SLOT_SCAN(0) 'Scan bus

IF NODE_COUNT(0)>0 THEN 'Check if there is a device in slot 0'

NODE_AIO(0,0,0)=8 'Sets the starting number of both AIN and AOUT for interface device 0 in slot 0 to 8.

`NODE_AIO(0,0,0)` prints the starting AIO number of device 0.

ENDIF

7. EtherCAT bus axis mapping

Bus axes require axis mapping operations, which are performed using the AXIS_ADDRESS instruction. The operation method is as follows:

AXIS_ADDRESS(axis number) = (slot number << 16) + driver number + 1

The axis mapping is written in the bus initialization program, after the bus scan and before the bus is enabled.

Example:

AXIS_ADDRESS (0) = (0 << 16) + 0 + 1 'First ECAT drive, drive number 0, bound to axis 0

AXIS_ADDRESS (2) = (0 << 16) + 1 + 1 'Second ECAT drive, drive number 1, bound to axis 2

AXIS_ADDRESS (1) = (0 << 16) + 2 + 1 'Third ECAT drive, drive number 2, bound to axis 1

ATYPE(0)=65 'Set as ECAT axis type, 65-position, 66-speed, 67-torque

ATYPE(1)=65

ATYPE(2)=65

8. EtherCAT bus status

After successfully connecting to the controller using the programming software, perform a bus scan, and then enter ?*EtherCAT in the online command bar to print the status of each node.

Slot 0 contains 1 node: Slot 0 has a total of 1 device connected.

Lostcount 0-0: Number of packets lost

Node: Device connection number

Status: Device connection status, see NODE_STATUS.

Mainid: Vendor ID

Productid: Device ID

Axises: Total number of axes in the equipment

Alstate: Device OP status

Node_profile: Device Profile settings

Bindaxis: The axis number mapped to the controller; -1 indicates no mapping.

Drive_profile: Device transmit/receive PDO configuration

Controlword: Control word

Drive_status: Current device status. See DRIVE_STATUS for more details.

Drive_mode: Device control mode

Target: Motor position

Encode: Encoder position

9. EtherCAT Extension Module Reference Configuration

After the control module wiring is completed, connect the controller using ZDevelop software, run the bus initialization program, open the "Controller" - "Controller Status" window, and view the information of slot 0 node. You can see the information of all devices connected to the EtherCAT bus.

1) EIO extension module

Control module configuration:

One ZMC432 + one EIO1616MT.

The node number of the EIO1616MT is 0. The extended digital input IOs are numbered 1024-1039, a total of 16. The extended digital output IOs are numbered 1024-1039, a total of 16.

NODE_IO(0,0)=1024

2) ZMIO300-ECAT expansion module

Control module configuration:

1 ZMC432 + 1 ZMIO300-ECAT communication module + 4 ZMIO300-16DI inputs + 2 ZMIO300-16DO outputs + 1 ZMIO300-4AD + 1 ZMIO300-4DA .

NODE_IO(0,0)=32 'IO mapping, starting with number 32, extending to 64 inputs and 32 outputs.

NODE_AIO(0,0,0)=4 'AIO mapping, starting with number 4, extending to 4 inputs and 4 outputs.'

10. EtherCAT Bus Reference Configuration 1

Control module configuration:

One ZMC432 + two bus drivers.

Connect to the controller using ZDevelop software. After executing the bus initialization program, open the "Controller" - "Controller Status" window to view the information of node 0 in slot 0, or enter ?*EtherCAT in the online command bar to print the status of each node.

At this time, two nodes can be scanned on the bus. Both nodes are bus drivers. Each driver drives a motor. The axis of node 0 is mapped to axis 6, and the axis of node 1 is mapped to axis 7.

AXIS_ADDRESS(6) = (0<<16)+0+1 'Mapping axis number

AXIS_ADDRESS(7) = (0 << 16) + 1 + 1

ATYPE(6)=65 'Set control mode, 65-position, 66-speed, 67-torque

ATYPE(7)=65

Entering ?*EtherCAT in the online command bar will print the following information:

11. EtherCAT Bus Reference Configuration 2

Control module configuration:

One ZMC432 + one EIO1616MT + two bus drivers.

Connect to the controller using ZDevelop software. After executing the bus initialization program, open the "Controller" - "Controller Status" window to view the information of node 0 in slot 0, or enter ?*EtherCAT in the online command bar to print the status of each node.

At this time, three nodes can be scanned on the bus. Node 0 is the EIO1616MT digital I/O expansion module, with 16 inputs and 16 outputs. The I/O mapping number range is 32-47, and NODE_IO(0,0)=32.

Nodes 1 and 2 are both bus drivers, each driving a motor. The axis numbers of these two axes are mapped to axis 6 and axis 7, respectively.

Entering ?*EtherCAT in the online command bar will print the following information:

12. EtherCAT bus initialization program

This initialization program is a general version, and all of the above configurations are applicable. When using it, you only need to change a few globally defined parameters.

The motion control module is written based on actual usage.

**********ECAT Bus Initialization Main Program***********

global CONST PUL_AxisStart = 0 'Local pulse axis start axis number'

global CONST PUL_AxisNum = 0 'Number of local pulse axes'

global CONST Bus_AxisStart = 6 'Starting axis number of the bus axis'

global CONST Bus_NodeNum = 1 'Number of bus configuration nodes, used to determine whether the actual number of detected slave stations is consistent.

global MAX_AXISNUM 'Maximum number of axes'

MAX_AXISNUM = SYS_ZFEATURE(0) 'Automatically obtain the number of axes supported by the controller'

global Bus_InitStatus 'Bus initialization complete status'

Bus_InitStatus = -1

global Bus_TotalAxisnum 'Check the total number of axes scanned'

delay(3000) 'Delays for 3 seconds to wait for the driver to power on. The power-on time varies depending on the driver. Adjust the delay according to the specific driver.

"Bus communication cycle:",SERVO_PERIOD,"us"

Ecat_Init() 'Initialize the ECAT bus

while (Bus_InitStatus = 0)

Ecat_Init()

wend

If Bus_InitStatus = 1, then 'Is bus initialization complete?'

main() 'Motion control module

endif

END

'************ECAT Bus Initialization**********

Initial process: slot_scan (scan bus) -> slave node maps axes/IO -> SLOT_START (start bus) -> initialization successful

'***********************************

global sub Ecat_Init()

LOCAL Node_Num 'Node device number'

LOCAL Temp_Axis 'Current bus axis number'

LOCAL Drive_Vender 'Current device vendor ID'

LOCAL Drive_Device 'Device Number'

LOCAL Drive_Alias ​​'Device DIP switch ID'

RAPIDSTOP(2)

for i=0 to MAX_AXISNUM - 1 'Initialize and restore axis type

AXIS_ENABLE(i) = 0 ' Enable axis shutdown

atype(i)=0 'Set as virtual axis

AXIS_ADDRESS(i) = 0

DELAY(10) 'Prevents all drivers from switching enable simultaneously, which could cause excessive instantaneous current.'

next

Bus_InitStatus = -1

Bus_TotalAxisnum = 0 'Set the total number of axes on the scanned bus to 0

SLOT_STOP(0)

delay(200)

slot_scan(0) 'Scan the bus'

if return then

"Bus scan successful", "Number of connected slave devices:" NODE_COUNT(0)

If NODE_COUNT(0) <> Bus_NodeNum then 'Check if the number of bus detections is the same as the actual number of connections.'

""

"The number of scanned nodes does not match the program's configured number!" , "Configured number: "Bus_NodeNum", "Number of detected nodes: "NODE_COUNT(0)

Bus_InitStatus = 0 'Initialization failed. Alarm message'

'return

endif

"Start mapping axis numbers"

for Node_Num=0 to NODE_COUNT(0)-1 'Traverse all scanned slave nodes

Drive_Vender = NODE_INFO(0,Node_Num,0) 'Read device manufacturer

Drive_Device = NODE_INFO(0,Node_Num,1) 'Read the device number

Drive_Alias ​​= NODE_INFO(0,Node_Num,3) 'Read device DIP switch ID

if NODE_AXIS_COUNT(0,Node_Num) <> 0 then 'Determine if the current node has a motor.'

for j=0 to NODE_AXIS_COUNT(0,Node_Num)-1 'Loop to configure axis parameters based on the number of motors connected to the node (for multi-drive systems)

Temp_Axis = Bus_AxisStart + Bus_TotalAxisnum 'Axis numbers are assigned in NODE order, bus start axis number + bus scan axis number

The axis number is assigned according to the DIP switch settings of the drive (special handling is required for one-to-many drives).

base(Temp_Axis)

AXIS_ADDRESS(Temp_Axis) = (0<<16) + Bus_TotalAxisnum + 1 'Mapped axis number

ATYPE=65 'Set control mode 65-position 66-speed 67-torque

disable_group(Temp_Axis) 'Group each axis separately

Bus_TotalAxisnum = Bus_TotalAxisnum + 1 'Total number of axes + 1

next

else 'IO extension module'

Sub_SetNodeIo(Node_Num, Drive_Vender, Drive_Device, 1024 + 32*Node_Num) 'Maps the extension module IO

"Extended I/O mapping complete"

endif

next

"Axis number mapping complete", "Total number of axes connected: "Bus_TotalAxisnum

wa 200

SLOT_START(0) 'Start the bus

if return then

wdog=1 'Enable master switch

"Start clearing drive errors"

for i= Bus_AxisStart to Bus_AxisStart + Bus_TotalAxisnum - 1

BASE(i)

DRIVE_CLEAR(0)

DELAY 50

'Driver error clearing complete'

datum(0) 'Clear controller axis status error'

wa 100

"Axis enable"

AXIS_ENABLE=1

next

Bus_InitStatus = 1

"Axis enable complete"

Local pulse axis configuration

for i = 0 to PUL_AxisNum - 1

base(PUL_AxisStart + i)

AXIS_ADDRESS = (-1<<16) + i

ATYPE = 4

next

"Bus successfully enabled"

else

"Bus startup failed"

Bus_InitStatus = 0

endif

else

"Bus scan failed"

Bus_InitStatus = 0

endif

end sub

'********Bus I/O Module Mapping********'

'Allocate the module's I/O starting address using NODE_IO(0, Node_Num). Delete this segment when the extension module is not in use.'

'*****************************

global sub Sub_SetNodeIo(iNode,iVender,iDevice,i_IoNum)

if iVender = $41B then 'Positive Motion IO Extension Module'

NODE_IO(0,iNode) = i_IoNum

'NODE_AIO(0,iNode) = 4*(iNode+1)

"IO mapping successful"

endif

end sub


'**********Motion Control Module********'

After initialization, use motion control commands to control the movement of the ECAT bus axes.

'*****************************

global sub main()

RAPIDSTOP(2)

WAIT IDLE

BASE(6,7) 'Select the bus axis number'

ATYPE=65,65

UNITS=100,100 'Pulse Equivalent Setting'

SPEED=100,100

ACCEL=1000,1000

DECEL=1000,1000

DPOS=0,0

MPOS=0,0

TRIGGER Auto Trigger Oscilloscope

MOVE(100,100) 'Moves to position 100,100 first.'

MOVECIRC(200,0,100,0,1) 'Draws a semicircle clockwise with a radius of 100, ending at coordinates (300,100).

end sub

That concludes our basic tutorial on using the EtherCAT bus in motion controllers for positive motion technology. For more exciting content, please follow our official WeChat account.

This article was originally created by Zheng Motion Assistant. We welcome everyone to reprint it for mutual learning and to improve China's intelligent manufacturing capabilities. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.

Read next

CATDOLL 60CM Sasha Silicone

Height: 60cm Silicone Weight: 2.7kg Shoulder Width: 14cm Bust/Waist/Hip: 27/24/31cm Oral Depth: N/A Vaginal Depth: 3-8c...

Articles 2026-02-22