bit floating point number (Modbus registers 2xxx). The ability to write to the slaves array table is enabled by setting
the ME command (ME is not needed to read array data). See the DMC-40x0 Command Reference for further
details.
¹ Only DMC-40x0 firmware revisions Rev 1.2d and later support Modbus slave capability via the ME command.
The DMC-40x0 provides three levels of Modbus communication. The first level allows the user to create a raw
packet and receive raw data. It uses the MBh command with a function code of –1. The format of the command is
MBh = -1,len,array[] where len is the number of bytes
array[] is the array with the data
The second level incorporates the Modbus structure. This is necessary for sending configuration and special
commands to an I/O device. The formats vary depending on the function code that is called. For more information
refer to the Command Reference.
The third level of Modbus communication uses standard Galil commands. Once the slave has been configured, the
commands that may be used are @IN[], @AN[], SB, CB, OB, and AO. For example, AO 2020,8.2 would tell I/O
number 2020 to output 8.2 volts.
If a specific slave address is not necessary, the I/O number to be used can be calculated with the following:
I/O Number = (HandleNum*1000) + ((Module-1)*4) + (BitNum-1)
Where HandleNum is the handle number from 1 (A) to 8 (H). Module is the position of the module in the rack from
1 to 16. BitNum is the I/O point in the module from 1 to 4.
Modbus Examples
Example #1
DMC-4040 connected as a Modbus master to a RIO-47120 via Modbus. The DMC-4040 will set or clear all 16 of the
RIO’s digital outputs
1. Begin by opening a connection to the RIO which in our example has IP address 192.168.1.120
IHB=192,168,1,120<502>2 (Issued to DMC-4040)
2. Dimension an array to store the commanded values. Set array element 0 equal to 170 and array element 1
equal to 85. (array element 1 configures digital outputs 15-8 and array element 0 configures digital
outputs 7-0)
DM myarray[2]
myarray[0] = 170 (which is 10101010 in binary)
myarray[1] = 85 (which is 01010101in binary)
3. a) Send the appropriate MB command. Use function code 15. Start at output 0 and set/clear all 16
outputs based on the data in myarray[]
MBB=,15,0,16,myarray[]
3. b) Set the outputs using the SB command.
SB2001;SB2003;SB2005;SB2007;SB2008;SB2010;SB2012;SB2014;
Results:
Both steps 3a and 3b will result in outputs being activated as below. The only difference being that step 3a will set
and clear all 16 bits where as step 3b will only set the specified bits and will have no affect on the others.
Chapter 4 Software Tools and Communication ▫ 56 DMC-40x0 User Manual