Created Fri, 07 Jun 2013 08:45:14 +0000 by Imolas3
Fri, 07 Jun 2013 08:45:14 +0000
Hi all
I have written soem XC code to make the ADC work on the MAX32 board and it tested OK. I am pretty new to this platform and the compiler but very experienced in CCS and PIC assembler
I tired this on the Microchip Explorer board and again OK.
I then tried this on the UN32 and it does not work - does not give a valid ADC value after a read regardless of input voltage applied. Not even close.
The boards have a different processor, but he documentation does not show difference in ADC - thatI can see anyway
Any help appreciated immensely
code is:
#pragma config POSCMOD=XT, FNOSC=PRIPLL #pragma config FPLLIDIV=DIV_2, FPLLMUL=MUL_20, FPLLODIV=DIV_1 #pragma config FPBDIV=DIV_2, FWDTEN=OFF, CP=OFF, BWP=OFF
#include <P32xxxx.h>
// defininitions for ADC #define POT 0 //10K pot on AN5
//definitions for interrupts #define _T2IE IEC0bits.T2IE #define _T2IF IFS0bits.T2IF #define _T2IP IPC2bits.T2IP
int ADResult;
void initADC( int amask) int readADC( int ch) main() { int count[10]; int maxcount = 10; int step;
initADC(POT);
// while (1) for(step=0; step<9; step++)
}
Fri, 07 Jun 2013 09:43:47 +0000
Your best bet is to delve into the core of the MPIDE code to see just how the multiple chip types are handled (if at all) in there.
As far as I can tell the only chip-specific bits in there (hardware/pic32/core/pic32/wiring_analog.c - analogRead()) is for the MX1/MX2 chips.