In this application note, we demonstrate how to communicate with a Roboteq drive from a PC using the Modbus Ascii protocol. The software used for sending and receiving Modbus data is Simply Modbus. Since most conventional PCs lack an RS485 port—required by Modbus Ascii—we use an RS485-to-USB converter. Once data exchange with the Roboteq drive is successful, we can confirm that the connections and settings are correct, and the drive can be interfaced with any other Modbus-compatible device.



1. Hardware connections


Connect the RS485 adapter to the PC according to the below diagram:



2. Roborun Configuration

 

Enable the Modbus RS485 Ascii mode



Configure the ID of the slave device

   


3. Modbus Ascii frame



The Modbus Ascii frame has the following structure:




Node ID: The ID of the slave. This is configured on the drive using Roborun+


Function code: To read input Registers use 04. To write multiple holding registers use 10


Register address: Can be found from the commands dictionary. Note that the channel parameter is integrated into the command ID by adding it. So 0021 register will issue a position command for channel 1 while 0022 register will issue a position command the for channel 2


Number of registers: This depends on the length of the shift register, in bytes. In Roboteq the registers used are always 32 bits, so 2 bytes should be configured.


Number of Bytes to write: This is filled only when issuing write requests.


Data to write: The data to write. This is filled only when issuing write requests. 


LRC: This byte is calculated and added by the Modbus software to the Ascii frame


CR and LF: These are the Ascii characters marking the end of the frame.


Note: All values are expressed in HEX. 


4. Simply Modbus Examples



4.1 Read input Registers



Example 1: Read Var 4


 

First, set VAR 4 to a value, for example 4294967295


Then query the VAR 4 value using Simply Modbus: 

4.2 Write multiple Registers



At Simply Modbus, to use write function, you must open the separate write tab.



Example 1: Write Var 1



Example 2: Send Motor Command


Note: Different 'Data Type' and 'Values to write' values have been used in the two examples. Both configurations are valid, as they align with the parameter size of 32 bits.


5. Sending RTU Frames


Modbus RTU Frames can be sent on the same manner. 


On Roborun+ utility, the Modbus RTU option should be selected instead of ASCII. 



The configurable data of the frame are similar to those of the ASCII frame. The key differences are the use of a CRC field instead of LRC, and the absence of termination characters in this mode. The CRC field is automatically calculated and appended to the frame by Simply Modbus.