Function Description

INPUT_BYTE is used to send an array of bytes read request to a character mode communication module. The message received is stored in an array of bytes.

NOTE: In general, INPUT_BYTE provides same feature like INPUT_CHAR but it allows to pass a table off bytes instead of a string as output parameter. Because of this, it is possible to read a 0 (NULL) byte value in a byte stream from a serial port.

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 1024 bytes.

2 exclusive possibilities are available:

  • Read a number of bytes: 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_BYTE Raz, Buffer_Length, Management_Param, Received_Data

ST Representation

Representation:

INPUT_BYTE(Address, Raz, Buffer_Length, Management_Param, Received_Data);

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

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 (for example, 0.0.0.SYS processor terminal port).

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-type. Node is an optional field that may be SYS or empty (e.g. ADDM(‘0.0.0.SYS’) equals ADDM(‘0.0.0’).

For Modicon M580 CPU:

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

RAZ

INT

Reset. This parameter is used to reset the coupler's receive memory.

  • value = 0: no memory reset

  • value = 1: memory reset

NOTE: For terminal port communications of Premium PLCs, the value must be 1.

NOTE: On Modicon M340 and M580 CPU, the INPUT_BYTE EF can be programmed with or without this parameter.

NB

INT

Length of the buffer or number of bytes to be received.

  • Value = 0: Message read as soon as it is available on the channel. Here, a stop condition must be specified in the configuration screen.

  • Value greater than 0: Specifies the number of bytes to be read.

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

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 system which defines the length of the exchange.

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

The following table describes the output parameters:

Parameter

Type

Comment

RECP

ARRAY OF BYTE

Bytes received. This is then stored in a BYTE array.

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_BYTE 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_BYTE function must be launched before sending the data.

On Premium PLCs, it takes several PLC cycles to receive a byte 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 byte string of a maximum length of 1024 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_BYTE function has been sent and is still pending.