BAComn_Global

{attribute 'global_init_slot' := '49800'}
{attribute 'qualified_only'}
VAR_GLOBAL CONSTANT
// Datatype Ranges:
 {warning disable C0196}
     nMinByte           : BYTE   := 16#00;
     nMaxByte           : BYTE   := 16#FF;
     nMinInt            : INT    := 16#8000;
     nMaxInt            : INT    := 16#7FFF;
     nMinUInt           : UINT   := 16#0000;
     nMaxUInt           : UINT   := 16#FFFF;
     nMinDInt           : DINT   := 16#80000000;
     nMaxDInt           : DINT   := 16#7FFFFFFF;
     nMinUDInt          : UDINT  := 16#00000000;
     nMaxUDInt          : UDINT  := 16#FFFFFFFF;
     fMinReal           : REAL   := -3.402823E+38;
     fMaxReal           : REAL   := 3.402823E+38;
     tMinTime           : TIME   := TO_TIME(0);
     tMaxTime           : TIME   := TO_TIME(16#FFFFFFFF);
     tMinTOD            : TOD    := TO_TOD(0);
     tMaxTOD            : TOD    := TO_TOD(16#FFFFFFFF);
     tMinDATE           : DATE   := TO_DATE(0);
     tMaxDATE           : DATE   := TO_DATE(16#FFFFFFFF);
     tMinDT             : DT     := TO_DT(0);
     tMaxDT             : DT     := TO_DT(16#FFFFFFFF);
 {warning restore C0196}

// I/O:
     nIO_RawMin         : INT     := 0;
     nIO_RawMax         : INT     := nMaxInt;
     nIO_Raw0V          : INT     := 0;                 // Raw value for 0V
     nIO_Raw1V          : INT     := (nIO_RawMax / 10); // Raw value for 1V 
     nIO_Raw2V          : INT     := (nIO_Raw1V * 2);   // Raw value for 2V 
     nIO_Raw3V          : INT     := (nIO_Raw1V * 3);   // Raw value for 3V 
     nIO_Raw5V          : INT     := (nIO_Raw1V * 5);   // Raw value for 5V 
     nIO_Raw10V         : INT     := (nIO_Raw1V * 10);  // Raw value for 10V 
END_VAR

// General:
VAR_GLOBAL CONSTANT
 {region 'Time'}
     nMilli2Sek         : UINT    := 1000;
     nSek2Min           : UINT    := 60;
     nMin2Hour          : UINT    := 60;
     n24Hour2Hour       : UDINT   := (24 * 60 * 60);
     n24Hour2Milli      : UDINT   := n24Hour2Hour * 1000;
     udiMaxSecInMilli   : UDINT   := (nMaxUDInt / nMilli2Sek);     // Max. capable value (in [s]) in a UDINT
     udiMaxMinInMilli   : UDINT   := (udiMaxSecInMilli / nSek2Min);// Max. capable value (in [m]) in a UDINT
 {endregion}
 {region 'Characters'}
     bChar_0            : BYTE    := 16#30;
     bChar_1            : BYTE    := 16#31;
     bChar_2            : BYTE    := 16#32;
     bChar_3            : BYTE    := 16#33;
     bChar_4            : BYTE    := 16#34;
     bChar_5            : BYTE    := 16#35;
     bChar_6            : BYTE    := 16#36;
     bChar_7            : BYTE    := 16#37;
     bChar_8            : BYTE    := 16#38;
     bChar_9            : BYTE    := 16#39;
     bChar_Plus         : BYTE    := 16#2B;
     bChar_Minus        : BYTE    := 16#2D;
     bChar_Dot          : BYTE    := 16#2E;
 {endregion}
 {region 'Type'}
     fCloseToZero       : REAL   := 0.00001;   // Comparison value to prevent a division by zero
 {endregion}
 {region 'ADS'}
     tAmsNetID_Loopback : T_AmsNetIdArr   := [ 127,0,0,1,1,1 ];
     sSymbolSeparator   : STRING(1)       := '.';
 {endregion}
END_VAR

Data type ranges

Name

Type

Description

nMinByte

BYTE

The smallest value that can be represented by the BYTE data type.

nMaxByte

BYTE

The largest value that can be represented by the BYTE data type.

nMinInt

INT

The smallest value that can be represented by the INT data type.

nMaxInt

INT

The largest value that can be represented by the INT data type.

nMinUint

UINT

The smallest value that can be represented by the UINT data type.

nMaxUint

UINT

The largest value that can be represented by the UINT data type.

nMinDint

DINT

The smallest value that can be represented by the DINT data type.

nMaxDint

DINT

The largest value that can be represented by the DINT data type.

nMinUdint

UDINT

The smallest value that can be represented by the UDINT data type.

nMaxUdint

UDINT

The largest value that can be represented by the UDINT data type.

fMinReal

REAL

The smallest value that can be represented by the REAL data type.

fMaxReal

REAL

The largest value that can be represented by the REAL data type.

tMinTime

TIME

The smallest value that can be represented by the TIME data type.

tMaxTime

TIME

The largest value that can be represented by the TIME data type.

tMinTOD

TOD

The smallest value that can be represented by the TOD data type.

tMaxTOD

TOD

The largest value that can be represented by the TOD data type.

tMinDate

DATE

The smallest value that can be represented by the DATE data type.

tMaxDate

DATE

The largest value that can be represented by the DATE data type.

tMinDT

DT

The smallest value that can be represented by the data type DT.

tMaxDT

DT

The largest value that can be represented by the data type DT.

I/O

Name

Type

Description

nIO_RawMin

INT

Lower raw value limit for analog I/O signals.

nIO_RawMax

INT

Upper raw value limit for analog I/O signals.

nIO_Raw0V

INT

Raw value for 0 V.

nIO_Raw1V

INT

Raw value for 1 V.

nIO_Raw2V

INT

Raw value for 2 V.

nIO_Raw3V

INT

Raw value for 3 V.

nIO_Raw5V

INT

Raw value for 5 V.

nIO_Raw10V

INT

Raw value for 10 V.

Time

Name

Type

Description

nMilli2Sek

UINT

Conversion factor from milliseconds to seconds.

nSek2Min

UINT

Conversion factor from seconds to minutes.

nMin2Hour

UINT

Conversion factor from minutes to hours.

n24Hour2Hour

UDINT

Number of seconds in a day.

n24Hour2Milli

UDINT

Number of milliseconds in a day.

udiMaxSecInMilli

UDINT

Maximum number of seconds representable in a UDINT when expressed in milliseconds.

udiMaxMinInMilli

UDINT

Maximum number of minutes representable in a UDINT when expressed in milliseconds.

Characters

Name

Type

Description

bChar_N

BYTE

ASCII code for the digit N (0–9).

bChar_Plus

BYTE

ASCII code for the plus sign.

bChar_Minus

BYTE

ASCII code for the minus sign.

bChar_Dot

BYTE

ASCII code for the period character.

Type

Name

Type

Description

fCloseToZero

REAL

A comparison value used to avoid division by a number close to zero.

ADS

Name

Type

Description

tAmsNetID_Loopback

T_AmsNetIdArr

Loopback AMS Net ID for ADS communication on the local destination.

sSymbolSeparator

STRING(1)

Separator for symbolic ADS paths.