6.5.5 Constants
GM Programmer allows the use of constants.
Constants are declared according to the following syntax.
V
AR CONSTANT
Constant name:Type:=Default value;
END_VAR
Type Constant type Description
BOOL BOOL TRUE (1), FALSE (0)
Integer
Types that can be used
as numerical values
Binary, octal, decimal, and hexadecimal numbers
For numbers other than decimal numbers, integer constants are
entered after number base and #.
Examples: 14, 2#0101, 8#27, 16#34AB
Decimals and
exponents
REAL / LREAL
Decimals and exponents
Examples: 1.4, 2.34e+008
Time TIME
32-bit time constants compliant with IEC 61131-3
Syntax: t#, T#, time#, TIME#
Examples: T#12ms, T#12h32m24s
Time LTIME
64-bit time constants
In addition to TIME constants, the following units can be used.
Microsecond: m
Nanosecond: ns
Syntax: L
TIME#
Example: LTIME#123m456ns
Time TIME_OF_DAY
Time
Syntax: tod#, T
OD#, time_of_day#, TIME_OF_DAY#
Example: tod#12:24:20.123
Date DATE
Date
Syntax: d#, D#, date#, DA
TE#
Example: d#2018-01-01
Date and time DATE_AND_TIME
Date and time
Syntax: dt#, DT#, date_and_time#, DA
TE_AND_TIME#
Example: dt#2018-01-01-07:04:13
Character
string
STRING, WSTRING
Enclosed with single quotation marks
Example: ’Hello W
orld’
6.5.6 Object for Global Variable Declaration
GM Programmer allows the use of global variables that can be used within the entire project.
■
Global variable list
This is an object for declaring global variables.
6.5 Variables
6-24 WUME-GM1RTXOP-01