SM8580AM
NIPPON PRECISION CIRCUITS—22
APPLICATION NOTES
Setting the Alarm
Alarms can be set for day, weekday, hour, minute,
and second. However, it is not possible to set an
alarm for more than one weekday.
Note that it is recommended that AF and AIE be set
to 0 at the same time to avoid accidental hardware
interrupts while setting the alarm. After the alarm
data is entered, initialization occurs when AF is
again set to 0.
If the interrupt output is not used by setting AIE set
to 0, an alarm can still be controlled by software
monitoring of the AF bit.
Example 1
To set an alarm for 6pm of the following day:
• Set bits AIE and AF to 0.
• Set the day register AE bit to 1.
• Acquire the current weekday setting from bank
0 register 6, add 1 to the current v alue (e xcept in
the case of Saturday), and write the updated
data. Note that the day following 6H (Saturday)
is 0H (Sunday).
• Write 18H to the hour alarm register.
• Write 00H to the minute alarm register.
• Write 00H to the seconds alarm register.
• Set bit AF to 0.
• Set bit AIE to 1.
Example 2
To set an alarm for 6am on every for Sunday:
• Set bits AIE and AF to 0.
• Set the day alarm register AE bit to 1.
• Write 0H to the weekday alarm register.
• Write 06H to the hour alarm register.
• Write 00H to the minute alarm register.
• Write 00H to the seconds alarm register.
• Set bit AF to 0.
• Set bit AIE to 1.
Using the Temperature Sensor
The SM8580AM temperature sensor can be used to
monitor the surrounding temperature. The tempera-
ture sensor information can then be used to adjust the
clock for any temperature variations in the oscillator
frequency which affect the accuracy of the clock.
One method of utilizing the temperature sensor to
adjust timing errors is by using the clock error cor-
rection function (digital correction), as described
below.
1. Based on the known temperature characteristics
of the oscillator crystal, store temperature cor-
rection values for various temperatures in an
external non-volatile EEPROM.
2. Use an A/D converter, such as in a general-pur-
pose CPU, to convert the VTEMP temperature
sensor output voltage into a digital value.
3. Use the digital value of the current temperature
to access the temperature correction data stored
in the EEPROM, and then write the correspond-
ing data into the digital correction registers.
This procedure is useful in implementing a high-
accuracy clock function.
Monitoring Digital Correction
Using the test mode allows the 64Hz digital correc-
tion clock to be output on pin FOUT. The test mode
works as follows.
1. Apply a HIGH-level on FCON.
2. Set the FOUT frequency set register FE bit to 1.
3. Set the CE1 control register CDT_ON bit to 1.
4. Set correction data in the digital correction regis-
ter DT0 to DT6 bits, and then set DT_ON to 1.
5. Set the bank 2 register C, bit 1 to 1.
6. When CE0N is LOW and CE1 is HIGH and the
test mode set register TEST bit is set to 1, the
digital correction cycle changes from 10 seconds
to 1/64 seconds, and the clock output on FOUT
is the 64Hz clock after timing correction. The
output is the corrected timing for the set digital
correction value corresponding to a 64Hz clock
× 64[ppm]. Measuring this output provides a
quick method for monitoring the digital correc-
tion function.
7. When CE0N goes HIGH, the TEST bit is reset to
1 and test mode is released.