Infosys在阅读器中打开 / AI 翻译

Target systems · 0 次阅读

ADS consumer

The ADS Consumer sample retrieves corrected timestamps as described in the ADS API.

Download

Here you can access the source code for this sample.

Start the TwinCAT target system with which the ADS Consumer sample is to communicate. The PLC Consumer sample can be used.
1. Unpack the downloaded ZIP file.
2. Open the included vcxproj file in Visual Studio.
3. Adjust the target AmsNetID. (TcExternalTimeAdsClient.cpp, line 119)
The sample is ready for operation.

Description

The sample code can be found in the CPP file TcExternalTimeAdsClient.cpp

Different UseCases for receiving corrected timestamps are illustrated in the Main() method:

  • Reading of the provider, the offset and the corrected timestamp from the system service for the different offsets: uncorrected(0), soft(1), medium(2), hard(3), plus an invalid value (4) to illustrate the error behavior.
  • Reading the corrected timestamps from a PLC program for the different offsets.
  • Reading the provider used and all providers.
  • Subscribing to a variable in the PLC; the time provided via notification has a corrected timestamp. The output takes place in the AdsNotificationCallback() method.