| Line 7... |
Line 7... |
| 7 |
void TIMER0_isr(void) |
7 |
void TIMER0_isr(void) |
| 8 |
{ |
8 |
{ |
| 9 |
Output_low(LED2); |
9 |
Output_low(LED2); |
| 10 |
} |
10 |
} |
| 11 |
|
11 |
|
| 12 |
#int_RB |
12 |
/*#int_RB |
| 13 |
void RB_isr(void) |
13 |
void RB_isr(void) |
| 14 |
{ |
14 |
{ |
| 15 |
output_high(LED2); |
15 |
output_high(LED2); |
| 16 |
output_toggle(PIN_B2); |
- |
|
| 17 |
input_b(); |
- |
|
| 18 |
} |
16 |
}*/ |
| 19 |
|
17 |
|
| 20 |
|
18 |
|
| 21 |
void main() |
19 |
void main() |
| 22 |
{ |
20 |
{ |
| - |
|
21 |
unsigned int8 last; |
| - |
|
22 |
|
| 23 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
23 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
| 24 |
setup_adc(ADC_OFF); |
24 |
setup_adc(ADC_OFF); |
| 25 |
setup_psp(PSP_DISABLED); |
25 |
setup_psp(PSP_DISABLED); |
| 26 |
setup_spi(SPI_SS_DISABLED); |
26 |
setup_spi(SPI_SS_DISABLED); |
| 27 |
setup_wdt(WDT_OFF); |
27 |
setup_wdt(WDT_OFF); |
| Line 30... |
Line 30... |
| 30 |
setup_timer_2(T2_DISABLED,0,1); |
30 |
setup_timer_2(T2_DISABLED,0,1); |
| 31 |
setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8); |
31 |
setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8); |
| 32 |
setup_comparator(NC_NC_NC_NC); |
32 |
setup_comparator(NC_NC_NC_NC); |
| 33 |
setup_vref(FALSE); |
33 |
setup_vref(FALSE); |
| 34 |
|
34 |
|
| 35 |
set_tris_b(0xFF); |
- |
|
| 36 |
port_b_pullups(TRUE); |
35 |
port_b_pullups(TRUE); |
| 37 |
|
36 |
|
| 38 |
enable_interrupts(INT_TIMER0); |
- |
|
| 39 |
enable_interrupts(INT_RB); |
37 |
// enable_interrupts(INT_RB); |
| 40 |
enable_interrupts(GLOBAL); |
38 |
enable_interrupts(GLOBAL); |
| 41 |
|
39 |
|
| - |
|
40 |
last=input_b(); |
| - |
|
41 |
|
| 42 |
while(true) |
42 |
while(true) |
| 43 |
{ |
43 |
{ |
| 44 |
Output_toggle(LED1); |
44 |
Output_toggle(LED1); |
| 45 |
Delay_ms(100); |
45 |
Delay_ms(100); |
| - |
|
46 |
if(last!=Input_b()) output_high(LED2); |
| - |
|
47 |
last=input_b(); |
| 46 |
} |
48 |
} |
| 47 |
} |
49 |
} |