User's Manual

COBALT UHF-SERIES CHAPTER 7: MODBUS TCP INTERFACE
PAGE 118 OF 140
7.3 MODBUS TCP - HANDSHAKING
Due to the process with which commands and responses are passed between the
Cobalt and the host, a handshaking procedure is used to notify the host that returning
data is available for retrieval.
O
VERALL L ENGTH
The handshaking process is governed by the changing of the “Overall Length” value
within a data packet. The Overall Length value is typically the first word (2-bytes) of a
command or response and indicates the total number of data words in the packet.
N
ODE I NPUT AND N ODE O UTPUT P AGES
Under the Modbus TCP protocol, host-generated data is written to a pre-defined
region of the Cobalt’s own memory known as the Node Input Page. Host-bound data
generated by the Cobalt, is written to a separate region of the Cobalt’s memory
known as the Node Output Page (in Modbus TCP these regions of memory are
called Device IDs). Node Input and Node Output Pages are used to temporarily hold
incoming (controller-bound) and outgoing (host-bound) data.
O
UTPUT D ATA R EADY M ASK
To notify the host that new data is waiting to be retrieved from the Node Output Page,
the Cobalt utilizes a separate 32-bit block of internal memory, called the Output Data
Ready Mask.
The first bit of the 32-bit Output Data Ready Mask represents the status of the Node
Output Page. For example, the first or lowest bit (bit 01) represents Node Output
Page 33 - which holds output data from Node 01.
The Cobalt, itself, is assigned Node 01 and thus, its corresponding Node Output
Page is 33. As noted, Node Output Page 33 is represented by the first bit (bit 01) in
the Output Data Ready Mask.
H
OLDING R EGISTERS
When writing host-bound data to Node Output Page 33, the Cobalt actually places
each byte of the data packet into pre-defined “holding registers” within the Node
Output Page. Note that a single holding register stores 2-bytes or one word of data.
The 2-byte Overall Length value, for example, is written to the first holding register
(which is location 40001) of the Node Output Page.
Then, as the Cobalt finishes writing host-bound data to the Node Output Page, the
Overall Length value (stored at holding register 40001) will change from its default
value of 0x00 to reflect the number of data words within the newly written host-bound
data packet. This change to the Overall Length value (i.e. register 40001) within the
Node Output Page, triggers the Cobalt to enable (change from zero to one) bit one in
the Output Data Ready Mask. It is when bit one in the Output Data Ready Mask has
become enabled, that the host will recognize the pending data.
Finally, after the host has retrieved its pending data, the enabled bit in the Output
Data Ready Mask and the Overall Length value at holding register 40001 of the Node
Output Page will be reset to zero (0x00), indicating that the host has received and
processed its pending data.