34 #error "This processor selection has the DMA module; this code example is incompatible with a PIC24 CPU that has DMA."
38 #define CONFIG_LED2() CONFIG_RB0_AS_DIG_OUTPUT()
47 #define ADC_NSTEPS 4096
48 #define ADC_12BIT_FLAG 1
51 #define ADC_NSTEPS 1024
52 #define ADC_12BIT_FLAG 0
64 void _ISR _ADC1Interrupt (
void) {
68 for ( u8_i=0; u8_i<16; u8_i++) {
69 au16_buffer[u8_i] = au16_adcHWBuff[u8_i];
99 CONFIG_AN0_AS_ANALOG();
100 CONFIG_AN1_AS_ANALOG();
101 CONFIG_AN4_AS_ANALOG();
102 CONFIG_AN5_AS_ANALOG();
103 CONFIG_AN10_AS_ANALOG();
104 CONFIG_AN11_AS_ANALOG();
105 CONFIG_AN12_AS_ANALOG();
110 ADC_SCAN_AN5 | ADC_SCAN_AN10 | ADC_SCAN_AN11 | ADC_SCAN_AN12,
114 while ( !AD1CON1bits.DONE) {};
116 while (u8_waiting) {};
118 for ( u8_i=0; u8_i<16; u8_i++) {
119 u16_pot = au16_buffer[u8_i];
120 f_pot = 3.3 / ADC_NSTEPS * u16_pot;
122 if (u8_i < 10)
outChar(
'0'+u8_i );
127 ui16_potmv = f_pot*1000;
128 printf(
":0x%04X=%d mV ", u16_pot, ui16_potmv );
131 printf(
":0x%04X=%1.3fV ", u16_pot, (
double) f_pot );
133 if ((u8_i % 4) == 3) printf(
"\n");