14 / 58
Registers access feature
TCP/IP works in big endian: most significant byte first, followed by least
significant byte.
The access to the data is done through an easy (6 byte header) protocol
over TCP.
Structure of each packet:
1.
Function ID (2 bytes),
2.
Transaction ID (2 bytes)
3.
Length of the parameters (2 bytes)
4.
Parameters (X byte)
5.
Checksum (2 bytes) (described later in this chapter)
The user (sender) defines the values of the Transaction IDs himself. The
module that receives a command sends back an answer (for every
command). The answer contains the same Transaction ID as the
corresponding command sent. The user is also able to check execution of
each command.
Read register(s) command:
Byte#
Number of bits
Example
0x00
Read (0x0021)
16 bits
0x0021
0x02 TransactionID
16
bits
0x1B34
0x04
Number of registers to
read (X)
16 bits
0x0001
0x06
X * Registers Addresses
X * 8 bits
0x02
0x06+X Checksum
16
bits
0x…
The maximum number of registers that can be read at one time is almost
30. The answer sequence should not be greater than 180 bytes. If the
number of registers is too big, the FMod-TCP BOX will answer only with the
value of some of them.
The module answers with the following sequence:
Byte#
Number of bits
Example
0x00
Read Answer (0x0023)
16 bits
0x0023
0x02
TransactionID (same as
demand)
16 bits
0x1B34
0x04
Number of bytes in answer
16 bits
0x0019
0x06
Register address
8 bits
0x02
…
Register value
8—128 bits (16B) 0x12345
The two previous entries are replicated for every register that has been asked for reading
… Checksum
16
bits
0x…
FMod-TCP User Manual v.2.8