| Electronic Components Datasheet Search |
|
AN1216 Datasheet(PDF) 3 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1216 Datasheet(HTML) 3 Page - STMicroelectronics |
|
3 / 11 page ![]() DocID007016 Rev 2 3/11 AN1216 11 to the alarm registers, though, can be made at any time, with no prior changes to the control register being necessary. The program listing, at the end of this document, contains statements to perform the following functions: 1. The Stop bit (ST, bit 7 of the register at offset 7FF9h) has to be reset to start the TIMEKEEPER oscillator *TIMEKEEPER_SEC &= 0x7F; // reset bit D7 using a mask 0x7F 2. The Alarm Flag Enable (AFE) bit (bit 7 of the register at offset 7FF6h) is set, thereby allowing the IRQ pin (pin 40) to output the interrupt signal (active low). *TKPER_AL_IT |= 0x80; // set bit D7 using a mask 0x80 3. The flag register (at offset 7FF0h) must be read at the beginning of the alarm updating routine. If not, the AF flag will never be released, and the TIMEKEEPER will continuously output an interrupt to the MCU, and the system will become unresponsive. Software configuration The program is listed in Alarm update management. To understand its operation, it is important to distinguish between the three pointer variables, pointing to physical addresses in the hardware: *TKPER_AL_HOUR, *TKPER_AL_MIN, *TKPER_AL_SEC and the three integer variables, used as work-space by the software: alarm_hour, alarm_minute, alarm_second The first three variables are pointers to the physical address of the values that are stored in the device. The three software variables are used to hold the user’s data (they specify the period of the alarm in hours, minutes and seconds). This is not the same information as is stored in the TIMEKEEPER registers, as pointed to by the pointer variables, but is used in their calculation. The program does make use of the four Repeat bits (RPT4, RPT3, RPT2 and RPT1) that are physically located in the TIMEKEEPER device. These should all be set, except for those corresponding to fields that contain significant data. For instance, to set an alarm that repeats every 3 minutes and 45 seconds, the alarm_minutes and alarm_seconds variables would be loaded with these two values. Then appropriate values would be calculated for loading in the “Alarm Minutes” and “Alarm Seconds” fields of the alarm registers (at addresses 7FF3h and 7FF2h, *TKPER_AL_MIN and *TKPER_AL_SEC, respectively), and their Repeat bits (RPT2 and RPT1, respectively) would be reset to ‘0’. Meanwhile, the alarm_hour variable, and the “Alarm Date” and “Alarm Hour” fields of the alarm registers (at addresses 7FF5h and 7FF4h, *TKPER_AL_DATE and *TKPER_AL_HOUR, respectively) would be treated as “Don’t Care”, as indicated by their Repeat bits (RPT4 and RPT3, respectively) being set. This is summarized in Table 3, with the three local integer variables, alarm_second, alarm_minute and alarm_hour, used to represent the period. |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |