Function takes values on the valueX
inputs, and while the enable
input remains True, the function starts listening to the interface (configured under Interface setting).
Upon receiving requests in the Modbus RTU protocol, the device verifies them against the Function, Sensor Network Number, Data Address settings.
If the data in the request is valid, the function generates a response according to the protocol, considering the Type and Byte Order.
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 respond to requests |
value0 |
float, int32, bool | Value for reading 0 |
value1 |
float, int32, bool | Value for reading 1 |
... | ... | ... |
valueX |
float, int32, bool | Value for reading X. The number of inputs is regulated by the setting "Number of Inputs" |
Function logic depends on the data type:
If a variable of type Float is connected to
value
input, and the setting Type is set to int32/float, the function writes the data in the buffer using the IEEE754 standard. This method is necessary for values transmitted in Float format (for example, a value like 12.6).Otherwise the function writes the data as Int32.
The conversion is automatically performed using hidden functions FROM_FLOAT and TO_FLOAT.
Name | Type | Description |
---|---|---|
state |
int32 | Status: 0 – not active; 1 – awaiting request; 2 – reading request; 3 – reading completed; 4 – sending response; -1 – interface unavailable (not configured)*. |
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 through which data can be read: Registers - functions 03 ( AO ) and 04 (AI );Discretes - functions 01 ( DO ) and 02 (DI ).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 that will be taken from the valueX input for the response: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 values from valueX inputs to the TXD buffer. For example, value0 = 0x01020304 , Type = int32/float.Little-endian: TXD = Big-endian:[04,03,02,01] TXD = Big-endian (2 bytes):[01,02,03,04] TXD = [02,01,04,03] |