Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 40

Advertising
background image

Publication 1746-RM001A-US-P

3-18 Expressions and Operators

You can change the fraction portion of TIME by manipulating the contents of
internal memory location 71 (47H). You can do this by using a DBY(71)
statement. Each count in internal memory location 71 (47H) represents 5
milliseconds of TIME.

Continuing with the example:

>DBY(71) = 0

(fraction of TIME = 0)

>PRINT TIME

0

>DBY(71) = 3

(fraction of TIME = 3*5ms = 15 ms)

>PRINT TIME

1.5 E–2

Only the integer portion of TIME changes when a value is assigned. This allows
you to generate accurate time intervals. For example, if you want to create an
accurate 12-hour clock: there are 43200 seconds in a 12-hour period, so an
ONTIME 43200, [ln num] statement is used. When the TIME interrupt occurs,
the statement TIME 0 is executed, but the millisecond counter is not re-assigned a
value. If interrupt latency exceeds 5 milliseconds, the clock remains accurate.

Advertising