/Designs/Tools/reflow/SW/clock.c
0,0 → 1,35
/* mija 2009
 
SW pro ATmega8 mereni + regulace teploty
Fosc = 8192000Hz externi krystal
 
ver.: 0.0 - start
*/
 
#include <avr/io.h>
#include "clock.h"
 
void ClockInit(uint8_t hour,uint8_t min,uint8_t sec,Clockt_t *clock)
{
clock->hour = hour;
clock->min = min;
clock->sec = sec;
}
 
void ProcesClock(uint8_t *tik,Clockt_t *clock)
{
if (!*tik)
{
*tik = TIKSOFSEC; //125
if (++clock->sec == 60)
{
clock->sec = 0;
if (++clock->min == 60)
{
clock->min = 0;
clock->hour++;
}
}
}
}