Summary of ADS devices

An object that has implemented the ADS interface (thus being accessible via ADS) and that offers "server services", is known as an ADS device. The detailed meaning of an ADS service is specific to each ADS device, and is described in the relevant ADS device documentation:

  • TwinCAT ADS Interface PLC
  • TwinCAT ADS Interface NC
  • TwinCAT ADS Device CAM (cam controller)
  • TwinCAT ADS COM Server for ControlNET (with SST 5136 CN PC Card)
  • .....


TwinCAT System Service

The TwinCAT System Service offers an interface for the TwinCAT server for Windows NT services. At present, data access and "System Shutdown" are supported. Refer to the documentation for the ADS DLL and for the ADS OCX for further explanations of ADS services.

File access

Files can be opened or closed, read and written via ADS index group and ADS index offset. The index groups and index offsets are described below.

Process | Description
Open/create file Indexgroup: SYSTEMSERVICE_OPENCREATE= 100 Indexoffset: SYSTEMSERVICE_OPENGENERIC = 1 | The stated file is opened for read and write access. If the file does not exist, a file is created and opened. If the file exists, it is opened and the contents are deleted. ADS Service: ADS Write Parameter: Length of the path name Path name as a character string Return value: If successful: file handle for the opened file In the event of an error: -1
Opening file for reading Indexgroup: SYSTEMSERVICE_OPENREAD = 101 Indexoffset: SYSTEMSERVICE_OPENGENERIC = 1 | The stated field is opened for read access. If the file does not exist, the service returns the value -1. ADS service: ADS Write Parameter: Length of the path name Path name as a character string Return value If successful: file handle for the opened file In the event of an error: -1
Opening file for writing Indexgroup: SYSTEMSERVICE_OPENWRITE = 102 Indexoffset: SYSTEMSERVICE_OPENGENERIC = 1 | The stated file is opened for read and write access. If the file does not exist, the service returns the value -1. If the file exists. it is opened and the contents are deleted. ADS service: ADS Write Parameter: Length of the path name Path name as a character string Return value If successful: file handle for the opened file In the event of an error: -1
Close file Indexgroup: File Handle Indexoffset: SYSTEMSERVICE_NOSEEK = -1 | The file which belongs to the File Handle is closed. It must be noted that the data length for this service must be 0! ADS service: ADS Write Data length: 0
Write data to file Indexgroup: File Handle Indexoffset: SYSTEMSERVICE_NOSEEK = -1 or Seek Offset in byte | The number of bytes stated in the data length is written to the file. If an index offset is not equal to -1, the index offset is interpreted as the offset in the file. The number of written bytes is returned by this service in the reply. In the event of an error, the service returns the value -1. ADS service: ADS Write Data length: number of bytes to bewritten.
Read data from file Indexgroup: File Handle Indexoffset: SYSTEMSERVICE_NOSEEK = -1 or Seek Offset in byte | The number of bytes stated in the data length is read from the file. If the index offset is unequal to -1, the index offset is interpreted as the offset in the file. With a data length of 0, only the file indicator in the file is offset by the value in the index offset. The number of read bytes is returned by this service in the reply. In the event of an error, the services returns the value -1. ADS service: ADS Read Data length: number of bytes to be read.
System shutdown | ADS WriteControl enables the TwinCAT System Service to be instructed to shut down the operating system. ADS service: ADS WriteControl AdsState: ADSSTATE_SHUTDOWN = 12 DeviceState: Shutdown of Windows NT with DEVICESTATE = 0, restart of Windows NT with DEVICESTATE = 1 DeviceData: timeout in seconds until system shutdown Data length: 4 bytes


TwinCAT ADS Interface: Scope

TwinCAT ADS Interface: Scope

The TwinCAT Scope provides an ADS-interface to act like an ADS-device. The commands described here can be used to operate Scope View.

Since a fixed ADS port is required for this, only the first instance of the Scope can be operated via ADS.

TwinCAT Scope : ADS port 14000 (decimal)

Index-Group ( Hex ) | Description | Remark
0x00001000 | Scope Root States |
0x00002000 | Scope Root Functions |
0x00003000 | Scope View |

Scope Root States

Index-Offset ( Hex ) | Access | Data type | Physical unit | Scope of Definition | Description | Remark
0x00000001 | Read | BYTE |  |  | Get Online Mode 0: Scope is offline 1: Scope is online |
0x00000001 | Write | void |  |  | Set Scope to Online Mode |
0x00000002 | Write | void |  |  | Set Scope to Offline Mode |

Scope Root Functions

Index-Offset ( Hex ) | Access | Data type | Physical unit | Scope of Definition | Description | Remark
0x00000001 | Write | char[] |  |  | Load *.scp File ( Scope Configuration Project ) | D:\\TwinCAT\\scope\\achse2.scp

Scope View

Index-Offset ( Hex ) | Access | Data type | Physical unit | Scope of Definition | Description | Remark
0x00000100 + Id | Write | void |  |  | Manual Trigger | Issuing this command triggers the Scope. It must, however, be online.
0x00000200 + Id | Read/Write | Real64 |  |  | Record Length | Specifies the duration of the recording
0x00001000 + Id | Write | char[] |  |  | Export data as an ASCII file | D:\\TwinCAT\\Scope\\Data\\Test.dat
0x00001010 + Id | Write | char[] |  |  | Export ScopeView |

Note:

The Scope View properties can currently only be used if only one view is active in the application. In other words, the ID is always 1.