
CALENDAR/CLOCK CHAPTER 7
7-8
CHAPTER SYNOPSIS
Initializing and using the RTC
Y2K and Y2.4K issues
Using clock interr upts
DESCRIPTION
CALENDAR/CLOCK CHAPTER 7
The RPC -2350 has a battery backed Calendar/clock.
When used in conjunction with the DATE$ and TIME$
commands, the current date and time can be set and
read. It is accurate to 1 minute/month at 25°C and is not
adjustable.
The clock data sheet is in the applications disk. See
RTC72412.PDF.
SETTING DATE AND TIME
The clock must be turned on before it is used. This need
be done only once. To turn on the clock, type:
CONFIG CLOCK 1
The date and time can be set while running a program or
in the immediate mode. Date and time are treated as
strings and not numbers. To set the date and time:
date$="04-19-99"
time$="13:56:00"
To retrieve date and time as part of a program:
2000 DA$ = DATE$(0)
2010 TI$ = TIME$(0)
You can also print the d ate and time in the immediate
mode:
pr time$(0)
13:56:03
YEAR 2000 AND BEYOND
The clock on the RPC-2350G is year 2000 compliant
under the following condition:
Date is always returned as the last two digits of the
year. The first two digits, “19" or “20" must be
programm ed into your system. As of the time this
manual was written, this required a quick check on
the year. If it w as not “ 99", then you assum ed it
was some time in the 20' s.
The clock will roll over on December 31, 1999 at
23:59: 59 to January 1, 2000 with no problem s.
CAM BASIC operating system does not use or need any
real time clock values for its operation. A clock is not
needed in order for CAMBASIC to operate.
The clock compensates for leap year in 2000. Should
you expect this produc t to work into the 22nd century, it
will add a leap day in the year 2100 also. This, of
course, is not supposed to happen until the year 2400. If
you think your program will be working in the year
2100, you will have to compensate for this by resetting
the date when read as February 29, 2100 to M arch 1,
2100.
CLOCK INTERRUPTS
The RT C may be program med to generate interrupts at 1
second, 1 minute, or 1 hour intervals. L onger interrupt
intervals are convenient especially when ON TICK
interrupts are running.
An interrupt is generated when the real time clock
counters increment the unit of time selected for the
interrupt interval. Most of the time, the first interrupt
will be shorter than the interval period selected. For
example, suppose you want to interrupt every minute. If
the real time clock' s seconds were at 45 , the fir st
interrupt will occur in 15 seconds. Interrupts will then
occur every m inute. Operation is similar for hour ly
interrupts.
The clock is progr amm ed to interr upt at specific
intervals in software. See CLOCK1.BA S for example
program.
Jumper W 10 to enable interrupts.
Comentários a estes Manuais