AMS Header

Data array

Size

Description

AMSNetId Target  

6 bytes

This is the AMS NetId of the station, for which the packet is intended. Remarks see below.

AMSPort Target  

2 bytes

This is the AMSPort of the station, for which the packet is intended.

AMSNetId Source

6 bytes

This contains the AMSNetId of the station, from which the packet was sent.

AMSPort Source

2 bytes

This contains the AMSPort of the station, from which the packet was sent.

Command Id

2 bytes

see below.

State Flags

2 bytes

see below.

Data Length

4 bytes

Size of the data range. The unit is byte.

Error Code

4 bytes

AMS error number. See ADS Return Codes.

Invoke Id

4 bytes

Free usable 32 bit array. Usually this array serves to send an Id. This Id makes is possible to assign a received response to a request, which was sent before.

Data

n bytes

Data range. The data range contains the parameter of the considering ADS commands.

AMS Net Id

AMS Net Id

The AMSNetId consists of 6 bytes and addresses the transmitter or receiver. One possible AMSNetId would be e.g.. 172.16.17.10.1.1. The storage arrangement in this example is as follows:

The AMSNetId is purely logical and has usually no relation to the IP address. The AMSNetId is configurated at the target system. At the PC for this the TwinCAT System Control is used. If you use other hardware, see the considering documentation for notes about settings of the AMS NetId.

Command Id

Cmd

Description

0x0000

Invalid

0x0001

ADS Read Device Info

0x0002

ADS Read

0x0003

ADS Write

0x0004

ADS Read State

0x0005

ADS Write Control

0x0006

ADS Add Device Notification

0x0007

ADS Delete Device Notification

0x0008

ADS Device Notification

0x0009

ADS Read Write

Other commands are not defined or are used internally. Therefore the Command Id  is only allowed to contain the above enumerated values!

State Flags

Flag

Description

0x0001

0: Request / 1: Response

0x0004

ADS command

The first bit marks, whether it´s a request or response. The third bit must be set to 1, to exchange data with ADS commands. The other bits are not defined or were used for other internal purposes.

Therefore, the other bits must be set to 0!

Flag

Description

0x000x

TCP Protocol

0x004x

UDP Protocol

Bit number 7 marks, if it should be transfered with TCP or UDP.