Bit Number Status Bit Number Status
0 0 8 1
1 1 9 0
2 0 10 1
3 1 11 0
4 0 12 1
5 1 13 0
6 0 14 1
7 1 15 0
Example #2
DMC-4040 connected as a Modbus master to a 3rd party PLC. The DMC-4040 will read the value of analog inputs 3
and 4 on the PLC located at addresses 40006 and 40008 respectively. The PLC stores values as 32-bit floating point
numbers which is common.
1. Begin by opening a connection to the PLC which has an IP address of 192.168.1.10 in our example
IHB=192,168,1,10<502>2
2. Dimension an array to store the results
DM myanalog[4]
3. Send the appropriate MB command. Use function code 4 (as specified per the PLC). Start at address
40006. Retrieve 4 modbus registers (2 modbus registers per 1 analog input, as specified by the PLC)
MBB=,4,40006,4,myanalog[]
Results:
Array elements 0 and 1 will make up the 32 bit floating point value for analog input 3 on the PLC and array
elements 2 and 3 will combine for the value of analog input 4.
myanalog[0]=16412=0x401C
myanalog[1]=52429=0xCCCD
myanalog[2]=49347=0xC0C3
myanalog[3]=13107=0x3333
Analog input 3 = 0x401CCCCD = 2.45V
Analog input 4 = 0xC0C33333 = -6.1V
Example #3
DMC-4040 connected as a Modbus master to a hydraulic pump. The DMC-4040 will set the pump pressure by
writing to an analog output on the pump located at Modbus address 30000 and consisting of 2 Modbus registers
forming a 32 bit floating point value.
1. Begin by opening a connection to the pump which has an IP address of 192.168.1.100 in our example
IHB=192,168,1,100<502>2
2. Dimension and fill an array with values that will be written to the PLC
DM pump[2]
pump[0]=16531=0x4093
pump[1]=13107=0x3333
Chapter 4 Software Tools and Communication ▫ 57 DMC-40x0 User Manual