weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Data Fields
modTelegr_t Struct Reference

Data Fields

ucnt16_t byToFol
 Bytes in the telegram to followProtocol identifier.
uint8_t fCode
 The code of the function to perform.
ucnt16_t pduCont [6]
 The (start of the) PDU content.
ucnt16_t protId
 Protocol identifier.
ucnt16_t transId
 Transaction identifier.
uint8_t unitNumb
 The unit number.

Detailed Description

The (start of a) Modbus TCP/IP telegram.

The first seven bytes are the so called MBAB header.

The next 13 bytes are the (start / part of) the the so called PDU, the first byte of which always is the function code (1..127 / 0x01 0x7F) or error return code (129..255 / 0x81..0xFF).

See also:
formModTelegr

Field Documentation

Transaction identifier.

Set by client — to be responded unchanged.

Protocol identifier.

Must be set 0x0000 by client (= Modbus) — and be so in response.

Remark: This word seems totally redundant in Modbus TCP/IP as the port (lport) identifies the protocol.

Bytes in the telegram to followProtocol identifier.

This is the byte count from and including the unit identifier byte. Is set by the client according to request length as well as by the server according to respose length.

Note 1: This as all 16 bit (word) values with Modbus is in wrong — big endian — byte order.

Note 2: This word is totally redundant in Modbus TCP/IP as it always must be telegram's length - 6.

uint8_t unitNumb

The unit number.

Is set by client and must responded unchanged.

An (user) implementation may decide to handle multiple units or to have an own special unit number and check if this number in the request is its own. In all else cases this value will be ignored.

uint8_t fCode

The code of the function to perform.

Is set by client request and usually copied as modThr_data_t.fcFlag for handler function / thread flag usage.

The value must responded unchanged in error free responses or with bit 7 (0x80) set as error response.

The (start of the) PDU content.

If pairs of those 12 bytes are to be interpreted as 16 bit / word values they are in wronr byte order.


The documentation for this struct was generated from the following file: