Video Tutorial: Getting Started with the RTEX Bus for Motion Controllers
Getting Started with the RTEX Bus for Motion Controllers
01 Preparations
I. Material Preparation
1. Hardware
One A.ZMC460N controller with an RTEX bus interface.
B. One set of Panasonic RTE servo drive and motor.
C. One computer.
D. Several shielded network cables.
One E.24V DC power supply.
F. Several terminal blocks and connecting wires.
2. Software
A.ZDevelop V3.10 is a controller programming software.
Download the compressed package from the official website www.zmotion.com.cn, extract it, and run the application directly; no installation is required.
B. Panasonic servo drive host computer debugging software.
Download and install it from the Panasonic website.
II. Hardware Wiring
1. Controller wiring
See the diagram below for the purpose of the controller interface.
A. Main power supply: Connect the E+24V terminal on the controller's main power supply terminal to the positive terminal of the 24V DC power supply, and connect the EGND terminal to the negative terminal of the 24V DC power supply.
B. Ethernet Port Wiring: Connect the controller's Ethernet port to the computer's Ethernet port using a network cable.
C. Wiring of RTEX Servo Driver and Controller: The RTEX bus is used to connect to the Panasonic RTEX servo driver. See the configuration diagram below for the wiring method of RTEX.
The RTEX bus requires two wires: TX for transmitting and RX for receiving. TX needs to be connected to RX, and RX needs to be connected to TX. All devices must be connected in a loop, and no disconnection is allowed.
Use one network cable to connect the RX port of the controller's RTE bus to the TX port of the servo drive, and use another network cable to connect the TX port of the controller's RTE bus to the RX port of the servo drive.
Configuration diagram
When connecting multiple RTE drives, the controller's TX port is connected to the RX port of the first servo drive, the TX port of the first servo drive is then connected to the RX port of the second drive, and so on, with the TX port of the last drive connected to the controller's RX port, forming a complete communication loop.
Device and driver numbers are automatically numbered starting from 0 according to the connection sequence, following the same numbering rules as the EtherCAT bus.
2. Driver wiring
Refer to the driver manual for wiring instructions for the servo driver, motor, and encoder. Connect the driver to the power supply.
02 Software Connection Method
I. Communication between the controller and the computer's network port
The controller can be connected to the computer via a serial port or a network port. The following explanation uses a network port connection as an example.
First, connect the controller to the computer using a network cable, turn on the controller's power, then open the ZDevelop programming software, click "Controller" → "Connect" in the menu bar, and open the "Connect to Controller" window.
The "Connect to Controller" window allows you to quickly view your local IP address and compare whether the controller and your computer are on the same network segment.
When selecting from the IP address list dropdown, it will automatically find the available controller IP address on the current local area network (the controller's IP address can be found when the POWER and RUN lights are on after the controller is powered on).
When there are multiple controllers on the same network, if the IP drop-down list does not display the IP address of the target controller, you can perform an IP scan to view all available controller IP addresses. After the scan is complete, confirm and close this window, then select again from the IP drop-down list.
After selecting the correct IP address and clicking connect, the programming software and controller are successfully connected, and the online command and output window will print information prompts.
The controller's default IP address is 192.168.0.11. The "Connect to Controller" window displays the local IP address. Please ensure that the wired and wireless network cards are configured with their respective IP addresses. The computer's IP address must be on the same network segment as the controller's IP address for it to connect; that is, the first three segments of the four-segment IP address must be the same, and the last segment must be different for communication to occur.
If the controller and the computer are not on the same network segment, you need to change the IP address of either the controller or the computer to make them on the same network segment.
To change the controller's IP address, you first need to connect to the controller via serial port, obtain the controller's IP address, and then modify either the local IP address or the controller's IP address to ensure they are on the same network segment.
II. Driver Software and Driver Communication
To modify driver parameters, first connect the driver. You can choose to connect the driver via USB cable or WLAN. Here, we use a USB cable to connect the computer to the X1 port on the driver. Power on the driver and open the Panasonic driver software PANATERM. A "Select to communicate with the driver" window will pop up. After selecting to connect to the driver via USB, the driver information will be automatically obtained and displayed in the window. Click OK to connect successfully and you can communicate with the driver, read the driver's parameter settings, and change the driver parameters.
03 RTEX Bus Driver
Parameter settings
I. Driver Parameter Modification
Modifying RTEX driver parameters is similar to EtherCAT. There are two methods: one is to modify them using Panasonic driver software, and the other is to modify them using commands. The DRIVE_READ parameter is read and the DRIVE_WRITE parameter is written. The command modification is performed after the bus is enabled. For the functions and settings of servo parameters, please refer to the Panasonic RTEX driver manual.
Syntax: DRIVE_READ(parameter, location to store data in VR)
Syntax: DRIVE_WRITE(parameter, parameter value)
Parameter syntax: Different types of parameters have different syntax for reading and writing.
Parameter category * 256 + parameter number (Pr7.20 = 7 * 256 + 20)
Parameter = 130, reads the clamp status, BIT0 and BIT1 represent the status of the two channels.
The parameter $10000+(ssid) reads the RTEX drive system information, which is stored as a string in VRSTRING.
Parameter = $20000 + (alarm function code) + ($1000 * index) Read alarm information
Parameter = $30000 + (monitoring function code) + ($1000 * index) Read monitor information
Example of instruction read/write parameters:
BASE(0) 'Selects the driver corresponding to axis 0'
DRIVE_WRITE(7*256+11,6) 'Writes Pr7.11 parameter as 6
DRIVE_WRITE(0*256+0,1) 'Writes Pr0.00 parameter to 1
DRIVE_READ(0*256+0) 'Reads the value of parameter Pr0.00
DRIVE_READ(0*256+0) AXIS(1) 'Read the value of the Pr0.00 parameter. AXIS specifies the axis number. If not specified, read axis 0.
DRIVE_READ($10000+$01) 'Reads the manufacturer name; if no storage location is specified, it is printed directly.'
Example of driver parameter modification:
The rotation direction of the motor can be adjusted using parameter Pr0.00, which allows you to select either CW or CCW as the positive direction. The image below shows CCW selected as the positive direction; when a positive direction motion command is sent, the motor shaft rotates counter-clockwise.
After the parameters are modified, press the EEP button on the motor to write the modified parameters into the driver's EEPROM, and then power on the driver again to make the parameters take effect.
Definition of motor rotation direction: When viewed from the shaft end on the load side, clockwise is CW, and counterclockwise is CCW.
PR0.00 parameter direction setting reference:
II. Electronic Gear Ratio
The electronic gear ratio of a servo motor is the ratio at which the servo amplifies or reduces the frequency of the pulses received from the controller. A ratio greater than 1 indicates amplification, a ratio less than 1 indicates reduction, and a ratio equal to 1 indicates that the number of pulses received by the motor is equal to the number of pulses sent by the controller.
The electronic gear ratio is determined by the ratio of Pr0.09 to Pr0.10, where electronic gear ratio = Pr0.09/Pr0.10.
Calculation formula: Actual number of pulses received by the motor = Number of pulses sent by the controller * Electronic gear ratio
For example: if the controller sends 10,000 pulses, the numerator of the electronic gear ratio is set to 1, the denominator is set to 2, and the electronic gear ratio is 0.5, then the servo will actually run based on 5,000 pulses. If the controller sends 10,000 pulses, the numerator of the electronic gear ratio is set to 2, the denominator is set to 1, and the electronic gear ratio is 2, then the servo will actually run based on 20,000 pulses.
The electronic gear ratio of the Panasonic RTEX driver is valid within the range of 1/1000 to 8000. If it exceeds this range, the driver will report an error.
The number of command pulses required for the motor to rotate one revolution is set via Pr0.08. As shown in the figure above, it is set to 10000, which means that sending 10000 pulses will make the motor rotate one revolution.
III. Communication Cycle
For successful communication, the controller's cycle must match the driver's cycle. The default controller cycle is 1ms, which can be modified by upgrading the firmware.
The communication cycle of the Rtex bus driver is currently available in two types: 0.5ms and 1ms, which can be selected by setting driver parameters P7.20 and P7.21.
Note that parameter P7.21 must be set to 1, otherwise communication will fail.
The driver cycle can be modified via commands or by directly modifying the parameters mentioned above through the driver software.
Example of a command read/write driver communication cycle:
'Read the communication cycle, and store the read data in the VR.'
DRIVE_READ(7*256+20,0) 'Pr7.20=7*256+20, Rtex communication cycle: 3-0.5ms, 6-1ms
DRIVE_READ(7*256+21,1) 'Pr7.21=7*256+21, Rtex instruction update cycle ratio: 1
Modify the communication cycle, write the changes to EEPROM, and restart for the changes to take effect.
DRIVE_WRITE(7*256+20,SERVO_PERIOD/1000*6) 'Pr7.20=7*256+20, Rtex communication cycle: 3-0.5ms, 6-1ms
DRIVE_WRITE(7*256+21,1) 'Pr7.21=7*256+21, Rtex instruction update cycle ratio: 1
DRIVE_WRITE(128,1) 'Write to EEPROM; power off is required after modification.
Example of modifying the communication cycle in driver software:
Connect the driver software, and in the parameters window, find parameter category 7. Modify Pr7.20 and Pr7.21 to change the driver cycle.
IV. Driver I/O Mapping
To map driver I/O, you first need to set DRIVE_PROFILE=1 to indicate driver I/O mapping (DRIVE_PROFILE=0 indicates no driver I/O mapping). Then, use the DRIVE_IO instruction to set the driver I/O address. The mapping number range should not be the same as the I/O number of other devices on the bus.
Once mapping is complete, the controller can operate the driver I/O levels using the mapped driver I/O number. Without mapping, the controller cannot operate the driver I/O.
DRIVE_IO (axis number) = starting number of input/output IO.
Example:
DRIVE_PROFILE(iAxis) = 1 'With driver I/O mapping
DRIVE_IO(iAxis) = i_IoNum 'Sets the starting number of the driver's input/output I/O
To configure the driver's I/O operations, open parameter window and select parameter category 4 to set the output parameters.
V. Driver Axis Mapping
The device numbers of devices connected to the RTEX bus are automatically numbered starting from 0 according to the connection order. The driver numbers are also automatically assigned to the driver devices starting from 0 according to the connection order. Only the driver devices on the bus are counted; other devices do not have driver numbers.
The drivers connected to the RTEX bus need to be mapped using instructions. The AXIS_ADDRESS instruction is used for mapping. Only after mapping is complete can the BASE instruction be used to select the driver axis number, send pulses, and control the motor connected to the driver to run.
The axis mapping is written in the bus initialization program, after the bus scan and before the bus is enabled.
Syntax: AXIS_ADDRESS(axis number) = (slot number << 16) + driver number + 1
The default bus slot number for a single-bus controller is 0, meaning it only supports the RTEX bus, and the RTEX slave slot number is 0. When using the ZMC460N, which is a dual-bus controller, the EtherCAT bus slot number is 0, and the RTEX slot number is 1. The axis number is the target axis number mapped to the driver. During mapping, the axis number for each driver must be unique, pointing to an available axis number.
Example:
For single-bus RTEX slots, fill in 0; for dual-bus RTEX slots, fill in 1.
AXIS_ADDRESS (6) = (1 << 16) + 0 + 1 'First RTEX driver, driver number 0, bound to axis 6
AXIS_ADDRESS (7) = (1 << 16) + 1 + 1 'Second RTEX driver, driver number 1, bound to axis 7
AXIS_ADDRESS (8) = (1 << 16) + 2 + 1 'The third RTEX driver, driver number 2, bound to axis 8
ATYPE(6)=50 'Set as RTEX axis type, 50-position, 51-speed, 52-torque
ATYPE(7)=50
ATYPE(8)=50
VI. Driver Control Mode
There are three control modes for the RTEX bus, set using the ATYPE command: ATYPE=50 position mode, ATYPE=51 speed mode, and ATYPE=52 torque mode.
The position mode uses motion commands to control the axis movement, while the speed and torque modes use DAC commands to control the axis movement. When switching to other modes in speed and torque modes, first set the DAC to 0, and then modify the value of ATYPE to prevent accidents.
The control mode is set by parameter Pr0.01. Select 0 for semi-closed-loop control. At this time, the ATYPE command can be used to switch the controller's control mode, such as position, speed and torque modes.
1. ATYPE=50 Position Mode
Set the axis parameters and use motion controller commands to control the motor operation.
2. ATYPE=51 Speed Mode
In speed mode, the motor's running speed is set using DAC commands and it runs continuously. Motion commands cannot be used in this mode, so there is no need to set axis parameters. Set DAC=0 to stop operation.
To prevent accidents when switching modes in speed mode, first set the DAC to 0 and then use the ATYPE instruction to switch.
In RTEX speed mode, the speed unit is set by parameter Pr7.25. A value of 0 corresponds to the unit: r/min, and a value of 1 corresponds to the unit: command unit/s.
In speed mode, DRIVE_READ reads the unit of speed. As shown in the image, a value of 0 indicates the unit is r/min. DRIVE_READ prints the speed directly when no storage address is specified.
3. ATYPE=52 Torque Mode
Before switching ATYPE to torque mode, please set the first position of the driver parameter Pr6.47 to 0 to disable the 2-DOF control mode.
Next, set the speed limit using parameter Pr3.17, as shown in the figure below (refer to the Panasonic Rtex manual). When the setting value of Pr3.17 (speed limit selection) is 0, the speed limit is set via Pr3.21. When the setting value is 1, the speed limit value for torque control can be switched via SL_SW.
DRIVE_WRITE command settings reference: Set sequentially by axis number.
DRIVE_WRITE(6*256+47,0) AXIS(0) 'Set Pr6.47 to 0 to disable 2-DOF control mode'
DRIVE_WRITE(3*256+17,0) AXIS(0) 'Set the speed limit to 0 in Pr3.17, and set the speed limit in Pr3.21.'
DRIVE_WRITE(3*256+21,5000) AXIS(0) 'Pr3.21 speed limit set to 5000'
The DRIVE_READ command reads driver settings:
Once all axes involved in motion have been set according to the above parameters, you can switch to torque mode and use DAC commands to send torque control to keep the motor running. Motion commands cannot be used in this mode, so there is no need to set axis parameters. Simply set DAC=0 to stop operation.
To prevent accidents when switching modes in torque mode, first set the DAC to 0 and then use the ATYPE instruction to switch.
7. Drive return to zero
The RTEX bus can use the zero-return mode DATUM(mode) provided by the controller. The mode value can be found in the DATUM command section of the ZBasic programming manual. The RTEX bus can also use the driver's own zero-return mode.
The driver itself returns to zero using the DATUM(21,mode2) instruction. The mode2 value can be found in the driver manual. Enter the corresponding driver's zero-return mode value in mode2. See the table below for the zero-return modes provided by Panasonic drivers. Note that at this time, the origin limit and other signals must be connected to the driver, and the I/O ports corresponding to these special signals must be set using the instruction. Therefore, when using the driver to return to zero, the driver's I/O needs to be mapped.
Syntax: DATUM(21,$11) 'Starts zeroing according to the current zeroing mode of the drive's zeroing mechanism.
RTEX bus driver return-to-zero mode
8. Driver alarm
Check the LED panel on the driver for error messages. Errors will be displayed with error codes. Troubleshoot the error according to the driver manual and clear the alarm after correction.
If the controller is connected to ZDevelop software, the AXISSTATUS axis status will display an error message when the driver reports an error.
You can also open the alarm window of the driver software to see if there are any alarms on the current drive, or to query historical alarms.
04 RTEX Bus
Initialization program
I. Initialization Program
Motors connected to the RTEX bus require an RTEX bus initialization program to be written for enabling. Once enabled, their application is the same as that of pulse motors, and the motion commands are identical.
The general process of initialization:
1. Use SLOT_SCAN to scan the device and check if RETURN is correct. An error will be reported if the device is not connected.
2. Determine the device type and information using NODE_INFO/NODE_AXIS_COUNT, etc.
3. Set AIXS_ADDRESS, ATYPE, DRIVE_PROFILE, DRIVE_IO, etc. in sequence.
4. SLOT_START starts the device.
5. Once the connection is established, the master station and the slave station can exchange data periodically.
The RTEX initialization procedure is similar to the EtherCAT bus initialization procedure. A sample initialization procedure is provided below:
'***************************RTEX Bus Initialization'
global CONST MAX_AXISNUM = 60 'Maximum number of axes'
global CONST Bus_Slot = 1 'Slot number 0 (default 0 for single-bus controllers)
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 = 0 'Starting axis number of the bus axis'
global CONST Bus_NodeNum = 2 'Number of bus configuration nodes, used to determine whether the actual number of detected slave stations is consistent.
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 until the driver powers on; adjust the delay according to the specific driver.'
"Bus communication cycle:",SERVO_PERIOD,"us"
Rtex_Init() 'Initialize the RTE bus
while (Bus_InitStatus = 0) 'Reinitialize
Rtex_Init()
wend
end
'*******************************RTEX Bus Initialization********************************
Initial process: slot_scan (scan bus) -> slave node maps axes/IO -> SLOT_START (start bus) -> initialization successful
'*******************************************************************************
global sub Rtex_Init()
local Node_Num, Temp_Axis
RAPIDSTOP(2)
for i=0 to MAX_AXISNUM - 1 'Initialize and restore axis type
AXIS_ENABLE(i) = 0
atype(i)=0
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
SLOT_STOP(Bus_Slot)
delay(200)
SLOT_SCAN(Bus_Slot) 'Scan the bus'
if return then
"Bus scan successful", "Number of connected slave devices:" NODE_COUNT(Bus_Slot)
If NODE_COUNT(Bus_Slot) <> Bus_NodeNum then 'Check if the number of bus detections matches the actual number of connections.'
""
"The number of scanned nodes does not match the configured number!" "Configured number: "Bus_NodeNum", "Number of detected nodes: "NODE_COUNT(Bus_Slot)
Bus_InitStatus = 0 'Initialization failed. Alarm message'
return
endif
"Start mapping axis numbers"
for Node_Num=0 to NODE_COUNT(Bus_Slot)-1 'Traverse all scanned slave nodes
if NODE_AXIS_COUNT(Bus_Slot, Node_Num) <> 0 then 'Check if the current node has a motor.'
for j=0 to NODE_AXIS_COUNT(Bus_Slot,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
'Temp_Axis = Dirve_Alias' The axis number is assigned according to the DIP switch settings of the driver (special handling is required for one-to-many drives).
'Sub_SetNodePara(Node_Num,Temp_Axis)
If return = FALSE then
Bus_InitStatus = 0 'Communication cycle mismatch'
return
endif
base(Temp_Axis)
AXIS_ADDRESS=(1<<16)+Bus_TotalAxisnum+1 'Mapped axis number
ATYPE=50 'Set control mode 50 - position 51 - speed 52 - torque
disable_group(Temp_Axis) 'Group each axis separately
Bus_TotalAxisnum = Bus_TotalAxisnum + 1 'Total number of axes + 1
next
endif
next
"Axis number mapping complete", "Total number of axes connected: "Bus_TotalAxisnum
DELAY 200
SLOT_START(Bus_Slot) '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
datum(0) 'Clear controller axis status error'
DELAY 50
"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
'********************************* Slave Node Special Parameter Configuration********************************
Modify slave parameters via DRIVE_READ/DRIVE_WRITE (refer to the driver manual for specific parameters).
'**************************************************************************************
global sub Sub_SetNodePara(iNode,Iaxis)
base(Iaxis)
vr(0) = 0
vr(1) = 0
DRIVE_READ(7*256+20,0) '(Pr7.20=7*256+20) Rtex communication cycle 3-0.5ms 6-1ms
DRIVE_READ(7*256+21,1) '(Pr7.21=7*256+21) Rtex instruction update cycle ratio 1
if (vr(0)/6 *1000 <> SERVO_PERIOD) or (vr(1) <> 1) then 'Check if the driver cycle and controller cycle match.'
"Bus cycle mismatch:","Control cycle-",SERVO_PERIOD,"Axis number-",Iaxis,"Servo cycle-",(vr(0)/6 *1000*vr(1))
'DRIVE_WRITE(7*256+20,SERVO_PERIOD/1000*6)' (Pr7.20=7*256+20) Rtex communication cycle 3-0.5ms 6-1ms
'DRIVE_WRITE(7*256+21,1)' (Pr7.21=7*256+21) Rtex instruction update cycle ratio 1
'DRIVE_WRITE(128,1)' writes to the EEPROM; power must be turned off after modification.
return FALSE
endif
return TRUE
end sub
II. Bus Status View
The prerequisite for viewing the bus status is that the initialization operation was successful and the controller and driver are correctly wired; otherwise, the following information cannot be viewed.
1. In the menu bar, check “Slot 1 Node” in the “Controller” → “Controller Status” window. For single-bus controllers, check “Slot 0 Node”.
2. You can also send the command "?*RTEX" online to print all device information on the RTEX bus.
3. In the menu bar, open "Debug" → "Bus Status Diagnosis" to view the device information of all bus slot interfaces of the controller.
For actual performance results, please refer to the demonstration section at the end of the video.
This concludes our introduction to using the RTEX bus for motion controllers. For more learning videos and detailed explanations with pictures, please follow our WeChat official account "Zheng Motion Assistant".
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.