Constants

Port numbers

Port numbers

Value

Description

AMSPORT_LOGGER

100

Port number of the Standard-Logger.

AMSPORT_EVENTLOG

110

Port number of the TwinCAT Eventlogger.

AMSPORT_R0_RTIME

200

Port number of the TwinCAT Realtime Server.

AMSPORT_R0_IO

300

Port number of the TwinCAT I/O Server.

AMSPORT_R0_NC

500

Port number of the TwinCAT NC Server.

AMSPORT_R0_NCSAF

501

Port number of the TwinCAT NC Serves (Task SAF).

AMSPORT_R0_NCSVB

511

Port number of the TwinCAT NC Server (Task SVB).

AMSPORT_R0_ISG

550

internal

AMSPORT_R0_CNC

600

Port number of the TwinCAT NC I Server.

AMSPORT_R0_LINE

700

internal

AMSPORT_R0_PLC

800

Port number of the TwinCAT PLC Servers (only on the Buscontroller).

AMSPORT_R0_PLC_RTS1

801

Port number of the TwinCAT 2.xx PLC Server runtime 1

AMSPORT_R0_PLC_RTS2

811

Port number of the TwinCAT 2.xx PLC Server runtime 2

AMSPORT_R0_PLC_RTS3

821

Port number of the TwinCAT 2.xx PLC Server runtime 3

AMSPORT_R0_PLC_RTS4

831

Port number of the TwinCAT 2.xx PLC Server runtime 4

AMSPORT_R0_CAM

900

Port number of the TwinCAT CAM Server.

AMSPORT_R0_CAMTOOL

950

Port number of the TwinCAT CAMTOOL Server.

AMSPORT_R3_SYSSERV

10000

Port number of the TwinCAT System Service.

AMSPORT_R3_SCOPESERVER

14001

Port number of the TwinCAT Scope Server.

Ads-States

ADS States

Value

Description

ADSSTATE_INVALID

0

ADS Status: invalid

ADSSTATE_IDLE

1

ADS Status: idle

ADSSTATE_RESET

2

ADS Status: reset.

ADSSTATE_INIT

3

ADS Status: init

ADSSTATE_START

4

ADS Status: start

ADSSTATE_RUN

5

ADS Status: run

ADSSTATE_STOP

6

ADS Status: stop

ADSSTATE_SAVECFG

7

ADS Status: save configuration

ADSSTATE_LOADCFG

8

ADS Status: load configuration

ADSSTATE_POWERFAILURE

9

ADS Status: Power failure

ADSSTATE_POWERGOOD

10

ADS Status: Power good

ADSSTATE_ERROR

11

ADS Status: Error

ADSSTATE_SHUTDOWN

12

ADS Status: Shutdown

ADSSTATE_SUSPEND

13

ADS Status: Suspend

ADSSTATE_RESUME

14

ADS Status: Resume

ADSSTATE_CONFIG

15

ADS Status: Configuration (System is in config mode)

ADSSTATE_RECONFIG

16

ADS Status: Reconfiguration (System should restart in config mode)

ADSSTATE_STOPPING

17

 

ADSSTATE_INCOMPATIBLE

18

 

ADSSTATE_EXCEPTION

19

 

ADSSTATE_MAXSTATES

20

Max. number of available ads states

ADS/System Services

Reserved Index Groups

Value

Description

ADSIGRP_SYMTAB

16#F000

 

ADSIGRP_SYMNAME

16#F001

 

ADSIGRP_SYMVAL

16#F002

 

ADSIGRP_SYM_HNDBYNAME

16#F003

 

ADSIGRP_SYM_VALBYNAME

16#F004

 

ADSIGRP_SYM_VALBYHND

16#F005

 

ADSIGRP_SYM_RELEASEHND

16#F006

 

ADSIGRP_SYM_INFOBYNAME

16#F007

 

ADSIGRP_SYM_VERSION

16#F008

 

ADSIGRP_SYM_INFOBYNAMEEX

16#F009

 

ADSIGRP_SYM_DOWNLOAD

16#F00A

 

ADSIGRP_SYM_UPLOAD

16#F00B

 

ADSIGRP_SYM_UPLOADINFO

16#F00C

 

ADSIGRP_SYMNOTE

16#F010

 

ADSIGRP_IOIMAGE_RWIB

16#F020

 

ADSIGRP_IOIMAGE_RWIX

16#F021

 

ADSIGRP_IOIMAGE_RISIZE

16#F025

 

ADSIGRP_IOIMAGE_RWOB

16#F030

 

ADSIGRP_IOIMAGE_RWOX

16#F031

 

ADSIGRP_IOIMAGE_RWOSIZE

16#F035

 

ADSIGRP_IOIMAGE_CLEARI

16#F040

 

ADSIGRP_IOIMAGE_CLEARO

16#F050

 

ADSIGRP_IOIMAGE_RWIOB

16#F060

 

ADSIGRP_DEVICE_DATA

16#F100

 

ADSIOFFS_DEVDATA_ADSSTATE

16#0000

 

ADSIOFFS_DEVDATA_DEVSTATE

16#0002

 

System Service File Service

