ReceiveCharacters

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.

Parameters

Input

Port (WORD, INT, UINT)

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

sString (STRING)

Stores the received characters

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)

if the MCU unit does not exist at the slot no. specified by Port.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)

if the MCU unit does not exist at the slot no. specified by Port.

Example

POU header

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

LD body

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

ST body

If (bReceive) then
    sString:=ReceiveCharacters(1);
End_if;

Modified on: 2022-01-14Feedback on this pagePanasonic hotline