Calendar/clock chapter 7 – Remote Processing RPC-52 User Manual
Page 24
CALENDAR/CLOCK
CHAPTER 7
Page 22
DESCRIPTION
The RPC-52 has a built in battery backed
Calendar/ clock. When used in conjunction with the
D A T E a nd T IM E c o m m an d s, t h e c u r re n t d a te a nd ti m e
can be set and read. A dditionally, the clock can be
progr amm ed to interr upt the CP U at spec ific intervals
with a 1 second resolution.
Battery life depends upon the power consumption of
RAM in U3 and the time the board is on. Gener ally,
you can expect a batter y life of 5 to 10 years.
The cloc k chip, U14, contains a built in cr ystal.
Accuracy is about 1 minute/month and is not adjustable.
Hour s are exp ressed in 2 4-hour fo rma t.
Refer to the RPBASIC -52 Software Supplement for
more com mand 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.
T o r et r ie v e d a te a nd ti m e a s pa r t o f a p r o gr a m :
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 inter rupts m ay be used in
conjunction with the ONTICK construct. Clock
interrupts are captured using ONTIM E 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.
Comm and
Function
DATE
Sets date
DAT E(n)
Return s date
T I M E
S e ts ti m e
TIME (n)
R e tu r n s t im e
O N T IM E
Interrupt handler