/Designs/Measuring_instruments/AWS01A/SW/PIC16F887/test_interrupt/main.c
0,0 → 1,49
#CASE // Case sensitive compiler
 
#include "main.h"
 
#define LED PIN_A5 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
 
#int_RDA
void RDA_isr(void)
{
getc();
printf("&");
}
 
#int_TIMER1
void TIMER1_isr(void)
{
printf("!");
}
 
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
// setup_wdt(WDT_2304MS|WDT_DIV_16);
setup_wdt(WDT_OFF);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
enable_interrupts(INT_RDA);
enable_interrupts(INT_TIMER1);
enable_interrupts(GLOBAL);
setup_oscillator(OSC_8MHZ);
 
//Example blinking LED program
while(TRUE)
{
printf("@:");
output_low(LED);
delay_ms(200);
output_high(LED);
delay_ms(200);
restart_wdt();
}
}
#include "..\common\dbloader.h"