0,0 → 1,47 |
#include "D:\MLAB\Designs\STOPWATCH02A\SW\test\main.h" |
|
#define LED1 PIN_A1 |
#define LED2 PIN_A2 |
|
#int_TIMER0 |
void TIMER0_isr(void) |
{ |
Output_low(LED2); |
} |
|
#int_RB |
void RB_isr(void) |
{ |
output_high(LED2); |
output_toggle(PIN_B2); |
input_b(); |
} |
|
|
void main() |
{ |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_OFF); |
setup_psp(PSP_DISABLED); |
setup_spi(SPI_SS_DISABLED); |
setup_wdt(WDT_OFF); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8); |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
|
set_tris_b(0xFF); |
port_b_pullups(TRUE); |
|
enable_interrupts(INT_TIMER0); |
enable_interrupts(INT_RB); |
enable_interrupts(GLOBAL); |
|
while(true) |
{ |
Output_toggle(LED1); |
Delay_ms(100); |
} |
} |