Rev Author Line No. Line
1431 kaklik 1 #include "D:\MLAB\Designs\STOPWATCH02A\SW\test\main.h"
2  
3 #define LED1 PIN_A1
4 #define LED2 PIN_A2
5  
6 #int_TIMER0
7 void TIMER0_isr(void)
8 {
9 Output_low(LED2);
10 }
11  
12 #int_RB
13 void RB_isr(void)
14 {
15 output_high(LED2);
16 output_toggle(PIN_B2);
17 input_b();
18 }
19  
20  
21 void main()
22 {
23 setup_adc_ports(NO_ANALOGS|VSS_VDD);
24 setup_adc(ADC_OFF);
25 setup_psp(PSP_DISABLED);
26 setup_spi(SPI_SS_DISABLED);
27 setup_wdt(WDT_OFF);
28 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
29 setup_timer_1(T1_DISABLED);
30 setup_timer_2(T2_DISABLED,0,1);
31 setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8);
32 setup_comparator(NC_NC_NC_NC);
33 setup_vref(FALSE);
34  
35 set_tris_b(0xFF);
36 port_b_pullups(TRUE);
37  
38 enable_interrupts(INT_TIMER0);
39 enable_interrupts(INT_RB);
40 enable_interrupts(GLOBAL);
41  
42 while(true)
43 {
44 Output_toggle(LED1);
45 Delay_ms(100);
46 }
47 }