ERROR (ENUM) ¶ TYPE ERROR : This data structure describes errors eventually occurring while working with functions of CAA_SerialCom library. Values ranging from 5000 to 5099 have been reserved for these errors within the prefix registration (LibraryRegistry.chm). Attributes: qualified_only InOut: Name Initial Comment NO_ERROR 0 no error FIRST_ERROR 5000 first library specific error TIME_OUT 5001 = timeout error ABORT 5002 = abort input active HANDLE_INVALID 5003 = handle invalid ERROR_UNKNOWN 5004 = unknown error WRONG_PARAMETER 5005 = wrong parameter WRITE_INCOMPLETE 5006 = write incomplete FIRST_MF 5050 first manufacture specific error LAST_ERROR 5099 last library specific error
PARITY (ENUM) ¶ TYPE PARITY : Supported parity Attributes: qualified_only InOut: Name Initial Comment EVEN 0 0 = even parity ODD 1 = odd parity NONE 2 = no parity
RTS_CONTROL (ENUM) ¶ TYPE RTS_CONTROL : Configuration for RTS control (see parameter udiRtsControl) Attributes: qualified_only InOut: Name Initial Comment RTS_CONTROL_DISABLE 0 0 = Disables the RTS line RTS_CONTROL_ENABLE 1 = Enables the RTS line RTS_CONTROL_HANDSHAKE 2 = Enables RTS handshaking RTS_CONTROL_TOGGLE 3 = Specifies that the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low.
STOPBIT (ENUM) ¶ TYPE STOPBIT : Supported number of stop bits Attributes: qualified_only InOut: Name Initial Comment ONESTOPBIT 0 0 = 1 stopbit ONE5STOPBITS 1 = 1.5 stopbits TWOSTOPBITS 2 = 2 stopbits
Function Blocks ¶ Close (FunctionBlock) Open (FunctionBlock) Read (FunctionBlock) Write (FunctionBlock)
Close (FB) ¶ FUNCTION_BLOCK Close EXTENDS CBM.ETrig Close a serial com port opened via the FB COM. Open . The output handle hCom must be used here to close the COM port! InOut: Scope Name Type Comment Input hCom CAA.HANDLE Handle to the open COM port. Ist returned by the COM. Open function block. Output eError ERROR Local library error ID (0: no error; 5001: time out)
Open (FB) ¶ FUNCTION_BLOCK Open EXTENDS CBM.ETrig Open a serial com port. The input Parameter s are a list of settings, with which the COM port should be opened. Example: COMPort = 1, Baudrate = 115200, Parity = None, StopBit s = 1 DECLARATION: MyComOpen : COM.Open ; aParamsB115200 : ARRAY [1..7] OF COM.PARAMETER := [ (udiParameterId := COM.CAA_Parameter_Constants.udiPort, udiValue := 1), (udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate, udiValue := 115200), (udiParameterId := COM.CAA_Parameter_Constants.udiParity, udiValue := COM.PARITY.NONE), (udiParameterId := COM.CAA_Parameter_Constants.udiStopBits, udiValue := COM.STOPBIT.ONESTOPBIT), (udiParameterId := COM.CAA_Parameter_Constants.udiTimeout, udiValue := 0), (udiParameterId := COM.CAA_Parameter_Constants.udiByteSize, udiValue := 8), (udiParameterId := COM.CAA_Parameter_Constants.udiBinary, udiValue := 1) ] ; IMPLEMENTATION: So to parameterize the FB looks like: MyComOpen ( usiListLength := SIZEOF ( aParamsB115200 )/ SIZEOF ( COM.PARAMETER ), pParameterList := ADR ( aParamsB115200 )); ... InOut: Scope Name Type Comment Input usiListLength USINT Number of entries in the pParameterList pParameterList CAA.PVOID Pointer to ARRAY of parameter entries Output eError ERROR Local library error ID (0: no error; 5001: time out) hCom CAA.HANDLE specific Outputs
Read (FB) ¶ FUNCTION_BLOCK Read EXTENDS CBM.ETrigToA Function block to read data from the serial port InOut: Scope Name Type Comment Input hCom CAA.HANDLE Handle to the open COM port. Ist returned by the COM. Open function block. pBuffer CAA.PVOID Pointer to a buffer to get the received data from the COM port szBuffer CAA.SIZE Maximum size of the pBuffer parameter in bytes Output eError ERROR Local library error ID (0: no error; 5001: time out) szSize CAA.SIZE Returns the number of received data bytes in pBuffer
Write (FB) ¶ FUNCTION_BLOCK Write EXTENDS CBM.ETrigToA Function block to write data to the serial port InOut: Scope Name Type Comment Input hCom CAA.HANDLE Handle to the open COM port. Ist returned by the COM. Open function block. pBuffer CAA.PVOID Pointer to a buffer with the data to write to the COM port szSize CAA.SIZE Number of bytes in pBuffer to write to the COM port Output eError ERROR Local library error ID (0: no error; 5001: time out)
Global Variables ¶ CAA_Parameter_Constants (GVL)