Function receives data via the serial interface (Interface setting).
When the function fixes the start of data transfer (state = 1
), then the first bytes received are copied into the RXD buffer, starting at index 0
.
If the amount of incoming data is more than 64 bytes, then the receiving process will be completed in several cycles (state = 2
), while the remaining data will be added to the RXD buffer starting from the index of the last index written on the previous cycle.
Multi-cycle data reception has a number of important features and is described in detail in the Guide about RXD and TXD Buffers.
Function will fix the end of data reception (state = 3
) if after receiving the last byte the receive timeout (Timeout setting) has expired. The next data will be considered new and will be written to the RXD buffer at index 0.
For the function to work, the corresponding interface must be configured in the device configuration:
Confirguration > RS-232/RS-485 > Device X > Сomplex Events (asynchronous mode).
Function menu | Block diagram |
---|---|
![]() |
![]() |
Name | Type | Description |
---|---|---|
enabled |
bool | If True, the function receives incoming data from the interface |
reset |
bool | If True, the function will clear the RXD buffer (all bytes will be set to x00 ) and the next data will be written starting at index 0 . |
Name | Type | Description |
---|---|---|
state |
int32 | Receiver status: 0 - receive disabled; 1 - waiting for data; 2 - receiving data ; 3 – data accepted; -1 – interface unavailable (not configured). |
size |
int32 | Transmitter status: 0 - no activity; 1 - transmitting data; -1 - interface not available (not configured). |
offset |
int32 | Amount of data lost due to RXD buffer overflow (if more data received than buffer size). Overflow deletes older data (which came first). |
Name | Description |
---|---|
Interface | Digital interface controlled by the function. If the selected interface is not configured, the function will generate a state = -1 error. |
Timeout | Time after receiving the last byte, after which it is considered that data reception is completed (state = 3 ).The next data will be considered new and will be written to the RXD buffer from index 0 . |