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  
1435 kaklik 12 /*#int_RB
1431 kaklik 13 void RB_isr(void)
14 {
1435 kaklik 15 output_high(LED2);
16 }*/
1431 kaklik 17  
18  
19 void main()
20 {
1435 kaklik 21 unsigned int8 last;
22  
1431 kaklik 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 port_b_pullups(TRUE);
36  
1435 kaklik 37 // enable_interrupts(INT_RB);
1431 kaklik 38 enable_interrupts(GLOBAL);
39  
1435 kaklik 40 last=input_b();
41  
1431 kaklik 42 while(true)
43 {
44 Output_toggle(LED1);
45 Delay_ms(100);
1435 kaklik 46 if(last!=Input_b()) output_high(LED2);
47 last=input_b();
1431 kaklik 48 }
49 }