19,6 → 19,7 |
#define TL3 PIN_B1 // tlacitko S3 |
#define TL4 PIN_B0 // tlacitko S4 |
|
#define POWER_T4 PIN_A6 // ovladani optotriaku T3 |
#define POWER_T4 PIN_A5 // ovladani optotriaku T4 |
#define POWER_T5 PIN_A4 // ovladani optotriaku T5 |
|
79,7 → 80,12 |
|
int16 teplota(void) |
{ |
float32 Rpt; |
|
BYTE CONST TEMP_CALLIBRATION[20] = {0x90,0xb7,0x19,0x15,0x36,0x54,0x50,0xb5,0,0x24}; |
|
int16 Temp; |
|
/* float32 Rpt; |
float32 Tpt; |
|
Rpt = 1.0*adc()*2350.0/1024.0; //zapojeni OZ -> R=U/Iconst |
88,39 → 94,14 |
#define B -5.802e-7 |
|
Tpt = (-A + sqrt(A*A - 4*B*(1.0 - Rpt/1000.0)))/2.0/B; |
*/ |
|
return (unsigned int16)Tpt; |
} |
|
void baterie(void) |
{ |
static int8 stav=0; |
switch (stav) |
{ |
case 0: stav++; |
lcd_define_char(0,LCD_CHAR_BAT0); |
break; |
case 1: stav++; |
lcd_define_char(0,LCD_CHAR_BAT20); |
break; |
case 2: stav++; |
lcd_define_char(0,LCD_CHAR_BAT40); |
PowerOff(); |
break; |
case 3: stav++; |
lcd_define_char(0,LCD_CHAR_BAT60); |
break; |
case 4: stav++; |
lcd_define_char(0,LCD_CHAR_BAT80); |
break; |
case 5: stav=0; |
lcd_define_char(0,LCD_CHAR_BAT100); |
PowerOn(); |
break; |
default: stav=0; |
} |
|
return Temp; |
} |
|
|
#int_TIMER2 |
void Rtc(void) //40ms |
{ |
157,19 → 138,16 |
void main() |
{ |
int8 tmp; |
|
GeneralCpuInit(); |
|
PowerOff(); |
|
lcd_init(); |
lcd_define_char(1,LCD_CHAR_STUPEN); |
|
printf(lcd_putc,"\fbatt: \20"); |
|
|
nullcas(&cas); |
|
for (;;){ |
while(true) |
{ |
delay_ms(300); |
|
if (cas.sec != tmp){ |
178,8 → 156,7 |
printf(lcd_putc,"%2u:%02u:%02u",cas.hod,cas.min,cas.sec); |
} |
|
baterie(); |
lcd_gotoxy(1,2); |
printf(lcd_putc,"teplota: %ld\21C ",teplota()); |
} |
} |
} |