COM.Read (FB; Prefix comr)

By use of this function block data of the CAA_SerialCom.library can be read from the COM port specified by its handle. The memory content, the pointer pBuffer is assigned to, should not be modified while reading. The size of the memory structure containing the bytes received is not checked! The function block will not hold out for data to be received, but only read data already received; afterwards it will set xDone.

If the stability of the pointer on the data structures and their contents cannot be ensured during an online change, the online change has to be prohibited by the function block with the help of functions which are part of the CAA.Application library.

Input:

xExecute

BOOL

see: “CAA 指南”

xAbort

BOOL

see: “CAA 指南”

udiTimeOut

UDINT

see: “CAA 指南”

hCom

CAA.HANDLE

Handle of COM port

pBuffer

CAA.PVOID

Address, the data to be sent can be retrieved; this address can be determined employing the operator ADR 

szBuffer

CAA.SIZE

Number of bytes to be written; can be determined by employing the operator SIZEOF

Output:

xDone

BOOL

see: “CAA 指南”

xBusy

BOOL

see: “CAA 指南”

xError

BOOL

see: “CAA 指南”

eError

COM.ERROR 

Error ID

szSize

CAA.SIZE

Current number of bytes successfully read; this value is valid even before xDone has been set