SendCharactersAndClearString

Send characters and clear string

This instruction executes the send data instruction F159_MTRN. The data is contained in the send string applied at sString, a VAR_IN_OUT variable. If bSuppressEndCode is set to TRUE, the end code selected in the system registers is not appended to the send string.

In contrast to SendCharacters, no additional send buffer is used internally. The variable applied at sString is cleared after execution.

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

bSuppressEndCode (BOOL)

The end code selected in the system registers is not appended to the send string.

Input/output

sString (STRING)

Stores the send string, which is cleared after execution of the instruction

Remarks

When the specified number of bytes has been sent, the "transmission done" flag turns to TRUE. New data may be sent or received. Any send instruction turns the "transmission done" flag to FALSE and no data can be received. Evaluation of the "transmission done" flag may be useful in cases where no response can be expected, e.g. with broadcast messages.

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
		sSendData: STRING[30]:='ABCDEFGH';
			(*up to 30 chars*)
		bSuppressEndCode: BOOL:=FALSE;
	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,SendCharactersAndClearString!,,14,0,29,5,,?DPort?DbDSuppressEndCode?DsString?AsString);
B(B_VARIN,,1,12,1,14,3,);
B(B_VARIN,,sSendData,12,3,14,5,);
B(B_VARIN,,bSuppressEndCode,12,2,14,4,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

SendCharactersAndClearString(Port := 1,
                bSuppressEndCode := bSuppressEndCode,
                sString := sSendData);

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