Read communication port status
This FP instruction gets the status of the communication port specified by s_Port of the CPU unit and stores the result in the DUT d_dutStatus.
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
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
bStart: BOOL:=FALSE;
DUT_Status: FP_COM_STATUS_DUT;
END_VAR
When the variable bStart changes from FALSE to TRUE, the function is carried out.
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_VARIN,,0,7,3,9,5,);
B(B_VAROUT,,DUT_Status,21,3,23,5,);
B(B_CONTACT,,bStart,4,2,6,4,R);
B(B_F,FP_COM_GET_STATUS!,,9,1,21,5,,?DEN?Ds_Port?AENO?Cd_dutStatus);
L(1,3,4,3);
L(6,3,9,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(bStart) then
FP_COM_GET_STATUS(s_Port :=0, d_dutScuStatus => DUT_SCUStatus);
END_IF;