While the enable
input remains True, the function starts listening to the interface (configured under Interface setting).
Upon receiving commands in the Modbus RTU protocol, the device verifies them against the Function, Sensor Network Number, Data Address settings.
If the data in the command is valid, the function generates a response according to the protocol, hen transmits the received values to the valueX
outputs.
If the received data is correct and addressed to the intended recipient (configured under Network Address setting), but the other parameters are incorrect, the device will generate a response with an error code according to the communication protocol.
The function utilizes RXD and TXD buffers during operation.
For the function to operate, the device configuration must have the corresponding interface set up:
Confirguration > RS-232/RS-485 > Device X > Сomplex Events (Asynchronous Mode).
Function menu | Block diagram |
---|---|
![]() |
![]() |
Name | Type | Description |
---|---|---|
enable |
bool | If True, the function is ready to receive commands |
Name | Type | Description |
---|---|---|
state |
int32 | Status: 0 – not active; 1 – awaiting command; 2 – reading command; 3 – reading completed; 4 – sending response; -1 – interface unavailable (not configured)*. |
value0 |
float, int32, bool | Written value 0 |
value1 |
float, int32, bool | Written value 1 |
... | ... | ... |
valueX |
float, int32, bool | Written value X. The number of outputs is controlled by the Number of outputs setting. |
Function logic depends on the data type:
If a variable with type Float is connected to the
value
output and the Type setting = int32/float, then the function reads data from a buffer according to the IEEE754 standard . This method must be used for values that are stored in the Float format (for example, the value 12.6).Otherwise the function reads the data as Int32.
Conversion is performed automatically using the hidden functions FROM_FLOAT and TO_FLOAT.
Name | Description |
---|---|
Number of Intputs | Setting controls the number of intputs valueX |
Interface | Digital interface controlled by the function. If the selected interface is not configured, the function will generate the error state = -1 . |
Function | Modbus function used to write data: Registers - functions 6 ( AO ) and 16 (AO );Discretes - functions 5 ( DO ) and 15 (DO ).For more detailed information about functions, you can read the ModBus RTU article. |
Network Number (dec) | Network number of the emulated sensor. In decimal format. |
Data Address | Address of the first value valueX |
Type | Type and size of the value for reading and outputting on each valueX output:uint8 – unsigned one-byte number; int8 – signed one-byte number; uint16 – unsigned two-byte number; int16 – signed two-byte number; int32/float – signed four-byte number / floating point number. |
Byte Order | Byte order used when copying data from the RXD buffer to the valueX outputs. For example, RXD = [01,02,03,04] , Type = int32.Little-endian: value = 0х04030201 value = 0х01020304 value = 0х02010403 |