Xinje XDH PLC & DS5C1 Servo over EtherCAT: Setup Guide
- PLC
- Xinje
- EtherCAT
- Servo
- Motion control
Pulse/direction control is still very common for servos, but every axis needs its own bundle of wires, the PLC cannot read the motor's real position, and changing a drive parameter means walking to the cabinet with the drive's keypad. With EtherCAT, the PLC talks to every drive over a single daisy-chained network cable, reads the actual position, speed and torque, and changes drive parameters straight from the programming software.
This post records the steps I use to make a Xinje XDH-30A16L-E PLC control several Xinje DS5C1 servo drives over EtherCAT: wiring, scanning the network, setting up the cyclic data (PDO), setting the servo parameters, configuring the axes, and programming with Xinje's motion instructions. It is written for engineers who already know Xinje PLCs and want to move from pulse control to EtherCAT.
Hardware and software used
- A Xinje XDH series PLC (here an XDH-30A16L-E) as the EtherCAT master.
- Xinje DS5C1 servo drives (3 axes in this example), each one an EtherCAT slave.
- Xinje PLC Program Tool. Motion instructions such as A_MOVER need software version 3.7.4 or later and PLC firmware V3.6.1b or later (per the XDH/XLH Motion Control Manual).
1. Wiring
EtherCAT is wired as a daisy chain:
- The EtherCAT port on the PLC goes to the IN port of the first drive.
- The OUT port of the first drive goes to the IN port of the second drive, and so on to the last drive.
- The programming PC plugs into the PLC's normal Ethernet port, not into the EtherCAT line.
The wiring order sets the addresses: the drive closest to the PLC gets StationID 0, the next one StationID 1, and so on. Swap IN and OUT or change the cable order and the axis order no longer matches the program, so write this order on the electrical drawings from the start.
2. Initial setup
2.1. Scanning the EtherCAT network
Create a new project in Xinje PLC Program Tool, connect to the PLC, then open PLC Communication → EthercatMaster → Scan. The software lists the drives it finds in their order on the network, for example StationID:0 XINJE-DS5C1 CoE Drive.

If fewer drives show up than are installed, check the IN/OUT cables and the power of the missing drive before going further.
2.2. Cyclic process data (PDO)
The Expert process data tab shows what the PLC sends to the drive and what it reads back on every cycle:
- SM2 (Outputs), using PDO
0x1600(1st RxPDO): Control Word6040h, Target Position607Ah, Target Velocity60FFh, Target Torque6071h, Modes of Operation6060h. - SM3 (Inputs), using PDO
0x1A00(1st TxPDO): Status Word6041h, actual position6064h, actual velocity606Ch, actual torque6077h, mode of operation display6061h.

To read one more object, for example the drive's digital inputs (60FDh), select the PDO to edit, click Add, pick the object from the list and click Add again. The total size of the objects must not exceed the size of the matching Sync Manager (SM).

2.3. IO Mapping: which PLC registers hold the data
The IO Mapping tab shows which register each PDO object is mapped to. For the drive at StationID 0 in this example:
| Object | Name | Register |
|---|---|---|
| 6040h | Control Word | HD10000 |
| 607Ah | Target Position | HD10002 |
| 60FFh | Target Velocity | HD10004 |
| 6071h | Target Torque | HD10006 |
| 6060h | Modes of Operation | HD10008 |
| 6041h | Status Word | HD10010 |
| 6064h | Actual position | HD10012 |
| 606Ch | Actual velocity | HD10014 |
| 6077h | Actual torque | HD10016 |
| 6061h | Mode of operation display | HD10018 |
| 60FDh | Drive digital inputs | HD10060 |

When you use Xinje's motion instructions (section 4), the PLC handles the Control Word and Status Word for you. During commissioning and troubleshooting, though, reading these registers directly is very useful. The bits follow CiA 402:
- Control Word (6040h): bit 0 switch on, bit 1 enable voltage, bit 2 quick stop, bit 3 enable operation, bit 7 fault reset, bit 8 halt.
- Status Word (6041h): bit 0 ready to switch on, bit 1 switched on, bit 2 operation enabled, bit 3 fault, bit 4 voltage enabled, bit 5 quick stop, bit 6 switch on disabled, bit 7 warning, bit 10 target reached.
- Digital inputs (60FDh): bit 0 negative limit switch, bit 1 positive limit switch, bit 2 home sensor.
2.4. Setting servo parameters through CoE-Online
The COE-Online tab reads and writes the drive parameters over the EtherCAT line (the P0-xx, P5-xx… parameters start at object 2000h), with no need for the drive keypad or a separate cable.

The parameters I always check when bringing an axis into service:
| Parameter | Meaning | Notes |
|---|---|---|
| P0-05 | Motor direction | 0: forward, 1: reverse |
| P0-28 | Stop method at a limit switch | 0, 2: decelerate to stop; 1: coast to stop; 3: stop with an alarm |
| P0-79 | Absolute encoder use | 0: absolute encoder with battery; 1 (default): used as an incremental encoder; 2: absolute, ignoring multi-turn overflow |
| P5-22 | Positive limit switch input | Default 1, i.e. pin SI1 |
| P5-23 | Negative limit switch input | Default 2, i.e. pin SI2 |
| P5-27 | Home sensor input | Default 3, i.e. pin SI3 |
| P5-47 | /ALM alarm output | |
| P5-68 | Emergency stop (EMG) input |
How to set the pin assignment parameters (P5-xx): the last digit is the SI pin number, the digit before it selects a normally open or normally closed contact. For example 0x0001 is pin SI1 normally open, and 0x0011 (17 decimal) is pin SI1 normally closed. Limit switches are best wired normally closed, so a broken wire also stops the axis.
3. Axis configuration
Open Motion control → Axis configuration and enter the number of axes (3 in this example). The software creates the axes BMC_Axis000(0), BMC_Axis001(1) and BMC_Axis002(2). The number in brackets is the axis number used in the instructions, and it is the FuncMappingNum in the EthercatConfig window.
For each axis, on the Basic configuration tab:
- Shaft type: Real axis, Command channel: EtherCAT.
- From the station no.: the StationID of the drive that runs this axis.
- Leave Automatic mapping on, so the software links the Control Word, Target Position, Status Word… to the PDO set up in section 2.

