C++ provider

The C++ provider sample determines an offset and stores it in the TwinCAT system so that it can be used by the consumers.

Download

Here you can access the source code for this sample.

1. Unpack the downloaded .zip file.
2. Open the .zip file that it contains in TwinCAT 3 by clicking on Open Project ….
3. Select your target system.
4. Build the sample on your local machine (e.g. Build->Build Solution).
5. Activate the configuration by clicking on C++ provider 1:.
The sample is ready for operation.

Description

The offset provider receives the offset to be provided as DataArea "ExternalTime.nOffset“. This is transferred to the TwinCAT system as a TimeType medium, which can also be configured at runtime under Parameter (Init).

In the CycleUpdate() method, the SetExternalTimeOffset method is used for this after a corresponding register has been created using RegisterExternalTimeProvider for a TimeType.