Configuring Modbus from the Command Line

Use this procedure to configure a Digi device for Modbus.

Starting Point

This procedure assumes that you have logged on to the Digi device as root.

Procedure

1.To ensure that the line speed for the port is configured to match the speed required by the attached device, issue the following command:

set line range=range baud=bps csize={5678} parity={oen} stopb={12}

where

range is a port or ports

bps is the line speed required

csize is the character size, 5, 6, 7, or 8 bits

parity is odd (o), even (e), or none (n)

2.Configure the port for Modbus by specify issuing the following command: set ports range=range dev=modbus

where range is a port or ports

3.Configure a Modbus master by issuing a set modbus master command that specifies the follow- ing:

An index number on the range field to identify this master or set of masters. Use an integer between 1 and 16. Example: range=3

If the master or masters are located on the network, an IP address or range of IP addresses Example of single IP address: ip=143.191.3.117

Example of a range of addresses: ip=143.191.3.117-143.191.3.122

If the master or masters are connected to a port or range of ports, a port number or numbers on the port field:

Example of a single port: port=1

Example of range of ports: ports=1-2

The index number of the slave or slaves that this master will control on the slaves field. Example of a single slave: slave=17

Example of a range of slaves: slave=17-22

If this this master is connected to a serial port, an encoding scheme (ASCII or RTU) on the format field. Specify the encoding scheme required by the master.

Example: format=ascii

Timers as required. Typically the defaults work. If you require additional information, see the set modbus command in the Digi One/PortServer TS 2/4 Command Reference.

4.Configure the Modbus slave by issuing a set modbus slave command that specifies the follow- ing:

An index number on the range field to identify this slave. Use a integer between 1 and 32. This number must be included in the range of slave index numbers specified on the slave field of the set modbus master command.

Example: range=15

If this slave is located on the network, an IP address Example: ip=143.191.3.117

If this slave is connected to a port, a port number on the port field: Example: port=1

If this this slave is connected to a serial port, an encoding scheme (ASCII or RTU) on the for- mat field. Specify the encoding scheme required by the slave.

Example: format=ascii

11-4

Configuring Modbus from the Command Line

Page 62
Image 62
Digi TS 4, TS 2/4 manual Configuring Modbus from the Command Line, Starting Point