Get status of a single Ethernet unit using HTTP transmission
This FP instruction gets the information from the Ethernet unit specified by nTransferID and writes the values into the DUT FP_CLIENT_STATUS_DUT.
Input
Ethernet unit ID (values: 0–15)
Output
Stores the values of the Ethernet status of the specified Ethernet unit
This instruction is not available in interrupt programs.
Before you execute the instruction, you need to specify the transfer settings using FP_HTTP_SET_MODE or the setting dialog of the HTTP client.
When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.
if the Ethernet unit ID specified is outside the permissible range (0–15)
if a transfer setting that has not been configured with FP_HTTP_SET_MODE or in the setting dialog of the HTTP client is specified.
if the instruction is executed in an interrupt program
if the Ethernet unit ID specified is outside the permissible range (0–15)
if a transfer setting that has not been configured with FP_HTTP_SET_MODE or in the setting dialog of the HTTP client is specified.
if the instruction is executed in an interrupt program
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
bReadStatusID5: BOOL:=FALSE;
iID10: INT:=10;
dutFPClientStatusID10: FP_CLIENT_STATUS_DUT;
END_VAR
If bReadStatusID10 is set to TRUE, the instruction is carried out. It gets the HTTP transfer values from Ethernet unit 10 and writes the values into the DUT dutFPClientStatusId10.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_CONTACT,,bReadStatusID10,5,1,7,3,);
B(B_VARIN,,iID10,6,4,8,6,);
B(B_VAROUT,,dutFPClientStatusID10,21,4,23,6,);
B(B_F,FP_HTTP_GET_STATUS!,,8,2,21,6,,?DEN?DnTransferID?AENO?CdutClientStatus);
L(1,2,5,2);
L(7,2,7,4);
L(7,4,8,4);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If (bReadStatusID10) then
FP_HTTP_GET_STATUS(nTransferID := iID10,
dutClientStatus => dutFPClientStatusID10);
End_if;