SerialLineControl
The SerialLineControl function block looks after the communication between a serial interface (KL60xx, EL60xx or COM interface) and the PLC. The function block is called cyclically, and places received data into the RxBuffer. Data made available in the TxBuffer transmit buffer is sent to the interface at the same time.
Because the function operates independently of the application, it is referred to as background communication and can, particularly in the case of serial bus terminals, also operate in a fast task (see Communication concept and Supported hardware).
In Version 2.0 and above of the library the function block replaces the hardware-dependent KL6Control, KL6Control5B and PcComControl function blocks.
Interface
VAR_INPUT
Mode : ComSerialLineMode_t;
pComIn : POINTER TO BYTE
pComOut : POINTER TO BYTE
SizeComIn : UINT;
END_VAR
VAR_OUTPUT
Error : BOOL;
ErrorID : ComError_t;
END_VAR
VAR_IN_OUT
TxBuffer : ComBuffer;
RxBuffer : ComBuffer;
END_VAR
Mode | The Mode input specifies unambiguously which serial hardware is being used. |
---|---|
pComIn | Universal pointer to the input variable of the process data for the serial hardware (data types KL6inData, KL6inData5b, KL6inData22b, EL6inData22b, PcComInData). The pointer is assigned with the ADR() function. |
pComOut | Universal pointer to the output variable of the process data for the serial hardware (data types KL6outData, KL6outData5b, KL6outData22b, EL6outData22b, PcComOutData). The pointer is assigned with the ADR() function. |
SizeComIn | Size of the input process image of the serial hardware being used. The size is determined and assigned with the SIZEOF() function. |
Error | The Error output becomes TRUE as soon as an error occurs. |
ErrorID | The ErrorID output provides an error code when an error occurs. |
TxBuffer | Buffer with transmit data for the serial hardware being used. The transmit buffer is filled by functions such as SendByte, SendData or SendString. |
RxBuffer | Buffer into which received data is placed. The receive buffer is read by functions such as ReceiveByte, ReceiveData or ReceiveString. |