ReceiveString

ReceiveString 1:

Interface

VAR_INPUT
    Prefix : STRING;
    Suffix : STRING;
    Timeout : TIME;
    Reset :BOOL;
END_VAR
VAR_OUTPUT
    StringReceived: BOOL;
    busy : BOOL;
    Error: ComError_t;
    RxTimeout : BOOL;
END_VAR
VAR_IN_OUT
    ReceivedString : STRING;
    RXbuffer : ComBuffer;
END_VAR

Description

ReceiveString receives a string of characters from the interface corresponding to the input variable RxBuffer, storing it in the output variable ReceivedString. The start and end of the string are recognised by various mechanisms, which can be combined with one another:

As soon as the output StringReceived becomes TRUE, the received data are ready in the ReceivedString variable.

Reset

Setting the Reset input will reset the block from the receive state into the initial state. Reset is only necessary in exceptional cases, such as when the expected string can not be received.

Note

The string ReceivedString has a standard length of 80 characters which may be to short for some applications. In this case the function block ReceiveString255 can be used. The only difference is the string length of 255 characters for ReceivedString.