Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN1216 Datasheet(PDF) 7 Page - STMicroelectronics

Part # AN1216
Description  Implementing a periodic alarm with TIMEKEEPER
PDF  11 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN1216 Datasheet(HTML) 7 Page - STMicroelectronics

Back Button AN1216 Datasheet HTML 3Page - STMicroelectronics AN1216 Datasheet HTML 4Page - STMicroelectronics AN1216 Datasheet HTML 5Page - STMicroelectronics AN1216 Datasheet HTML 6Page - STMicroelectronics AN1216 Datasheet HTML 7Page - STMicroelectronics AN1216 Datasheet HTML 8Page - STMicroelectronics AN1216 Datasheet HTML 9Page - STMicroelectronics AN1216 Datasheet HTML 10Page - STMicroelectronics AN1216 Datasheet HTML 11Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 7 / 11 page
background image
DocID007016 Rev 2
7/11
AN1216
11
if ((octet >= 0x40) & (octet <= 0x49)) return (buffer-24);
if ((octet >= 0x50) & (octet <= 0x59)) return (buffer-30);
}
/**************************************************************************/
/* function Int_To_Char
*/
/* description :
This function convert an integer data
*/
/*
to BCD TIMEKEEPER format (unsigned char)
*/
/* input :
int integ
*/
/* output :
unsigned char
*/
/* example :
integ = 33
(0x21 in hexa)
*/
/*
Int_To_Char = 0x33
(51 in integer)
*/
/**************************************************************************/
unsigned char Int_To_Char(int integ)
{
char buffer;
buffer = (unsigned char)(integ);
if (integ <= 9) return(buffer);
if ((integ >= 10) & (integ <= 19)) return (buffer+6);
if ((integ >= 20) & (integ <= 29)) return (buffer+0x0C);
if ((integ >= 30) & (integ <= 39)) return (buffer+0x12);
if ((integ >= 40) & (integ <= 49)) return (buffer+0x18);
if ((integ >= 50) & (integ <= 59)) return (buffer+0x1E);
}
/*************************************************************************/
/* void Update_Next_Alarm
*/
/* description :
After alarm interupt, it will :
*/
/*
- reset the TIMEKEEPER IT flag
*/
/*
- read the actual time in the clock register
*/
/*
- calculate the next alarm time
*/
/*
- update the alarm register
*/
/*
to prepare for the next alarm
*/
/* input :
alarm period (al_hour, al_minute, al_second)
*/
/* output :
nothing
*/
/*************************************************************************/
void Update_Next_Alarm(int al_hour,int al_minute,int al_second)
{
// time carry, going to be used for hour, minute and second
// calculation process.
unsigned char time_flag = 0;
// intermediate storage for alarm data.
int buffsec;
int buffmin;
int buffhour;
// temporary storage
unsigned char buffchar;
// Touch the flag register to reset TIMEKEEPER AF flag (interupt)
buffchar = *TKPER_FLAG;
/*****************************************************************/
/* This is to update the alarm second register.
*/
/* It will test if RPT1 is set. If not then it adds “al_second”
*/
/* to second alarm register. It takes care of the minute carry.
*/
/*****************************************************************/
if (!(*TKPER_AL_SEC & 0x80))
// if !RPT1
{
// update register with carry
buffsec = Char_To_Int(*TIMEKEEPER_SEC) + al_second;
if (buffsec > 59)
// if >59
{
// then restore 60sec format



Html Pages

1 2 3 4 5 6 7 8 9 10 11


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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