1384 |
mija |
1 |
/* mija 2009 |
|
|
2 |
|
|
|
3 |
SW pro ATmega8 mereni + regulace teploty |
|
|
4 |
Fosc = 8192000Hz externi krystal |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
ver.: 0.0 - start |
|
|
8 |
*/ |
|
|
9 |
|
|
|
10 |
#include <avr/io.h> |
|
|
11 |
#include "clock.h" |
|
|
12 |
|
|
|
13 |
void ClockInit(uint8_t hour,uint8_t min,uint8_t sec,Clockt_t *clock) |
|
|
14 |
{ |
|
|
15 |
clock->hour = hour; |
|
|
16 |
clock->min = min; |
|
|
17 |
clock->sec = sec; |
|
|
18 |
} |
|
|
19 |
|
|
|
20 |
void ProcesClock(uint8_t *tik,Clockt_t *clock) |
|
|
21 |
{ |
|
|
22 |
if (!*tik) |
|
|
23 |
{ |
|
|
24 |
*tik = TIKSOFSEC; //125 |
|
|
25 |
if (++clock->sec == 60) |
|
|
26 |
{ |
|
|
27 |
clock->sec = 0; |
|
|
28 |
if (++clock->min == 60) |
|
|
29 |
{ |
|
|
30 |
clock->min = 0; |
|
|
31 |
clock->hour++; |
|
|
32 |
} |
|
|
33 |
} |
|
|
34 |
} |
|
|
35 |
} |