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

Data Fields

struct modConfData_t config
 The system's Modbus configuration (copy of as of time of request)
uint8_t dataModel
 Data model for in and / or out data.
uint8_t errorCode
 Error code.
uint8_t fcFlag
 The outstanding function to perform.
uint16_t gotLen
 The complete length of the incoming Modbus request (telegram)
uint8_t * inData
 Incoming data (pointer to)
uint8_t inDataByteCnt
 The length of the request's incoming data as byte count.
ucnt16_t inDatTarg
 The (logic) start or target address for the request's incoming data.
uint8_t * outData
 Outgoing data (pointer to)
uint8_t outDataByteCnt
 The length of the responses outgoing data as byte count.
ucnt16_t outDatSou
 The (logic) start or source address for the response's outgoing data.
uint8_t pollCnt
 Poll count.
pt_t pt
 The (raw) protothread data structure for the user modThr_data_t thread.
struct modTelegr_t reqModTelegr
 A copy of (the start of the) incoming request.
uint8_t retC
 The return code of the last schedule.
ucnt32_t wrkV
 Working variables for the Modbus handling threads.

Detailed Description

The organisational data for a Modbus handler thread.

The similarity of structure of modThr_data_t data and those for cliThr_data_t CLI is not by chance.

Examples:
main.c.

Field Documentation

uint8_t fcFlag

The outstanding function to perform.

It is an accepted function code (FC) or 0. 0 is used as no code or nothing to do. That appointment is consistent with thr_data_t .flag usage.

uint8_t retC

The return code of the last schedule.

This is intended to hold the return code, that is the Modbus handler function's last return value.

The system's Modbus configuration (copy of as of time of request)

uint8_t pollCnt

Poll count.

Value 0 means first stint for handler function / tread; i.e. new data. Value 1 means second stint or first connection poll, and so on.

uint8_t dataModel

Data model for in and / or out data.

The values provided are Discrete inputs, Coil, Coils, Input registers, Mask single Holding and Holding registers. It will be set according to function code before the user / application Modbus handler is called.

Examples:
main.c.
uint8_t errorCode

Error code.

To be set (!=0) by the handler if the requested function cannot be performed.

Examples:
main.c.

The (logic) start or target address for the request's incoming data.

This value will be provided in correct byte order.

Examples:
main.c.
uint8_t* inData

Incoming data (pointer to)

This pointer is only valid if .inDatlen is not 0 and only in the first stint of a handling protothread function. For the type and interpretation of the data see primarily the function code.

Examples:
main.c.
uint8_t outDataByteCnt

The length of the responses outgoing data as byte count.

This field is set to expected value. It may be shortened by the handler thread / function if that decides to deliver less data that requested.

Examples:
main.c.

The (logic) start or source address for the response's outgoing data.

This value will be provided in correct byte order.

Examples:
main.c.
uint8_t* outData

Outgoing data (pointer to)

This pointer is only valid if .outDataBytCnt is not 0 and only in the last stint of a handling protothread function.

Examples:
main.c.

Working variables for the Modbus handling threads.

This must be set according to the bytes copied to .outData (in the last stint) if any.


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