|
|
@@ -8,6 +8,7 @@ |
|
|
|
#include <math.h> |
|
|
|
#include "scaling.h" |
|
|
|
#include "util.h" |
|
|
|
#include "led.h" |
|
|
|
|
|
|
|
int send_data = 0; |
|
|
|
uint16_t send_adc; |
|
|
@@ -207,29 +208,30 @@ void run_normal(void) |
|
|
|
int main(void) |
|
|
|
{ |
|
|
|
config_init(); |
|
|
|
led_init(); |
|
|
|
|
|
|
|
/* Pull PGD high internally. */ |
|
|
|
TRISCbits.TRISC13 = 1; |
|
|
|
CNPU1bits.CN1PUE = 1; |
|
|
|
|
|
|
|
/* Output RA9 (PICVREF-) is used for debugging */ |
|
|
|
TRISAbits.TRISA9 = 0; |
|
|
|
led_on(); |
|
|
|
/* Detect jumper on B10/B11 */ |
|
|
|
//TRISCbits.TRISC13 = 1; |
|
|
|
//CNPU1bits.CN1PUE = 1; |
|
|
|
|
|
|
|
adcext_init(); |
|
|
|
dac_init(); |
|
|
|
dac_write(32768); |
|
|
|
adc_init(); |
|
|
|
|
|
|
|
led_off(); |
|
|
|
msleep(100); |
|
|
|
|
|
|
|
led_on(); |
|
|
|
|
|
|
|
degauss(); |
|
|
|
|
|
|
|
/* If PGD is externally tied to ground, use MODE_1 |
|
|
|
(Short ICD pins 3 and 4) */ |
|
|
|
if (PORTCbits.RC13 == 0) |
|
|
|
// if (PORTCbits.RC13 == 0) |
|
|
|
MODE_1(); |
|
|
|
else |
|
|
|
MODE_2(); |
|
|
|
// else |
|
|
|
// MODE_2(); |
|
|
|
|
|
|
|
for (;;) |
|
|
|
continue; |
|
|
|