beautypg.com

Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 88

background image

Operating Functions

Chapter 5

5–51

When TIME is assigned a value with a LET statement (i.e. TIME

u 100),

only the integer portion of TIME is changed.

Example:

uCLOCK1

(enable REAL TIME CLOCK)

uCLOCK0

(disable REAL TIME CLOCK)

uPRINT TIME (display TIME)

3.315

uTIME = 0

(set TIME = 0)

uPRINT TIME (display TIME)

.315

(only the integer is changed)

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. Note that each count in internal memory location 71
(47H) represents 5 milliseconds of TIME.

Continuing with the example:

uDBY(71) = 0

(fraction of TIME = 0)

uPRINT TIME

0

uDBY(71) = 3

(fraction of TIME = 3, 15 ms)

uPRINT 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.

5.6.1
Special Function Operators
(continued)