System Service Index Groups

Value

Description

SYSTEMSERVICE_OPENCREATE

100

 

SYSTEMSERVICE_OPENREAD

101

 

SYSTEMSERVICE_OPENWRITE

102

 

SYSTEMSERVICE_CREATEFILE

110

 

SYSTEMSERVICE_CLOSEHANDLE

111

 

SYSTEMSERVICE_FOPEN

120

 

SYSTEMSERVICE_FCLOSE

121

 

SYSTEMSERVICE_FREAD

122

 

SYSTEMSERVICE_FWRITE

123

 

SYSTEMSERVICE_FSEEK

124

 

SYSTEMSERVICE_FTELL

125

 

SYSTEMSERVICE_FGETS

126

 

SYSTEMSERVICE_FPUTS

127

 

SYSTEMSERVICE_FSCANF

128

 

SYSTEMSERVICE_FPRINTF

129

 

SYSTEMSERVICE_FEOF

130

 

SYSTEMSERVICE_FDELETE

131

 

SYSTEMSERVICE_FRENAME

132

 

SYSTEMSERVICE_REG_HKEYLOCALMACHINE

200

 

SYSTEMSERVICE_SENDEMAIL

300

 

SYSTEMSERVICE_TIMESERVICES

400

 

SYSTEMSERVICE_STARTPROCESS

500

 

SYSTEMSERVICE_CHANGENETID

600

 

System Servie Timeservices

System Service Index Offsets (Timeservices)

Value

Description

TIMESERVICE_DATEANDTIME

1

 

TIMESERVICE_SYSTEMTIMES

2

 

TIMESERVICE_RTCTIMEDIFF

3

 

TIMESERVICE_ADJUSTTIMETORTC

4

 

ADSLOG message types

Masks for log output

Value

Description

ADSLOG_MSGTYPE_HINT

16#01

 

ADSLOG_MSGTYPE_WARN

16#02

 

ADSLOG_MSGTYPE_ERROR

16#04

 

ADSLOG_MSGTYPE_LOG

16#10

 

ADSLOG_MSGTYPE_MSGBOX

16#20

 

ADSLOG_MSGTYPE_RESOURCE

16#40

 

ADSLOG_MSGTYPE_STRING

16#80

 

BOOTDATA flags

Masks for Bootdata flags

Value

Description

BOOTDATAFLAGS_RETAIN_LOADED

16#01

 

BOOTDATAFLAGS_RETAIN_INVALID

16#02

 

BOOTDATAFLAGS_RETAIN_REQUESTED

16#04

 

BOOTDATAFLAGS_PERSISTENT_LOADED

16#10

 

BOOTDATAFLAGS_PERSISTENT_INVALID

16#20

 

Masks for BSOD flags

Value

Description

SYSTEMSTATEFLAGS_BSOD

16#01

BSOD: Blue Screen of Death

SYSTEMSTATEFLAGS_RTVIOLATION

16#02

Realtime violation latency overrun

File output modes

Masks for File output

Value

Description

FOPEN_MODEREAD

16#0001

'r': Opens file for reading

FOPEN_MODEWRITE

16#0002

'w': Opens file for reading, (possible) existing files were overwritten.

FOPEN_MODEAPPEND

16#0004

'a': Opens file for reading, is attached to (possible) existing file. If no file existes, it will be created.

FOPEN_MODEPLUS

16#0008

'+': Opens file for reading and writing.

FOPEN_MODEBINARY

16#0010

'b': Opens file forbinary reading and writing.

FOPEN_MODETEXT

16#0020

't': Opens file for textual reading and writing:

Eventlogger constants

Masks for Eventlogger Flags

Value

Description

TCEVENTFLAG_PRIOCLASS

16#0010

Class and priority are defined by the formatter

TCEVENTFLAG_FMTSELF

16#0020

The formatting information comes with the event

TCEVENTFLAG_LOG

16#0040

Logg.

TCEVENTFLAG_MSGBOX

16#0080

Show message box.

TCEVENTFLAG_SRCID

16#0100

Use Source-Id instead of Source name.

TwinCAT Eventlogger Status messages

Value

Description

TCEVENTSTATE_INVALID

16#0000

Not valid, occurs also if the event was not reported.

TCEVENTSTATE_SIGNALED

16#0001

Event is reported, but neither signed off or acknowledged..

TCEVENTSTATE_RESET

16#0002

Event is signed off ('gone').

TCEVENTSTATE_CONFIRMED

16#0010

Event is acknowledged.

TCEVENTSTATE_RESETCON

16#0012

Event is signed off and acknowledged

TwinCAT Eventlogger Status messages

Value

Description

TCEVENT_SRCNAMESIZE

15

Max. Length for the Source name.

TCEVENT_FMTPRGSIZE

31

Max. Length for the name of the formatter.

Other

Value

Description

PI

3.1415926535897932384626433832795

Pi number

DEFAULT_ADS_TIMEOUT

T#5s

Default ADS timeout

MAX_STRING_LENGTH

255

The max. string length of T_MaxString data type

Requirements

Development environment

Target system type

PLC libraries to include (Category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_System (System)