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
CAA Callback Extern Library Documentation ¶ Company CAA Technical Workgroup Title CAA Callback Extern Version 3.5.11.0 Categories Intern|CAA|Runtime Namespace CB Author 3S - Smart Software Solutions GmbH Placeholder CAA Callback Description 1 ¶ In the runtime system different events occur. Each event can be assigned to an event class. Further on each event arises from a certain source. The runtime system has an internal list of registered callback definitions. At each occurring event the runtime system checks its list of callback definitions and if applicable calls a callback function. A callback definition consists of: Event Event class Event source Index of the function which should be called as soon as the event occurs. Event e of class c from source s triggers the callback (e, c, s), if ( e = e OR e = CB.ALL_EVENTS ) AND (( c AND c ) > 0 OR c = CB.ALL_CLASSES ) AND ( s = s OR s = CB.ALL_SOURCES ) A function which should be used as callback function, must have the following interface: FUNCTION Callback < Name > : BOOL VAR_INPUT dwSpec : DWORD ; (* CB.Event and CB.EventClass *) dwParam : DWORD ; (* Application specific Parameter *) dwSource : DWORD ; (* CB.EventSource *) END_VAR The data types are DWORDs in order to be compatible to CODESYS V2.3. These however refer to the enumerations specified in brackets. Parameter dwSpec via function CB.DecodeEvent and CB.DecodeClass can be split in two variables of type CB.Event and CB.EventClass. The parameter dwSource can be converted to data type CB.EventSource with the help of the DWORD_TO_INT conversion. Note CODESYS V3.x: As from CODESYS 3.x the POUs are not addressed any longer by an index. Due to this fact the structure and the interpretation of the CB_Callback data type must be adapted correspondingly. The interface of function CallFunctionByIndex also changes. Note On the structure and usage of the callback functions: The function name must have a prefix „Callback”. The function must not contain any local variables. The function must not be checked with breakpoints. Note CODESYS V3.x: The function muss be parameterized with property Enable system call ! Multiple callbacks may be assigned to one event. A callback (event, -class, -source, function index) however can get registered only once; if one tries to assign an identical callback, CB_RegisterCallback will dump an error. After a reset of the PLC all registered callbacks will be deregistered immediately. Callbacks, which are possible registered on event CB_AFTER_RESET, will be called once more before the automatic deregistration. Regard that callback functions can be called immediately after the event has occurred. Thereby an currently running IEC task can be interrupted. The programmer must be aware that this might raise similar problems like there are in multitasking systems (data consistency etc.); besides that the run time of a callback function should be kept as short as possible, because it blocks the whole system. The return value of the callback function is of no significance . Contents: ¶ CAA Callback Enums Functions Globale Constants Structs Library Information GetLibVersion (Function) GetLibVersionNumber (Function) IsLibReleased (Function) Indices and tables ¶ 1 Based on CAA_Callback_Extern.library, last modified 03.07.2017, 15:37:46. LibDoc 4.4.0.0-b.27 The content file CAA_Callback_Extern.clean.json was generated with CODESYS V3.5 SP11 on 03.07.2017, 15:37:49.