Function Description
The INPUT_CHAR_QX
function is used to receive a
character string from a serial device connected to a Modicon X80 serial communication module (BMX NOM) located in
an EIO drop.
The message received is stored in a character string.
The additional parameters EN
and ENO
can be configured.
INPUT_CHAR_QX
function works with
a Modicon M340 BMX NOM 0200 module with a firmware version SV: 1.4
or later. With an earlier firmware version, an error (STATUS
= 16#3301) is raised.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 INPUT_CHAR_QX_Instance (ENABLE:=InputCharEnable, ABORT:=InputCharAbort,
ADDR:=ModuleAddress, RESET_BUF:=ResetInputBuffer, INPUT_LEN:=NbCharToRead,
DONE=>InputCharSuccessfull, ACTIVE=>InputCharActive, ERROR=>InputCharFaulty,
STATUS=>ErrorCode, REC_LEN=>NbCharReceived, REC_BUF=>ReceivedBuffer)
ST Representation
Representation:
INPUT_CHAR_QX_Instance (ENABLE:=InputCharEnable, ABORT:=InputCharAbort,
ADDR:=ModuleAddress, RESET_BUF:=ResetInputBuffer, INPUT_LEN:=NbCharToRead,
DONE=>InputCharSuccessfull, ACTIVE=>InputCharActive, ERROR=>InputCharFaulty,
STATUS=>ErrorCode, REC_LEN=>NbCharReceived, REC_BUF=>ReceivedBuffer)
Parameter Description
The following table describes the input parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
Set to 1 to receive a character string. |
|
|
Set to 1 to abort the current operation. |
|
|
Array containing the target Modicon M340 module address, result of ADDMX function. |
|
|
This parameter is used to reset the receiving memory:
|
|
|
Number of characters to be received:
|
The following table describes the output parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
Set to 1 when the execution of the function is completed successfully. |
|
|
Set to 1 when the execution of the function is in progress. |
|
|
Set to 1 if an error is detected by the function block. |
|
|
Provides the error code if an error is detected by the function block. |
|
|
Number of characters received. |
|
|
Characters received. |
Programming Rules
When
several INPUT_CHAR_QX
are launched simultaneously,
the RESET_BUF
parameter must be set to 0 (module's
receive memory not reset).
A reset request (RESET_BUF
=1) may be made to reset the module's memory for the next message
in order to avoid receiving old data. When the RESET_BUF
parameter is set to 1, the INPUT_CHAR_QX
function
must be launched before sending the data otherwise the characters
already received are flushed.
It is possible to launch the INPUT_CHAR_QX
function before the ending characters to the
PLC.
If the ending characters are used, if in the buffer there
are many ending characters and the buffer hasn't been reset, each INPUT_CHAR_QX
function receives the beginning string of
the buffer until it reaches the first ending character and then the
buffer is removed from the read characters.
It works in the same way for reading a number of characters.
If ending characters are configured it could be possible to use the number of characters function.
INPUT_CHAR_QX
,
the characters received on serial link are stored in a ring buffer.
The size of this buffer is 1024. When the buffer is full the other
characters are lost. To prevent this loss of characters it is possible
to select the RTS/CTS management. In this case when the ring buffer
is almost full, the CPU resets its RTS signal to stop the sending
of the characters.If a string of more than 1000 characters
is sent (for example 1013), the RTS will allow to receive only the
first 1000 characters, while the INPUT_CHAR_QX
function
will wait for the ending character indefinitely.
WARNING | |
---|---|