Function Description

The PRINT_CHAR_QX function is used to send a character string of 1000 bytes maximum to a serial device connected to a Modicon X80 serial communication module (BMXNOM0200) located in an EIO drop.

The character string may be contained in a static variable or stipulated in the form of an immediate value (series of bytes between apostrophes, for example: '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.

The communication function blocks use one data transaction path and require multiple cycles to complete an operation. The number of transaction paths available by module and by MAST cycle depends on the communication port used:

  • Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.

  • TCP/IP Ethernet embedded port support up to 4 blocks at the same time.

  • TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same time.

More communication function blocks may be programmed on the same communication port. However, a communication block exceeding the maximum number on that port is not serviced until one of the transaction paths is available. Then, the next block on the same port becomes active and begins using an available path.

FBD Representation

Representation:

LD Representation

Representation:

IL Representation

Representation:

CAL PRINT_CHAR_QX_Instance (ENABLE:=PrintCharEnable, ABORT:=PrintCharAbort, ADDR:=ModuleAddress, SEND_LEN:=NbCharToSend, SEND_BUF:=SendBuffer, DONE=>PrintCharSuccessfull, ACTIVE=>PrintCharActive, ERROR=>PrintCharFaulty, STATUS=>ErrorCode)

ST Representation

Representation:

PRINT_CHAR_QX_Instance (ENABLE:=PrintCharEnable, ABORT:=PrintCharAbort, ADDR:=ModuleAddress, SEND_LEN:=NbCharToSend, SEND_BUF:=SendBuffer, DONE=>PrintCharSuccessfull, ACTIVE=>PrintCharActive, ERROR=>PrintCharFaulty, STATUS=>ErrorCode);

Parameter Description

The following table describes the input parameters:

Parameter

Type

Comment

ENABLE

BOOL

Set to 1 to send a character string.

ABORT

BOOL

Set to 1 to abort the current operation.

ADDR

ANY_ARRAY_INT

Array containing the target Modicon X80 module address, result of ADDMX function.

SEND_LEN

INT

Number of characters to send.

SEND_BUF

ANY

Characters to send.

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

Description of output parameters:

Parameter

Data type

Meaning

DONE

BOOL

Set to 1 when the execution of the function is completed successfully.

ACTIVE

BOOL

Set to 1 when the execution of the function is in progress.

ERROR

BOOL

Set to 1 if an error is detected by the function block.

STATUS

WORD

Provides the error code if an error is detected by the function block.

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.

NOTE: To send character strings containing end of string characters (ZERO), you must:
  • use localized STRINGS

  • initialize SEND_LEN with the number of characters to send.