4. Configuration
201
PROGRAM MainPrg
VAR
Purge_Queue: SERIAL_PURGE_RX_QUEUE;
Port: SERIAL_PORT := COM1;
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
Purge_Queue.REQUEST := TRUE;
Purge_Queue.PORT := Port;
//FUNCTION:
Purge_Queue();
//OUTPUTS:
Purge_Queue.DONE;
Purge_Queue.EXEC;
Purge_Queue.ERROR;
Status := Purge_Queue.STATUS; // If it’s necessary to treat the error.
SERIAL_RX
This function block is used to receive a serial port buffer, using the RX queue normal mode. In this
mode, each character in the RX queue occupy a single byte which has the received data, storing 5, 6,
7 or 8 bits, according to the serial interface configuration.
Figure 4-98. Block Used to Read the Reception Buffer Values
This variable, when true, enables the function
block use.
Select the serial port, as described in the
SERIAL_PORT data type.
Pointer of a byte array to receive the buffer
values.
Specify the expected character number in the
byte array. In case more than the expected
bytes are available, only the expected quantity
will be read from the byte array, the rest will be
leaved in the RX queue (maximum size equal
to 1024 characters).
Specify the time-out to receive the expected
character quantity. In case it is smaller than the
necessary to receive the characters, the
RX_TIME-OUT_ERROR output from the
STATUS parameter will be indicated. When the
specified value, in ms, is equal to zero, the
function will return the data within the buffer.
Table 4-139. SERIAL_RX Input Parameters