Synchronization Object (SYNC)¶
The Sync-Producer provides the synchronization-signal for the Sync-Consumer. When the Sync-Consumer receive the signal they start carrying out their synchronous tasks.
In general, the fixing of the transmission time of synchronous PDO messages coupled with the periodicity of transmission of the Sync Object guarantees that sensor devices may arrange to sample process variables and that actuator devices may apply their actuation in a coordinated fashion.
The identifier of the Sync Object is available at index 1005h.
Examples¶
Use the canopen.Network.sync attribute to start and stop the SYNC
message:
# Transmit every 10 ms
network.sync.start(0.01)
network.sync.stop()
API¶
- class canopen.sync.SyncProducer(network)[source]¶
Transmits a SYNC message periodically.
- cob_id = 128¶
COB-ID of the SYNC message
- start(period=None)[source]¶
Start periodic transmission of SYNC message in a background thread.
- Parameters:
period (
Optional[float]) – Period of SYNC message in seconds.- Raises:
RuntimeError – If a periodic transmission is already started.
ValueError – If no period is set via argument nor the instance attribute.
- transmit(count=None)[source]¶
Send out a SYNC message once.
- Parameters:
- Raises:
ValueError – If the counter value does not fit in one byte.