Function Description

For Premium PLCs, the PRINT_CHAR function is used to send a character string of a maximum of 4 Kbytes, 120 bytes at the terminal port, to be transmitted on a character mode link.

For Modicon M340 and M580 CPU, the PRINT_CHAR function is used to send a character string of a maximum of 1,024 bytes.

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
PRINT_CHAR String_to_Send, Management_Param

ST Representation

Representation:

PRINT_CHAR(Address, String_to_Send, Management_Param);

Parameter Description

The following table describes the input parameters:

Parameter

Type

Comment

ADR

ARRAY [0..5] OF INT for Premium

ARRAY [0..7] OF INT for Modicon M340 and M580

The following statements are true only for Premium PLC:

  • Address of the message's receiving character mode channel is given by the ADDR function

  • Only those addresses ending in SYS are possible (example: 0.0.0.SYS processor terminal port).

The following statements are true only for Modicon M340 PLC:

  • Address of the message's receiving character mode channel is given by the ADDM function

    .
  • The syntax of the address is of ADDM (‘r.m.c.node’)-type. Node is an optional field that may be SYS or empty (e.g. ADDM(‘0.0.0.SYS’) equals ADDM(‘0.0.0’).

The following statements are true only for Modicon M580 CPU:

  • Address of the destination entity of the print operation, result of ADDMX function.

EMIS

STRING

Character string to send. This is either latched in a character string or provided as an immediate value.

Note: this character string must exist, even if there is no data to be sent.

The following table describes the input/output parameters:

Parameter

Type

Comment

GEST

ARRAY [0..3] OF INT

Exchange management table consisting of the following words:

  • Rank 1 word: a word managed by the system and consisting of two bytes:

    • Most significant byte: exchange number

    • Least significant byte: activity bit (rank 0) and cancel bit (rank 1)

      NOTE: The cancel bit is only available for Modicon M340 and M580 PLCs.
  • Rank 2 word: a word managed by the system and consisting of two bytes:

    • Most significant byte: operation report

    • Least significant byte: communication report

  • Rank 3 word: a word managed by the user, which defines the maximum response time using a time base of 100 ms.

  • Rank 4 word: a word managed by the user which defines the length of the exchange.

    • If this parameter length is set to 0 then the system sends the string entirely.

    • If this parameter length is greater than the length of the string then the error 16#0A (Insufficient send buffer size) is returned into the 2nd management word and no character is sent.

    NOTE: In case of PRINT_CHAR, the fourth management word (length to send) must not be written while the activity bit is 1 (i.e. once EF is running). Otherwise PRINT_CHAR could be locked with error 0xB.

For detailed information, refer to section Structure of the Management Parameters.

Programming Rules

Special characters are preceded by the character $ in the string to be transmitted. The $ characters are not transmitted by the sender, and must therefore not be counted during the initialization of the length parameter.

The spaces between two characters are counted in a byte.

Therefore, for the example PRINTING IN PROGRESS$L$R, the length of the data to be sent is 22 bytes.

On Premium PLCs, it takes several PLC cycles to send a character string of more than 240 bytes (the string is fragmented). It is therefore important to make sure that the management data is not modified during the processing of the function. The system transmits the string consistently over several fragments, but does not prohibit the transmission of another character string between two fragments.

On Modicon M340 and M580 CPU, it takes one CPU cycle to send a character string of a maximum length of 1,024 bytes. It is important to make sure that the management data is not modified during the processing of the function.

The Modicon M340 PLC's serial port is full duplex, so a PRINT_CHAR function can be sent even when an INPUT_CHAR function has been sent and is still pending.

NOTE: 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 with a value, the length of the character string sent will be equal to this value.