23.04.2013 Views

TMPM330 - Keil

TMPM330 - Keil

TMPM330 - Keil

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

15.6 Alarm function<br />

Under development<br />

<strong>TMPM330</strong> (rev0.4) 15-13<br />

<strong>TMPM330</strong><br />

By writing “1” to PAGER, the alarm function of the PAGE1 registers is enabled. One of<br />

the following three signals is output to the ALARM pin.<br />

(1) “0” (when the alarm register corresponds with the clock)<br />

(2) 1Hz clock<br />

(3) 16Hz clock<br />

The INTRTC outputs a 1-shot pulse by detecting the falling edge.<br />

The RTC is not initialized by reset. Clear the interrupt request flag in the interrupt controller<br />

when the clock or alarm function is used.<br />

(1) “0” (when the alarm register corresponds with the clock)<br />

Provided PAGER = “1”, “0” is output to the ALARM pin when the values of the<br />

PAGE0 clock and the PAGE1 alarm register correspond. In combination with the setting and<br />

PAGER=“1”, the INTRTC interrupt is generated and the alarm is triggered.<br />

The alarm settings<br />

To initialize the alarm, write “1” to RESTR. It makes all alarm settings “don’t<br />

care”. In this case, the alarm always corresponds with the value of the clock. The INTRTC<br />

interrupt request is generated if PAGER =”1”.<br />

Setting alarm for min., hour, date and day is done by writing data to the relevant PAGE1<br />

register. Each writing releases the “don’t care” state respectively.<br />

When all setting contents correspond with the setting of PAGER<br />

=1”, the RTC generates an INTRTC interrupt. However, contents which have not<br />

been set up (“don't care” state) are always considered to be corresponding.<br />

Contents which have already been set up cannot be returned independently but all<br />

together to the “don’t care” state by initializing the alarm.<br />

The following is an example program for outputting an alarm from the ALARM pin at noon<br />

(PM12:00) every day.<br />

7 6 5 4 3 2 1 0<br />

PAGER ← 0 0 0 0 1 0 0 1 Disables alarm, sets PAGE1<br />

RESTR ← 1 1 0 1 0 0 0 0 Initializes alarm<br />

DAYR ← 0 0 0 0 0 0 0 1 W0<br />

DATAR ← 0 0 0 0 0 0 0 1 1 day<br />

HOURR ← 0 0 0 1 0 0 1 0 Sets 12 o’clock<br />

MINR ← 0 0 0 0 0 0 0 0 Sets 00 min.<br />

Set up time 31 μs (Note)<br />

PAGER ← 0 0 0 0 1 1 0 0 Enables alarm<br />

PAGER ← 1 0 0 0 1 1 0 0 Enables interrupt<br />

When the CPU is operating at high frequency oscillation, it may take a maximum of one<br />

clock at 32 kHz (about 30us) for the time register setting to become valid. In the above<br />

example, it is necessary to set 31μs of set up time between setting the time register and<br />

enabling the alarm register.<br />

(Note) This set up time is unnecessary when you use only internal interruption.<br />

Real Time Clock

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!