Units (Unit conversion). Choose mechanical units (mm or degrees) so the program is easy to read. For example, with a 20 mm lead ball screw and a 131072 pulses/rev encoder: choose mm, Number of pulses per turn = 131072, The amount of movement per turn = 20. With a gearbox, turn on Enable reducer and enter the ratio on both sides. From then on every position and speed in the instructions is in mm and mm/s.

Homing (HOME). The example below homes on the negative limit switch plus the encoder's Z pulse: the axis moves in the negative direction at 15 mm/s (acceleration 500 mm/s²), reverses when it hits the negative limit switch, then stops on the first Z pulse at an approach speed of 5 mm/s. Using the Z pulse gives much better repeatability than a sensor alone.

4. Programming: motion instructions and status registers
Enabling the servo: A_PWR
A_PWR D0 M1 K0
D0(S0): the instruction's status register.M1(S1): status bit.K0(S2): axis number (the number in brackets in Axis configuration).
When the input condition is ON, the axis is enabled and becomes ready. Keep the condition ON while the machine runs; turning it OFF disables the servo. Use only one A_PWR per axis: calling it twice causes a duplicate coil.
Moving to a position: A_MOVER (relative) and A_MOVEA (absolute)
A_MOVER D0 D50 M1 K0
D0(S0): the input parameter block, each value a 64-bit float (FP64, 4 registers): positionD0, velocityD4, accelerationD8, decelerationD12, jerkD16;D22is the buffer mode.D50(S1): the instruction's status register.M1(S2): status bits (M1 to M5); M1 turns on when the move is done.K0(S3): axis number.
The instruction starts when the condition goes from OFF to ON (rising edge). A_MOVER moves a distance from the current position, and the sign of the position sets the direction. A_MOVEA is declared the same way, but the position is an absolute coordinate from home. With buffer mode = 1, a new instruction is queued and starts as soon as the current one finishes, so a sequence of moves runs smoothly.
Other common instructions: A_RST (reset axis errors), A_STOP (stop), A_HOME (homing with the drive's HM mode), A_ZRN (homing controlled by the PLC), A_VELMOVE (velocity move). The full syntax is in Xinje's XDH/XLH Motion Control Manual.
Axis status registers
Each axis has its own block of status coils and registers (N is the axis number, default start address 20000):
| Address | Meaning |
|---|---|
| M20000 + 50·N | Axis enabled |
| M20001 + 50·N | Axis in error |
| M20002 + 50·N | Axis moving |
| M20003 + 50·N | In position |
| M20004 + 50·N | At home |
| M20008 + 50·N | Motion instruction done |
| D20000 + 200·N | Axis state: 0 disabled, 1 enabled and standing still, 2 moving, 5 homing, 7 error… |
| D20001 + 200·N | Error code |
| D20044 + 200·N | Actual position (FP64, in the chosen unit) |
| D20048 + 200·N | Actual velocity (FP64) |
For example, axis 0's actual position is in D20044 and its actual velocity in D20048. Both can go straight to the HMI.
5. Tip: one register block per axis
Every motion instruction takes a parameter block, a status register and a few bits, so on a multi-axis machine addresses clash easily. I build an address table in Excel before writing the program:
- Each axis gets its own address block: axis 1 uses D1000–D1999 and M1000–M1999, axis 2 uses D2000–D2999 and M2000–M2999, and so on.
- Inside each block, every instruction (A_PWR, A_RST, A_STOP, A_ZRN, A_MOVEA, A_MOVER, A_VELMOVE…) has a row with 4 columns: the command bit from the HMI, the input parameter block, the status register and the status bits.
- All axes use the same numbering inside their block, so copying axis 1's program to axis 2 only means adding 1000 to the addresses.
The table also becomes part of the handover documents: a maintenance engineer can see at a glance which HMI button calls which instruction on which axis.
Conclusion
The key points when moving to EtherCAT with Xinje: wire IN/OUT in the right order, check the PDO and IO Mapping, set the limit switch and home inputs through CoE-Online, and set mechanical units before writing the program. Do these steps right and the program itself comes down to A_PWR, homing, then A_MOVEA / A_MOVER.
In real projects I have run servos both ways: the Automated PCB Return Conveyor uses a Delta ASD-B3 servo driven by pulse signals from a Siemens S7-1200 PLC, while the Automated Pallet Conveyor Line uses a Delta AS228T PLC driving 8 servos over CANopen. More are on the Projects page.
Need a machine with a Xinje PLC or EtherCAT servos programmed or commissioned, or want to move an existing machine from pulse control to EtherCAT? See my PLC programming and motion control services or contact me.