Function Description

The OUT_IN_CHAR function is used to send a string of a maximum of 210 bytes (120 for the terminal port), followed by a message receive request (send only or receive only is also possible).

The character string may be contained in a static variable or stipulated in the form of an immediate value (series of bytes between apostrophes, e.g.: 'Message to be sent').

These character strings may contain special characters, and must start with the character $ followed by the hexadecimal value of the character to be sent, for example $0D.

Certain special characters may be used, such as:

$R = CR (carriage return), $L = LF (line feed), $N = CR+LF.

The additional parameters EN and ENO can be configured.

FBD Representation

Representation:

LD Representation

Representation:

IL Representation

Representation:

LD Address
OUT_IN_CHAR Mode, Data_to_Send, Management_Param, Received_Data

ST Representation

Representation:

OUT_IN_CHAR(Address, Mode, Data_to_Send, Management_Param, Received_Data);

Parameter Description

The following table describes the input parameters:

Parameter

Type

Comment

Address

ARRAY [0...5] OF INT

Address of the destination entity of the exchange. Only those addresses ending in SYS are possible (e.g.: {Network.Station}SYS).

Mode

INT

Operating mode:

  • 1: transmission followed by receive mode

  • 2: send a message

  • 3: message in receive mode

Data_to_Send

STRING

Character string to send. It is essential for this character string to exist when the function is called, even if there is no data to send (for example in receive only mode).

The following table describes the input/output parameters:

Parameter

Type

Comment

Management_Param

ARRAY [0...3] OF INT

Exchange management table

The following table describes the output parameters:

Parameter

Type

Comment

Received_Data

STRING

Character string received. It is essential for this character string to exist when the function is called, even if there is no data to receive (for example in send only mode).

NOTE: At the time of transmission or of a transmission followed by reception, the user is advised to initialize the fourth word of the management table (length) before executing the function. Also, the length of the character string received is stored in this same word at the end of this exchange. However, prior to this, during configuration, it is necessary to define a stop condition.

To send character strings containing end of string characters (ZERO). You must:

  • Use localized STRINGS.

  • Initialize the last word of the exchange management table with the number of characters to send. If you initialize this word with the value 0, the string that is sent will stop at the first ZERO character it encounters. If you initialize it will a value, the length of the character string sent will be equal to this value.