Literals
Return to Introduction  Previous page  Next page

 

With LadderWORK ARM user can define constants using the standard IEC / CEI 1131-3 notation. We can distinguish numerical constants and time costants.

A literal constant must be used with the IDENT component.

 

Base 2, base 8 and base 16 notation

 

Numbers in base 2,8 and 16, start respectively with the prefix 2#, 8# and 16# . The number, expressed in the specified base follow. For clarity, the underscore character '_' could be used to separate part of the number. This is useful, for example, for binary numbers.

Numerical constants

 

 

Examples

 

100

Decimal 100

+100

Decimal 100

2#10000001

Hex 81, Decimal 129

2#1000_0001

Hex 81, Decimal 129

8#10

Octal 10, Decimal 8

16#FFFF

Hex FFFF, Decimal 65535

-276

Integer decimal -276

65535

Integer decimal 65535

TRUE

1

FALSE

0

       

 

Time constants

 

A time literal is used whenever you need to program a specified time. A time literal always begin with one of these prefix T#, t#, TIME# or time#. After this prefix a time specification string follow. A lot of standard suffix defines the time in the desired unit. Between single time specifier you can use the underscore character '_' to increase literal readability.

 

Time unit suffix

Meaning

 

 

ms

milliseconds

s

seconds

m

minutes

h

hours

d

days

 

Examples

 

TIME#14.73ms

Time duration specification 14.73 milliseconds

time#14.73ms

Time duration specification 14.73 milliseconds

t#14.73ms

Time duration specification 14.73 milliseconds

T#14.73ms

Time duration specification 14.73 milliseconds

t#6m_34s_15ms

Time duration is : 6 minutes, 34 seconds and 15 milliseconds

time#1h30m

Time is : 1 hour and half

TIME#4d_5h_34m_10s_25ms

Time is : 4 days, 5 hours, 34 minutes, 10 seconds and 25 milliseconds