Rockwell Automation T3837 ICS Regent MODBUS Master Package for WINTERPRET User Manual

Page 7

Advertising
background image

MODBUS Master Package for W

INTERPRET

(T3837)


P D - 6048 August, 96

(Issue 1)

7

·

A check is made to see if this is the start of a MODBUS scan. If so, the

‘MODBUS Scan Time’ timer is reset.

·

Each “Write” variable is check to see if it has changed state (or value),

and those that have are added to the WRITEQ.

·

Outgoing packets are sent.

While !FULL(SENDQ)

If !EMPTY(WRITWQ)

ENQ(SENDQ, DEQ(WRITWQ))

Else If !EMPTY(READQ)

ENQ(SENDQ, DEQ(READQ))

End If

End While

·

Incoming responses are received, and the appropriate actions are
taken.

While !EMPTY(RECVQ)

PROCESS(DEQ(RECVQ))

End While

·

A check is made to see if this is the end of the MODBUS scan. If so,
copy the timer and toggle the toggle.

·

R

ESET

is checked to see if the error signals should be cleared. This

occurs even if the function block is not executed.


The MODBUS function block code keeps track of how many messages
are outstanding by incrementing a counter for each ENQ(SENDQ,
DEQ(READQ)), and decrementing the same counter for each
DEQ(RECVQ) when the response is a “Read” response. A MODBUS
scan is considered complete when the counter is zero (0) and the READQ
is empty (COUNT == 0 && EMPTY(READQ)).

At the beginning of each MODBUS scan, a copy of the system millisecond
timer is made. At the completion of a MODBUS scan, this value is copied
into the T

IME

variable and the T

OGGLE

signal is inverted.


Placing a MODBUS command on the SENDQ involves copying the
MODBUS command to a buffer, generating the appropriate error-check
code, and sending the command to the correct port (primary or secondary).
Internal variables are used to determine the port.

If a secondary port was defined, once each MODBUS scan the initial
MODBUS ‘Read Command’ for each node is sent via the secondary port.
The result of this command is ignored, it is used only to check for a valid
connection. The MODBUS Node table is used to track the status of each
node’s response. Table 5 defines the MODBUS Node Table.

Advertising