Synchronization of an Application Task with the I/O Update¶
CANOPEN implements the synchronization (SYNC) protocol which is used to synchronize the I/O update of the CANOPEN slaves. It can also be used to synchronize the I/O update with the execution of an application task.
When the Sync message is sent the Communication Module generates an interrupt. This will trigger the execution of an associated application task.
The described functionality is supported as of the following firmware versions of PLC and Communication Module:
For CM578-CN
- PLC Version: V1.3.0
- Communication Module Version: V1.100 10.02.2009
For CM598-CN
- PLC Version: V2.5.3
- Communication Module Version: V2.0.0.2
The picture below gives a schematic overview of the synchronization between I/O update and execution of an application task:
The CAN_SYNC_TIME is the time between 2 messages of the synchronization protocol. This time has to be chosen long enough to update the IOs and execute the application task within this time.
The execution time required by the application task can be checked online in the CoDeSys task configuration.
Note
The tasks which are triggered with the CANsync interrupt have to be a higher priority than tasks which are running cyclically.
Note
If other communication modules are attached to the same CPU, the MIN_UPDATE_TIME of those communication modules must be larger than the MIN_UPDATE_TIME of the CANsync communication module.
Note
The online overview of the task configuration will display implausible values of the CANsync task. This will not influence the functionality.
Synchronization settings
- Parameter CANopen Sync mode has to be set to the value Sync Bus and Task.
- Checkbox Enable Sync Producing has to be enabled in the CANOPEN configuration.
- At least one PDO should have a transmission mode of type cyclic - synchronous (1-240).
- An application task has to be defined and linked with the associated external event.
Event | Coupler Slot | Description |
---|---|---|
Int_Coupler0_ InputAny | 0 | application task will be triggered by IO update of Coupler at Slot 1 - 6. |
Ext Coupler <slot> InputAny | 1 … 6 | application task will be triggered by IO update of Coupler at Slot 1 - 6. |