Functions ¶ This folder contains managed and unmanaged CL2 functions. Managed (functions without prefix “_”) means that resources are managed by a resource manager and resources are automatically released on reset application (e.g. driver and receivers are automatically closed). Unmanaged means that resources should be released by application. Unmanaged functions (functions with prefix “_”) offer better performance because there is no resource manager overhead and message handles can be casted directly to POINTER TO CL2I.MESSAGE (see CAN Low Level Imp Extern library for more details). Note Do not mix up managed and unmanaged functions. Handles from unmanaged functions should not be passed to managed functions and vice versa. Note With SIL2 runtime all functions are unmanaged! Basic Functions CloneMessage (Function) CreateIdAreaReceiver (Function) CreateMaskReceiver (Function) CreateMessage (Function) CreateSingleIdReceiver (Function) DeleteReceiver (Function) DriverClose (Function) DriverGetSize (Function) DriverOpenH (Function) DriverOpenP (Function) FreeMessage (Function) Read (Function) RegisterIdArea (Function) UnregisterIdArea (Function) Write (Function) Diagnostic Information GetBaudrate (Function) GetBusAlarm (Function) GetBusState (Function) GetBusload (Function) GetDiagnosis (Function) GetLostCounter (Function) GetReceiveCounter (Function) GetReceiveErrorCounter (Function) GetReceivePoolSize (Function) GetReceiveQueueLength (Function) GetTransmitCounter (Function) GetTransmitErrorCounter (Function) GetTransmitPoolSize (Function) GetTransmitQueueLength (Function) IsSendingActive (Function) ResetBusAlarm (Function) Extended Functionality DisableSyncService (Function) EnableSyncService (Function) Indicator Services GetCiAState (Function) SetCiAState (Function) Internal Basic Functions _CloneMessage (Function) _CreateArrayReceiver (Function) _CreateIdAreaReceiver (Function) _CreateMaskReceiver (Function) _CreateMessage (Function) _CreateSingleIdReceiver (Function) _DeleteReceiver (Function) _DriverClose (Function) _DriverGetSize (Function) _DriverOpenH (Function) _DriverOpenP (Function) _FreeMessage (Function) _Read (Function) _ReadArrayReceiver (Function) _RegisterIdArea (Function) _UnregisterIdArea (Function) _Write (Function) Diagnostic Information _GetBaudrate (Function) _GetBusAlarm (Function) _GetBusState (Function) _GetBusload (Function) _GetDiagnosis (Function) _GetLostCounter (Function) _GetReceiveCounter (Function) _GetReceiveErrorCounter (Function) _GetReceivePoolSize (Function) _GetReceiveQueueLength (Function) _GetTransmitCounter (Function) _GetTransmitErrorCounter (Function) _GetTransmitPoolSize (Function) _GetTransmitQueueLength (Function) _IsSendingActive (Function) _ResetBusAlarm (Function) Extended Functionality _DisableSyncService (Function) _EnableSyncService (Function) Indicator Services _GetCiAState (Function) _SetCiAState (Function) Message Information _GetMessageDataPointer (Function) _GetMessageId (Function) _GetMessageLength (Function) _GetMsgCount (Function) _GetNetId (Function) _GetTimeStamp (Function) _Is29BitIdMessage (Function) _IsRTRMessage (Function) _IsTransmitMessage (Function) _LostMessages (Function) Message Information GetMessageDataPointer (Function) GetMessageId (Function) GetMessageLength (Function) GetMsgCount (Function) GetNetId (Function) GetTimeStamp (Function) Is29BitIdMessage (Function) IsRTRMessage (Function) IsTransmitMessage (Function) LostMessages (Function)
Basic Functions ¶ Basic Functions for receiving and sending CAN messages. CloneMessage (Function) CreateIdAreaReceiver (Function) CreateMaskReceiver (Function) CreateMessage (Function) CreateSingleIdReceiver (Function) DeleteReceiver (Function) DriverClose (Function) DriverGetSize (Function) DriverOpenH (Function) DriverOpenP (Function) FreeMessage (Function) Read (Function) RegisterIdArea (Function) UnregisterIdArea (Function) Write (Function)
CloneMessage (FUN) ¶ FUNCTION CloneMessage : CAA.HANDLE This function duplicates an existing message. This duplicated message may be modified and sent via Write for example. Example VAR hReceiver : CAA.HANDLE ; hMsg : CAA.HANDLE ; hMsgCloned : CAA.HANDLE ; ctMsgLeft : CAA.COUNT ; eError : CL2.ERROR ; END_VAR //receive a message from hReceiver hMsg := CL2.Read ( hReceiverId := hReceiver , pctMsgLeft := ADR ( ctMsgLeft ), peError := ADR ( eError )); IF hMsg <> CAA.gc_hINVALID THEN //Clone received message hMsgCloned := CL2.CloneMessage ( hMessage := hMsg , peError := ADR ( eError )); //free original message CL2.FreeMessage ( hMessage := hMsg ); hMsg := CAA.gc_hINVALID ; //work with hMsgCloned... END_IF InOut: Scope Name Type Comment Return CloneMessage CAA.HANDLE cloned message handle Input hMessage CAA.HANDLE handle of message to clone peError POINTER TO ERROR optional pointer to error enum
CreateIdAreaReceiver (FUN) ¶ FUNCTION CreateIdAreaReceiver : CAA.HANDLE This function creates a receiver to which several identifier areas may be added using the function RegisterIdArea . This receiver type is used if messages within a specific cobID area should be received. For receiving a message use the returned receiver handle for Read function call. There are two kind of receivers: Always Newest Receivers (xAlwaysNewest := TRUE): Receiver holds only the last received message. Receiver with Queue (xAlwaysNewest := FALSE): Receiver holds messages in chronological order. Note To avoid losing receive messages an application has to read all messages of a receiver each cycle. All messages should be processed and released by FreeMessage afterwards. Note Current implementation of this receiver type does not support 29 bit identifiers. Example VAR hDriver : CAA.HANDLE ; hReceiver : CAA.HANDLE ; hMsg : CAA.HANDLE ; ctMsgLeft : CAA.COUNT ; eError : CL2.ERROR ; END_VAR //Create an IdAreaReceiver hReceiver := CL2.CreateIdAreaReceiver ( hDriver := hDriver , //driver handle xAlwaysNewest := FALSE , //FALSE ==> receiver with queue; TRUE ==> only newest message eEvent := CB.EVENT.NO_EVENT , //no receive event xEnableSyncWindow := FALSE , //not implemented peError := ADR ( eError ) //optional pointer to error ); IF hReceiver <> CAA.gc_hINVALID THEN //Add an area for CANopen Emergency messages (cobId 16#81-16#9F) CL2.RegisterIdArea ( hReceiverId := hReceiver , //receiver cobIdStart := 16#81 , //start cobID cobIdEnd := 16#9F , //end cobID xRTRValue := FALSE , //no RTR messages xRTRMask := TRUE , //activate RTR filter ==> xRTRValue will be checked x29BitIdValue := FALSE , //no 29 bit CAN messages x29BitIdMask := TRUE , //activate 29 bit filter ==> x29BitIdValue will be checked xTransmitValue := FALSE , //only receive messages, no transmit message loopback xTransmitMask := TRUE //activate transmit mask filter ==> xTransmitValue will be checked ); END_IF REPEAT //receive a message from hReceiver hMsg := CL2.Read ( hReceiverId := hReceiver , pctMsgLeft := ADR ( ctMsgLeft ), peError := ADR ( eError )); IF hMsg <> CAA.gc_hINVALID THEN //TODO: Process message (CL2.GetMessageDataPointer, CL2.GetMessageId, ...) CL2.FreeMessage ( hMsg ); //release message hMsg := CAA.gc_hINVALID ; //to avoid using an already released message END_IF UNTIL ctMsgLeft = 0 END_REPEAT Optionally, an event can be registered which is triggered upon reception of a corresponding message. A callback function can be registerd via CB.RegisterCallback (CAA Callback library). Use event class CB.EVENT_CLASS.FIELDBUS , event source CB.EVENT_SOURCE.CB_DRIVER and any unassigned event number (see CB.EVENT ). Use the same event number for eEvent input. Input variable dwParam of the registered callback function contains the CAN ID of the received message. See CreateSingleIdReceiver for example code. Note Event mechanism is not supported on all systems. Futhermore it is not possible to register an event for extended identifiers (29bit). InOut: Scope Name Type Comment Return CreateIdAreaReceiver CAA.HANDLE new receiver handle or CAA.gc_hINVALID in case of failure Input hDriver CAA.HANDLE handle of CAN interface xAlwaysNewest BOOL TRUE: returns only the newest message; FALSE: receiver with queue. eEvent CB.EVENT trigger event when message received xEnableSyncWindow BOOL use SYNC window: not implemented ==> do not care peError POINTER TO ERROR optional pointer to error enum
IFBCommand (ITF) ¶ INTERFACE IFBCommand
Interfaces ¶ IFBCommand (Interface)
GetSupplierVersion (FUN) ¶ FUNCTION GetSupplierVersion : WORD InOut: Scope Name Type Return GetSupplierVersion WORD Input xDummy BOOL
VersionConstants (GVL) ¶ InOut: Scope Name Type Initial Constant gc_byVersion BYTE 1 gc_byVersion_1 BYTE 0
File and Project Information ¶ Scope Name Type Content FileHeader creationDateTime date 03.07.2017, 15:37:42 companyName string 3S-Smart Software Solutions GmbH libraryFile CAA_BehaviourModel.library primaryProject True productName CODESYS productProfile CODESYS V3.5 SP11 contentFile CAA_BehaviourModel.clean.json version version 2.0.0.0 ProjectInformation Depends on PS bool False Depends on RTS False Released True LastModificationDateTime date 03.07.2017, 15:37:40 LibraryCategories library-category-list Intern|CAA|Foundation Author string 3S - Smart Software Solutions GmbH Company CAA Technical Workgroup DefaultNamespace CBM Description See: Description DocFormat reStructuredText LanguageModelAttribute qualified-access-only Placeholder CAA Behaviour Model Project CAA_BehaviourModel Title CAA Behaviour Model SpecVersion version 3.0.0.0 Version 3.5.11.0
Library Reference ¶ This is a dictionary of all referenced libraries and their name spaces. CAA Tick Extern ¶ Library Identification ¶ Placeholder: CAA Tick Default Resolution: CAA Tick Extern, * (CAA Technical Workgroup) Namespace: TICKS Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CAA Tick CAA TickUtil Extern ¶ Library Identification ¶ Placeholder: CAA TickUtil Default Resolution: CAA TickUtil Extern, * (CAA Technical Workgroup) Namespace: TICKU Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CAA TickUtil CAA Types Extern ¶ Library Identification ¶ Placeholder: CAA Types Default Resolution: CAA Types Extern, * (CAA Technical Workgroup) Namespace: CAA Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CAA Types