COM port functions

COM Port Read

COM port functions 1:
Function block F_COMPORTREAD

FUNCTION F_COMPORTREAD

VAR_INPUT

hCom         :INT;
cbRxBuffer   :UINT;
pRxBuffer    :UDINT;

Legend

hCom: is connected with the iHandle of FB_COMPORTOPEN

cbRxBuffer: maximum length of data that can be read.

pRxBuffer: pointer to data to be written with the COM buffer content

Return value

Meaning

> 0

Number of bytes that is to be copied from the COM buffer into the PLC. 

0x8000

Memory overflow

COM Port Write

COM port functions 2:
Function block F_COMPORTWRITE

FUNCTION F_COMPORTWRITE

VAR_INPUT

hCom         :INT;
cbTxBuffer   :UINT;
pTxBuffer    :UDINT;

Legend

hCom: is connected with the iHandle of FB_COMPORTOPEN

cbTxBuffer: Number of data bytes that were copied into the COM buffer.

pTxBuffer: Pointer to the data from which the  COM buffer is to be filled.

Return value

Meaning

> 0

Number of bytes that is to be copied into the COM buffer from the PLC 

0x8000

Memory overflow