Function Description
The INPUT_CHAR
function is used to
send a character string read request to a character mode communication
module (await reception of character strings). The message received
is stored in a character string.
For Premium PLCs, this function is used to receive up to 4 Kbytes (120 bytes for the terminal port).
For Modicon M340 and M580 CPU, this function is used to receive up to 1,024 bytes.
2 exclusive possibilities are available:
Read a number of characters: No condition should be configured.
Read a message: A stop condition should be configured in the configuration screen.
The additional parameters EN
and ENO
can be configured.
FBD Representation
Representation:

LD Representation
Representation:

IL Representation
Representation:
LD Address
INPUT_CHAR Raz, String_Length, Management_Param, Received_Data
ST Representation
Representation:
INPUT_CHAR(Address, Raz, String_Length, Management_Param, Received_Data);
Parameter Description
The following table describes the input parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
For the Premium PLC:
For the Modicon M340 PLC:
For the Modicon M580 CPU:
|
|
|
Reset. This parameter is used to reset the coupler's receive memory.
NOTE: For terminal port communications of Premium PLCs, the value must be 1. NOTE: On Modicon M340 and M580
CPU, the |
|
|
Length of the character string or number of characters to be received.
NOTE: For terminal port communications of Premium PLCs, 0 is the only value authorized. Here, the default end of message character is a carriage return (CR). |
The following table describes the input/output parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
Exchange management table consisting of the following words:
For detailed information, refer to section Structure of the Management Parameters. |
The following table describes the output parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
String received. This is then stored in a character string. NOTE: The size of the data received
(in bytes) is written automatically by the system in the fourth word
of the management table.
|
Programming Rules
When
several INPUT_CHAR
are launched simultaneously,
the RAZ
parameter must be set to 0
(module's receive memory not reset).
A request may be made to reset the module's memory for the next message in order to avoid receiving old data.
When the RAZ
parameter is set to 1, the INPUT_CHAR
function must be launched before sending the data.
On Premium PLCs, it takes several PLC cycles to receive 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 receives the string consistently over several fragments.
On Modicon M340 and M580 CPU, it takes only one CPU cycle to receive 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.
It is possible to launch the INPUT_CHAR
function before ending the 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
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
, 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
function will wait for the ending
character indefinitely (if no timeout has been defined with the function).
WARNING | |
---|---|