I am Looking for sample ADC code to read only AN7 continuosly for 12 times as ADC output and rest AN0-4 as GPIO inputs, select chip using AN0-4 and its output on AN7.
AN4 AN3 AN2 AN1 AN0 AN7
0 0 0 0 1 ADC output
0 0 0 1 0 ADC output
0 0 0 1 1 ADC output
0 0 1 0 0 ADC output
my program able to read only once for first one, after that not getting correct readings, appreciated.
Solved! Go to Solution.
Hi,
You can find a bunch of ADC sample code in the skeleton project at the bottom of:
http://www.cpustick.com/downloads.htm
Look in sources/adc.[ch] and follow the MCF52233 (I believe) #if's. You can see how pins are configured in sources.pin.[ch], and you can configure AN7 for analog input while configuring the other AN pins for digital output or whatever.
If you're having trouble verifying your hardware is working, you can even load up StickOS and probe the hardware interactively -- it's pretty simple to set output pins or read input pins (even analog input).
-- Rich
Hi,
You can find a bunch of ADC sample code in the skeleton project at the bottom of:
http://www.cpustick.com/downloads.htm
Look in sources/adc.[ch] and follow the MCF52233 (I believe) #if's. You can see how pins are configured in sources.pin.[ch], and you can configure AN7 for analog input while configuring the other AN pins for digital output or whatever.
If you're having trouble verifying your hardware is working, you can even load up StickOS and probe the hardware interactively -- it's pretty simple to set output pins or read input pins (even analog input).
-- Rich