#ifndef __int_c_ #define __int_c_ #include "int.h" volatile int YEAR; volatile int MONTH; volatile int DAY; volatile int HOUR; volatile int MINUTE; volatile int SECOND; volatile int MSECOND; volatile unsigned char timer36; volatile unsigned char thismdays; //Should be called 7200 times per second. //attention, - no blank at signalnamestart, - end INTERRUPT(SIG_OVERFLOW0) { timer36++; if( timer36 > 35 ){ //ok, we have a 1/200 second timer36 = 0; MSECOND = MSECOND + 5; if( MSECOND >= 1000 ){ //ok, we have a complete second MSECOND = 0; SECOND++; if( SECOND >= 60 ){ //dito - minute SECOND = 0; MINUTE++; if( MINUTE >= 60 ){ //hour MINUTE = 0; HOUR++; if( HOUR >= 24 ){ //day HOUR = 0; DAY++; if( DAY > thismdays ) { DAY = 1; MONTH++; if( MONTH > 12 ){ MONTH = 1; YEAR++; } } } } } } } ///////////////////////////////// //here the 1/7200 stuff } void rtc_set_time( void ) { REAL_TIME Time; BYTE ret; cbi( TIMSK, TOIE0);//disable timer0 overflow int Time.Date = INT2BCD(DAY); Time.Month = INT2BCD(MONTH); Time.Year = INT2BCD(YEAR); Time.Hour = INT2BCD(HOUR); Time.Minute = INT2BCD(MINUTE); Time.Second = INT2BCD(SECOND); Time.Sec100 = INT2BCD(MSECOND / 10); ret = RTCSetTime( &Time, RTCDEVICEID ); LCDPos(0,0); if( ret == RTC_SUCCESSFUL ){ TCNT0 = 0;// simple setting to 0 TCCR0 = 2;// prescaler ck/8 timer36 = 0;//our own 7200 to 200 provider //TIMSK = (1< 995 ){ MSECOND = 0; } thismdays = get_maxmonthdays( MONTH, YEAR ); //Timer0 counting clock / 8 complete range 0-0xff //15745600 / 8 = 1.843.200 //1.843.200 / 256 = 7200 //so we have a precision of 1/7200 tel second. //Means the interrupt will be called 7200 times per second. //Because timer counts complete 8bit-range 0-255, we //never have to reload it with a new value. TCNT0 = 0;// simple setting to 0 TCCR0 = 2;// prescaler ck/8 timer36 = 0;//our own 7200 to 100 provider //TIMSK = (1<