Modbus utilities: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 71: Line 71:




The primary difference in usage if these utilities depends on the hosting platform.
The primary difference in usage of these utilities depends on the hosting platform.


On SBC products using the XUART communications devices, the -c switch and paramater does not need to be specified, since the default communications port is correct.
On SBC products using the XUART communications devices, the -c switch and paramater does not need to be specified, since the default communications port is correct.


On the TS-7670 with a standard UART communications device, the '-m 7670' switch should be specified.  This allows the proer hardware setting for the RS-485 port to be utilized.
On the TS-7670 with a standard UART communications device, the '-m 7670' switch should be specified.  This allows the proper hardware setting for the RS-485 port to be utilized.


On SBC products with a host USB port for communications, the -c switch should be specified and paramater should be the USB to Serial communication device, which is generally '/dev/ttyACM0'.  The bit rate does not need to be specified, since the USB port will operate at the fastest rate possible (up to approximately 1000000 bps).
On SBC products with a host USB port for communications, the -c switch should be specified and paramater should be the USB to Serial communication device, which is generally '/dev/ttyACM0'.  The bit rate does not need to be specified, since the USB port will operate at the fastest rate possible (up to approximately 1000000 bps).

Revision as of 13:07, 23 May 2014


Modbus register access program: mbpeekpoke

root@ts7670-484128:/home/zpu# ./mbpeekpoke -?

Usage: mbpeekpoke -switch paramater [OPTIOSN] ...
Download and start a ZPU program.  Optionally persist the code
Defalut parameter values in [brackets]
  -?                     This help screen
  -b  bit_rate           Bit rate [9600]
                         300, 600, 1200, 2400, 4800, 9600, 19200
                         38400, 57600, 115200, 1000000, 4000000
  -c  connection         IP:Port IP address:port [127.0.0.1:7350]
                         Serial port [/dev/ttySP2]
  -D                     Device to access: [C]oil, [R]egister, [I]nput, [P]acket
  -d                     Display packet debugging information [Off]
  -f                     Register display output format:
                         'X' hex, 'S' digned decimal 'U' unsigned decimal [Hex]
  -h                     This help screen
  -n  number_of_items    number of items to read [1]
  -m  Board model #      7670 with serial [any other using TCP socket connection]
  -r  address            Read: Device @ specificed address
  -s  slave_address      hexadecimal 00-f8; 00 is broadcast [0xf7]
  -v  data               value to write
  -V                     Verbose mode - display additional debug information
  -w  address            Write: Device @ specificed address
 The (-w) write option requires a single (-v) variable
 The (-r) read option can read a number of items with the (-n) switch
 Both the -w & -r options may be used on the same or different addresses
 however, they must both use the same device (-D) and the write is performed first

This program is used to perform accesses to the Modbus devices register set. It allows the writing of arbitrary hex data to any hex register address one at a time and the reading of blocks of arbitrary data from any hex register addres displayed in hex, signed, or unsigned decimal.


Modbus device configuration program: mb_config

root@ts7670-484128:/home/zpu# ./mb_config -?

Usage: mb_config -switch paramater [OPTIOSN] ...
Configre a Modbus device for legacy mode by setting operational parameters
Defalut parameter values in [brackets]
  -?                     This help screen
  -b  bit_rate           Bit rate [9600]
                         300, 600, 1200, 2400, 4800, 9600, 19200
                         38400, 57600, 115200, 230400, 460800
                         1040000, 2080000, 4160000
  -C  Configuration      Model 1700: 8 character field starting @ DIO bit 7 thru 0
                         Use single letters 'T' Temperature; 'I' Input: 'O' Output
                         All Other model: Not required
  -c  connection IP:Port IP address:port [127.0.0.1:7350]
  -d                     Display packet debugging information [Off]
  -f  format (data)      Data format: 8N1, 8N2, 8E1, 8O1, [8N1]
  -h                     This help screen
  -i                     Display I/O accesses
  -I                     Inhibit actual writing
  -m  Board model #      7670 with serial [any other using TCP socket connection]
  -n                     Noninteractive mode [off]
  -p                     Display progress messages [Off]
  -s  slave_address      hexadecimal 00-f6; 00 is broadcast [0x10]
  -t  termination        Terminstion on / off [off]
  -v                     verboce output mode
  DIO Configration for Model TS-1700

This program is used to perform configuration of a Modbus device. On older modbuc devices these settings (Slave address, Communications bit rate and data format, termination) would have been performed via DIP switches. This configuration information is sroted in non-volitile memory on the device.


The primary difference in usage of these utilities depends on the hosting platform.

On SBC products using the XUART communications devices, the -c switch and paramater does not need to be specified, since the default communications port is correct.

On the TS-7670 with a standard UART communications device, the '-m 7670' switch should be specified. This allows the proper hardware setting for the RS-485 port to be utilized.

On SBC products with a host USB port for communications, the -c switch should be specified and paramater should be the USB to Serial communication device, which is generally '/dev/ttyACM0'. The bit rate does not need to be specified, since the USB port will operate at the fastest rate possible (up to approximately 1000000 bps).