RTC DS12C887 has three interrupts, namely, Alarm interrupt, Periodic interrupt & Update interrupt.
ALARM INTERRUPT
The alarm interrupt occurs whenever the current time matches the alarm time. When this interrupt occurs, the corresponding flag in the Register C is set. The IRQ pin also goes low only in case the alarm interrupt enable bit is set in the Register B.
The alarm interrupt can be programmed to occur at three different rates, namely, (a) once per day, (b) once per hour, (c) once per minute, and (d) once per second.
(A) Once per Day Alarm:
To program the alarm for once per day, we write the desired time for the alarm into the hour alarm, minute alarm and second alarm registers (1,3 and 5 respectively). As the clock keeps the time, when all three bytes of hour, minute and second for the RTC match the values in the alarm hour, minute and second , the AF (alarm flag) bit in register C will go high. In order to use the IRQ pin of RTC for an alarm, the interrupt-enable bit for alarm in register B (AIE) must be set high.
(B) Once per Hour Alarm:
To program the alarm interrupt to occur once per hour, we write the value 11xxxxx into the alarm hour. Value 11xxxxx means any hex value between C0H to FFH. Very often, FFH is used.
(C) Once per Minute Alarm:
To program the alarm for once per hour, we write value 11xxxxx into both the alarm hour and the alarm minute registers.
(D) Once per Second Alarm:
To program the alarm for once per second, we write value FFH into all three registers of alarm i.e. alarm hour, alarm minute and alarm second.
PERIODIC INTERRUPT
The second interrupt is the periodic Interrupt. Whenever a periodic interrupt occurs the periodic interrupt flag (PF) will go high, at a rate set by RS3-RS0 bits of register A. This rate can be from once every 500 ms to once every 122 micro seconds. In order to use the IRQ pin of RTC, the periodic interrupt-enable bit in register B (PIE) must be set to high. The following table describes the setting of bits RS3-RS0 of the Register A for the different time period of the periodic interrupt.
RS3
|
RS2
|
RS1
|
RS0
|
Periodic interrupt rate
|
0
|
0
|
0
|
0
|
None
|
0
|
0
|
0
|
1
|
3.9062 ms
|
0
|
0
|
1
|
0
|
7.812 ms
|
0
|
0
|
1
|
1
|
122.070 micro sec
|
0
|
1
|
0
|
0
|
244.141 micro sec
|
0
|
1
|
0
|
1
|
488.281 micro sec
|
0
|
1
|
1
|
0
|
976.5625 micro sec
|
0
|
1
|
1
|
1
|
1.953125 ms
|
1
|
0
|
0
|
0
|
3.90625 ms
|
1
|
0
|
0
|
1
|
7.8125 ms
|
1
|
0
|
1
|
0
|
15.625 ms
|
1
|
0
|
1
|
1
|
31.25 ms
|
1
|
1
|
0
|
0
|
62.5 ms
|
1
|
1
|
0
|
1
|
125 ms
|
1
|
1
|
1
|
0
|
250 ms
|
1
|
1
|
1
|
1
|
500 ms
|
UPDATE ENDED INTERRUPT
This interrupt is used to indicate that the values of time date and calendar of the RTC have been updated and are ready to be picked up. The update cycle occurs once every second. Whenever this interrupt occurs the corresponding bit in Register C gets high.
You may also like:
Filed Under: Tutorials
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.