1134 |
mija |
1 |
/**** baud test for IRMRAK ****/ |
|
|
2 |
|
|
|
3 |
#include "baud_test.h" |
|
|
4 |
|
1135 |
mija |
5 |
#define HEATING PIN_A2 |
1134 |
mija |
6 |
|
|
|
7 |
volatile int1 flag_temp; |
|
|
8 |
volatile int8 ostun; |
|
|
9 |
|
|
|
10 |
#INT_RDA |
|
|
11 |
rs232_handler() |
|
|
12 |
{ |
|
|
13 |
char ch; |
|
|
14 |
|
|
|
15 |
switch (getc()) |
|
|
16 |
{ |
|
|
17 |
case 'A': setup_oscillator(OSC_4MHZ|OSC_INTRC,++ostun);break; |
|
|
18 |
case 'B': setup_oscillator(OSC_4MHZ|OSC_INTRC,--ostun);break; |
|
|
19 |
case 'C': if (flag_temp) flag_temp = 0;else flag_temp=1;break; |
|
|
20 |
} |
|
|
21 |
} |
|
|
22 |
|
|
|
23 |
void main() |
|
|
24 |
{ |
|
|
25 |
output_low(HEATING); // Heating off |
|
|
26 |
setup_wdt(WDT_2304MS); // Setup Watch Dog |
|
|
27 |
setup_adc_ports(NO_ANALOGS); |
|
|
28 |
setup_adc(ADC_OFF); |
|
|
29 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
30 |
setup_timer_1(T1_DISABLED); |
|
|
31 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
32 |
setup_comparator(NC_NC_NC_NC); |
|
|
33 |
setup_vref(FALSE); |
1136 |
mija |
34 |
setup_oscillator(OSC_4MHZ|OSC_INTRC,0 ); |
1134 |
mija |
35 |
|
|
|
36 |
delay_ms(1000); |
|
|
37 |
ostun=0; |
|
|
38 |
flag_temp=0; |
|
|
39 |
|
|
|
40 |
//enable_interrupts(GLOBAL); |
|
|
41 |
//enable_interrupts(INT_RDA); |
1135 |
mija |
42 |
|
1134 |
mija |
43 |
while(TRUE) |
|
|
44 |
{ |
|
|
45 |
while (flag_temp) |
|
|
46 |
{ |
|
|
47 |
printf("\nostune\r%d",ostun); |
|
|
48 |
delay_ms(500); |
|
|
49 |
} |
|
|
50 |
putc(0x00); |
|
|
51 |
} |
|
|
52 |
} |
|
|
53 |
|