Reset the receive buffer
This instruction clears the receive buffer at the communication port specified by Port.
Input
Specifies the communication ports depending on the PLC type:
COM port e.g. SYS_COM0_PORT
Ethernet port e.g. SYS_ETHERNET_USER_CONNECTION_1
MCU/SCU e.g. 16#xx01 (xx = slot number) in COM01
The receive buffer is automatically reset when a send instruction is executed. To reset the receive buffer without sending further data, execute this instruction. Alternatively, you can also use F159_MTRN with n_Number = 0. Resetting the receive buffer sets the number of bytes received in offset 0 to 0 and moves the write pointer back to offset 1. The next data will be stored starting at offset 1 and overwriting the existing data. The "reception done" flag turns to FALSE.
if the communication port specified by Port does not exist.
if the communication port specified by Port does not exist.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bClearReceiveBuffer: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 4 ;
NETWORK_BODY
B(B_CONTACT,,bClearReceiveBuffer,5,1,7,3,R);
B(B_F,E_ClearReceiveBuffer!,,11,0,21,4,,?DEN?DPort?AENO);
B(B_VARIN,,1,9,2,11,4,);
L(1,2,5,2);
L(7,2,11,2);
L(1,0,1,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (DF(bClearReceiveBuffer)) then
ClearReceiveBuffer(1);
end_if;