#include "config.h" #include "adc.h" #include "adcext.h" #include "dac.h" #include "uart.h" #include "timer.h" #include "util.h" #include "led.h" #include "mode.h" #include "calibrate.h" int main(void) { int jumper; config_init(); led_init(); led_on(); calibrate_init(); /* debug output */ TRISAbits.TRISA9 = 0; adcext_init(); dac_init(); dac_write(DAC_MID); adc_init(); /* Detect jumper from B8 to GND */ TRISBbits.TRISB8 = 0; LATBbits.LATB8 = 1; nop(); nop(); nop(); jumper = (PORTBbits.RB8 == 0); TRISBbits.TRISB8 = 1; /* If jumper present, use MODE_1 */ if (jumper) run_debug(); else run_normal(); for (;;) continue; }