Setting COMx - ASCII

With the selection ASCII, the initialization of the serial interface is done for the “free protocol”, i.e. all interface parameters can be set and any protocol can be realized.

Sending and receiving data is done by means of the Function Blocks COM_SEND and COM_REC which are contained in ASCII_Library: ASCII Communication Library

Note

To be able to receive data using the Function Block COM_REC, a buffer of the size 272 bytes must be available (for example abyRecData : ARRAY[0..271] OF BYTE).

This is also required if only short telegrams are received.

The operating system provides a total of 32 buffers with 272 bytes each for the transmission and reception of data. If the PLC is in STOP mode (= pause) or the input EN at the block COM_REC is set to FALSE or the Function Block is not called, these buffers run full.

If the Function Block COM_REC is called again (with EN = TRUE) before all buffers are used, the data received meanwhile are available.

If all buffers were full, the error Invalid handle with ERR = TRUE and ERNO = 16#2001 = 8193 is reported for one cycle. After this the reception is reset.

Receiving is always reset after a download or the command Online/Reset.

Configuration

Right-click COMx_Online_Access ‣ Add object
and select COMx_ASCII from the list.

The parameters define how the serial interface will be initialized. The parameters can be grouped. They are used to initialize the following functions:

  • Monitoring the programming login:

    Enable login

  • Modem control and RS-485:

    RTS control, TLS, CDLY

  • Recognition of telegram ending for reception:

    Character timeout, Telegram ending selection, Telegram ending value, Telegram ending character

  • Checksum

  • Transmission parameters:

    Baudrate, Parity, Data bits, Stop bits

The following parameters are available:

Parameter

Default

value

Value Meaning
Enable login Setting COMx - ASCII Disabled Disabled There is no check with regard to the Control Builder login telegram.
Enabled Telegrams received are checked with regard to the Control Builder login sequence. If the sequence is detected, the protocol setting is changed to Online access.
RTS control s Setting COMx - ASCII None None No RTS control (direction control, not for PM55x and PM56x CPUs)
Telegram

RTS control activated

(absolutely necessary for RS 485!)

RTS/CTS (DTE <–> DTE) RTS and CTS signals are controlled to simulate a DTE device at the PLC communicating with a DTE device.
RTS/CTS (DTE –> DCE) RTS and CTS signals are controlled to simulate a DTE device at the PLC communicating with a DCE device.
RTS/CTS (DCE <– DTE) RTS and CTS signals are controlled to simulate a DCE device at the PLC communicating with a DTE device.
TLS Setting COMx - ASCII 0 0…65535 For PM5xx and CM574-RS: Carrier lead time in [ms] (TLS > CDLY)
0…850 For CI504-PNIO and CI506-PNIO: Carrier lead time in [ms] (TLS > CDLY)
CDLY Setting COMx - ASCII 0 0…65535 For PM5xx and CM574-RS: Carrier delay time in [ms] (CDLY <= TLS)
0…850 For CI504-PNIO and CI506-PNIO: Carrier delay time in [ms] (CDLY <= TLS)
Character timeout Setting COMx - ASCII 0 0…65535 For PM5xx and CM574-RS: Character timeout in characters (must be 0 if Telegram ending selection = Character timeout)
0/32 For CI504-PNIO and CI506-PNIO: Character timeout in bits (must be 0 if Telegram ending selection = Character timeout)
Telegram ending selection Setting COMx - ASCII and Setting COMx - ASCII none none No telegram ending identifier
String (check receive) 2 characters, e.g. <CR><LF> (16#0d, 16#0a -> 16#0d0a) in parameter “Telegram ending value” (not supported with COM2 of AC500-eCo CPUs)
Telegram length Telegram ending identifier set by telegram length
Duration Telegram ending identifier set by time (not supported with CI504-PNIO and CI506-PNIO)
Character timeout Telegram ending identifier set by character timeout
Telegram ending character Setting COMx - ASCII 16#0d 0…255 Up to version V1.1.x: Telegram ending character
0 0…2 As of version V1.2.0: Number of end characters in case of telegram ending selection “String”
Telegram ending value Setting COMx - ASCII 0 0…65535 Up to version V1.1.x: Telegram ending identifier value for settings “Duration” and “Character timeout”
0 0…65535 As of version V1.2.0: Telegram ending identifier value for settings “Duration”, “Character timeout” and “String”
Checksum Setting COMx - ASCII none None No checksum
CRC8 CRC8 checksum
CRC16 CRC16 checksum (Motorola format)
LRC Add all values to byte (ignore overflow), result multiplied by -1
ADD Add all values to byte (ignore overflow)
CS31 CS31 bus checksum
CRC8-FBP CRC8 FBP field bus neutral protocol
XOR XOR all values to byte (ignore overflow)
CRC16 (Intel) Like CRC16, result swapped
Baudrate 19200 300 Baudrate (baud/s)
1200  
4800  
9600  
14400  
19200  
38400  
57600  
115200  
125000 (Not supported with CI504-PNIO and CI506-PNIO)
187500 (Not supported with CI504-PNIO and CI506-PNIO)
Parity none None No parity check
Odd Odd parity
Even Even parity
Mark Parity bit := TRUE (Not supported with CI504-PNIO and CI506-PNIO)
Space Parity bit := FALSE (Not supported with CI504-PNIO and CI506-PNIO)
Data bits 8 5, 6, 7, 8 Character length in bits/character
Stop bits 1 1, 2 Number of stop bits