Rockwell Automation 1769-SM2 Compact I/O DSI/Modbus Communication Module User Manual

Page 125

Advertising
background image

CompactLogix Example Ladder Programs

7-23

Figure 7.7 Example CompactLogix Modbus RTU Ladder Logic CH3 Subroutine (Continued)

Write Parameter 100 [Jog Frequency] (written 1x per request)

CH3_MSG3_REQ[0] = Slave Address ("15" is the 20-COMM-H address)

CH3_MSG3_REQ[1] = Function Code ("6" is Write Single Register command)

CH3_MSG3_REQ[2] = Starting Address ("1099" = 4x1101)

CH3_MSG3_REQ[3] = Length ("1")

CH3_MSG3_REQ[4] = Pr.100 Write Value

4

Channel 3

Write Pr.100

CH3_WR_Pr100

EN

DN

ER

Type - CIP Generic

Message Control

CH3_MSG3 ...

MSG

Read Parameter 100 [Jog Frequency] (written 1x per request)

CH3_MSG4_REQ[0] = Slave Address ("15" is the 20-COMM-H address)

CH3_MSG4_REQ[1] = Function Code ("3" is Read Holding Register command)

CH3_MSG4_REQ[2] = Starting Address ("1099" = 4x1101)

CH3_MSG4_REQ[3] = Length ("1")

The response data is stored in:

CH3_MSG4_RESP[0] = Pr.100 Read Value

5

Channel 3

Read Pr.100

CH3_RD_Pr100

EN

DN

ER

Type - CIP Generic

Message Control

CH3_MSG4 ...

MSG

6

Return

RET

(End)

Advertising