Receive characters from CPU or MCU port
This instruction copies the characters received at the port specified by Port into the variable applied at sString.
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
Stores the received characters
if the MCU unit does not exist at the slot no. specified by Port.
if the MCU unit does not exist at the slot no. specified by Port.
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
bReceive: BOOL:=FALSE;
(*activates function*)
sString: String:='';
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,E_ReceiveCharacters!,,8,1,18,5,,?DEN?DPort?AENO?CsString);
B(B_CONTACT,,bReceive,3,2,5,4,);
B(B_VARIN,,1,6,3,8,5,);
B(B_VAROUT,,sString,18,3,20,5,);
L(1,3,3,3);
L(5,3,8,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If (bReceive) then
sString:=ReceiveCharacters(1);
End_if;