| Line 17... |
Line 17... |
| 17 |
#define TL1 PIN_B3 // tlacitko S1 |
17 |
#define TL1 PIN_B3 // tlacitko S1 |
| 18 |
#define TL2 PIN_B2 // tlacitko S2 |
18 |
#define TL2 PIN_B2 // tlacitko S2 |
| 19 |
#define TL3 PIN_B1 // tlacitko S3 |
19 |
#define TL3 PIN_B1 // tlacitko S3 |
| 20 |
#define TL4 PIN_B0 // tlacitko S4 |
20 |
#define TL4 PIN_B0 // tlacitko S4 |
| 21 |
|
21 |
|
| 22 |
#define POWER_T4 PIN_A6 // ovladani optotriaku T3 |
22 |
#define POWER_T3 PIN_A6 // ovladani optotriaku T3 |
| 23 |
#define POWER_T4 PIN_A5 // ovladani optotriaku T4 |
23 |
#define POWER_T4 PIN_A5 // ovladani optotriaku T4 |
| 24 |
#define POWER_T5 PIN_A4 // ovladani optotriaku T5 |
24 |
#define POWER_T5 PIN_A4 // ovladani optotriaku T5 |
| 25 |
|
25 |
|
| 26 |
#define ADC_PIN PIN_A0 //info, nelze menit - pin pouzit jako input analog |
26 |
#define ADC_PIN PIN_A0 //info, nelze menit - pin pouzit jako input analog |
| 27 |
#define ADC_PIN_NC PIN_A1 //info, nelze menit - pin pouzit jako input analog |
27 |
#define ADC_PIN_NC PIN_A1 //info, nelze menit - pin pouzit jako input analog |
| Line 76... |
Line 76... |
| 76 |
delay_us(50); |
76 |
delay_us(50); |
| 77 |
} |
77 |
} |
| 78 |
return (analog >> 5 ); // prumer = analog/32 |
78 |
return (analog >> 5 ); // prumer = analog/32 |
| 79 |
} |
79 |
} |
| 80 |
|
80 |
|
| 81 |
int16 teplota(void) |
81 |
float teplota(void) |
| 82 |
{ |
82 |
{ |
| 83 |
|
- |
|
| 84 |
//BYTE CONST TEMP_CALLIBRATION[20] = {0x90,0xb7,0x19,0x15,0x36,0x54,0x50,0xb5,0,0x24}; |
- |
|
| 85 |
|
- |
|
| 86 |
/*int16 Temp; |
- |
|
| 87 |
|
- |
|
| 88 |
float32 Rpt; |
- |
|
| 89 |
float32 Tpt; |
- |
|
| 90 |
|
- |
|
| 91 |
Rpt = 1.0*adc()*2350.0/1024.0; //zapojeni OZ -> R=U/Iconst |
- |
|
| 92 |
|
- |
|
| 93 |
#define A 3.90802e-3 |
- |
|
| 94 |
#define B -5.802e-7 |
- |
|
| 95 |
|
- |
|
| 96 |
Tpt = (-A + sqrt(A*A - 4*B*(1.0 - Rpt/1000.0)))/2.0/B; |
- |
|
| 97 |
|
- |
|
| 98 |
|
- |
|
| 99 |
|
- |
|
| 100 |
*/ |
- |
|
| 101 |
return adc(); |
83 |
return (0.674201*adc() - 294.35); |
| 102 |
} |
84 |
} |
| 103 |
|
85 |
|
| 104 |
|
86 |
|
| 105 |
#int_TIMER2 |
87 |
#int_TIMER2 |
| 106 |
void Rtc(void) //40ms |
88 |
void Rtc(void) //40ms |
| Line 155... |
Line 137... |
| 155 |
lcd_gotoxy(9,1); |
137 |
lcd_gotoxy(9,1); |
| 156 |
printf(lcd_putc,"%2u:%02u:%02u",cas.hod,cas.min,cas.sec); |
138 |
printf(lcd_putc,"%2u:%02u:%02u",cas.hod,cas.min,cas.sec); |
| 157 |
} |
139 |
} |
| 158 |
|
140 |
|
| 159 |
lcd_gotoxy(1,2); |
141 |
lcd_gotoxy(1,2); |
| 160 |
printf(lcd_putc,"teplota: %ld\21C ",teplota()); |
142 |
printf(lcd_putc,"teplota: %3.1f\21C ",teplota()); |
| 161 |
} |
143 |
} |
| 162 |
} |
144 |
} |