1 |
#CASE // Case sensitive compiler |
1 |
#CASE // Case sensitive compiler |
2 |
|
2 |
|
3 |
#include "main.h" |
3 |
#include "main.h" |
4 |
|
4 |
|
5 |
#define LED PIN_A5 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
5 |
#define LED PIN_E0 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
6 |
|
6 |
|
7 |
#int_RDA |
7 |
#int_RDA |
8 |
void RDA_isr(void) |
8 |
void RDA_isr(void) |
9 |
{ |
9 |
{ |
10 |
getc(); |
10 |
getc(); |
11 |
printf("&"); |
11 |
printf("!"); |
12 |
} |
12 |
} |
13 |
|
13 |
|
14 |
#int_TIMER1 |
14 |
#int_TIMER1 |
15 |
void TIMER1_isr(void) |
15 |
void TIMER1_isr(void) |
16 |
{ |
16 |
{ |
17 |
printf("!"); |
17 |
printf("*"); |
18 |
} |
18 |
} |
19 |
|
19 |
|
20 |
void main() |
20 |
void main() |
21 |
{ |
21 |
{ |
22 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
22 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
23 |
setup_adc(ADC_CLOCK_DIV_2); |
23 |
setup_adc(ADC_CLOCK_DIV_2); |
24 |
setup_spi(SPI_SS_DISABLED); |
24 |
setup_spi(SPI_SS_DISABLED); |
25 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
25 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
26 |
// setup_wdt(WDT_2304MS|WDT_DIV_16); |
26 |
// setup_wdt(WDT_2304MS|WDT_DIV_16); |
27 |
setup_wdt(WDT_OFF); |
27 |
setup_wdt(WDT_OFF); |
28 |
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); |
28 |
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); |
29 |
setup_timer_2(T2_DISABLED,0,1); |
29 |
setup_timer_2(T2_DISABLED,0,1); |
30 |
setup_ccp1(CCP_OFF); |
30 |
setup_ccp1(CCP_OFF); |
31 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
31 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
32 |
enable_interrupts(INT_RDA); |
32 |
enable_interrupts(INT_RDA); |
33 |
enable_interrupts(INT_TIMER1); |
33 |
enable_interrupts(INT_TIMER1); |
34 |
enable_interrupts(GLOBAL); |
34 |
enable_interrupts(GLOBAL); |
35 |
setup_oscillator(OSC_8MHZ); |
35 |
setup_oscillator(OSC_8MHZ); |
36 |
|
36 |
|
37 |
//Example blinking LED program |
37 |
//Example blinking LED program |
38 |
while(TRUE) |
38 |
while(TRUE) |
39 |
{ |
39 |
{ |
40 |
printf("@:"); |
40 |
printf("@:"); |
41 |
output_low(LED); |
41 |
output_low(LED); |
42 |
delay_ms(200); |
42 |
delay_ms(200); |
43 |
output_high(LED); |
43 |
output_high(LED); |
44 |
delay_ms(200); |
44 |
delay_ms(200); |
45 |
restart_wdt(); |
45 |
restart_wdt(); |
46 |
} |
46 |
} |
47 |
} |
47 |
} |
48 |
#include "..\common\dbloader.h" |
48 |
#include "..\common\dbloader.h" |
49 |
|
49 |
|