
CALENDAR/CLOCK CHAPTER 7
Page 22
DESCRIPTION
The RPC-52 has a built in battery backed
Calendar/clock. When used in conjunction with the
DATE and TIME commands, the current date and time
can be set and read. Additionally, the clock can be
programm ed to interr upt the CP U at specific intervals
with a 1 second resolution.
Battery life depends upon the power consumption of
RAM in U3 and the time the board is on. Generally,
you can expect a battery life of 5 to 10 years.
The clock chip, U14, contains a built in cr ystal.
Accuracy is about 1 minute/month and is not adjustable.
Hours are expressed in 24-hour fo rma t.
Refer to the RPBASIC-52 Software Supplement for
more command information.
SETTING DATE AND TIME
The date and time can be set while running a program or
in the immediate mode. Date and time are treated as
numbers and not strings. To set the date and time:
DATE 5,22,93
TIME 13,23,43
The time is set to 1:23:43 PM.
To retrieve date and time as part of a program:
100 PRINT "Time: ",
110 FOR N=0 TO 2
120 PRINT TIME(N),
130 NEXT
140 PRINT "Date: ",
150 FOR N=0 TO 2
160 PRINT DATE(N),
170 NEXT
180 PRINT CR,
190 GOTO 100
run
Time: 13 24 12 Date: 5 22 93
GENERATING INTERRUPTS
The clock chip generates an interrupt every second,
minute, or hour . T hese interrupts m ay be used in
conjunction with the ONTICK construct. Clock
interrupts are captured using ONTIME construct. Refer
to the RPBASIC-52 Software Supplement in this manual
for more information about ONTIME.
COMMANDS
The following is a list of RPBASIC-52 commands for
the calendar/clock.
Command Function
DATE Sets date
DATE(n) Returns date
TIME Sets time
TIME(n) Returns time
ONTIME Interrupt handler
Kommentare zu diesen Handbüchern