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