Evaluate "reception done" flag
This function returns the value of the "reception done" flag. It is TRUE if the end code has been received at the communication port assigned at 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
Output
Set to TRUE if the end code has been received. The end code is specified in the corresponding system register under COM port settings.
Evaluation of the "reception done" flag
When for the specified time no further bytes are received or the instruction ClearReceiveBuffer is performed, the IsDone output turns to TRUE. Reception of any further data is prohibited. F159_MTRN or ClearReceiveBuffer turns the "IsDone" flag to FALSE. This function can be used for FP7 or MCU also for the timeout mode. The "reception done" flag can be evaluated using one of the following instructions or system variables:
IsReceptionDone
IsReceptionDoneByTimeOut
sys_bIsComPort1ReceptionDone, sys_bIsComPort2ReceptionDone, sys_bIsToolPortReceptionDone (depending on the port)
The end of reception can also be determined by checking the contents of the receive buffer. The number of received bytes may change while a scan is being carried out. For example, if the number of received bytes is read more than once different statuses may exist within one scan.
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
iPort: INT:=0;
bIsDone: 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 := 5 ;
NETWORK_BODY
B(B_F,IsReceptionDone!,,5,0,14,3,,?DPort?CIsDone);
B(B_VARIN,,iPort,3,1,5,3,);
B(B_VAROUT,,bIsDone,14,1,16,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
bIsDone:=IsReceptionDone(Port := iPort);