4.13 REAL-TIME CLOCK COMMANDS
This section describes the commands related to the calendar and timer.
The system date and time are maintained by the calendar chip, and they can be retrieved
from or set to the calendar chip by the commands DATE$ and TIME$. A backup
rechargeable Lithium battery keeps the calendar chip running even when the power is
turned off.
The calendar chip automatically handles the leap year. The year field set to the
calendar chip must be in four-digit format.
Commands for triggering the HOUR_SHARP event, the MINUTE_SHARP event, and the
TIMER
event:
OFF
HOUR_SHARP GOSUB..., ON MINUTE_SHARP GOSUB..., and ON TIMER GOSUB...
Up to five timers can be set by the command ON TIMER... GOSUB... for the "TIMER
Event Trigger".
Note: The system time variable TIMER is maintained by CPU timers and has nothing to
do with this calendar chip. Accuracy of this time variable depends on the CPU clock
and is not suitable for precise time manipulation. Besides, it is reset to 0 upon
powering up (as a cold start).
DATE$
Purpose
To set or to get the current date.
Syntax
DATE$ = X$
Y$ = DATE$
Remarks
DATE$ = X$, to set the current date.
"X$" is a string variable in the form of "yyyymmdd".
Y$ = DATE$, to get the current date, in the form of "yyyymmdd".
"Y$" is a string variable to be assigned to the result.
Note that the BASIC Compiler and its Run-time Engines do not check the
format and contents of the string to be assigned to DATE$. User is obliged to
check the format and contents.
Example
DATE$ = "20000103"
Today$ = DATE$
PRINT Today$
...
HOUR_SHARP,
OFF
Chapter 4
MINUTE_SHARP,
' set the system date to 2000/01/03
' assign the current date to Today$
' Today$ = "20000103"
BASIC Commands
OFF
TIMER,
ON
107
Need help?
Do you have a question about the 8 Series and is the answer not in the manual?