µTasker Forum
µTasker Forum => FreescaleTM MC9S12NE64 => Topic started by: Marco on February 16, 2009, 04:53:22 PM
-
Hi
I'm trying to figure out how to read analogue on the PAD on the MC9S12NE64, can someone please point me in the right direction?
Cheers
Marco
-
Hi Marco
Here is a very old file which was used once to trigger sending Emails when ADC inputs measured values lower or higher than defined levels.
I haven't use this in a long time but at least you will see how to configure and read the ADC inputs on the NE64.
Regards
Mark
-
Thanks Mark, that really put me on the right track. I setup the port up so that it scans continiously, and set it to multi-channel Mode.
static int State = 0;
if(State==0)
{
ATDCTL3 = 0; // Read all 8 Channels
ATDCTL4 = 0xf3; // 8 bit mode suitable for our bus speed
ATDCTL2 = ADPU; // power up the ADC
ATDCTL5 = 0x30; // Multi-Channel, Scan Mode
State = 1;
}
I just inserted this inside a looping function, and it only runs once.
Because the ADC scans continiously, I can just use ATDDR0H~ATDDR7H to aquire the ADC values. I have tested all the ATD ports symoultaniously on the NeCore12Board, and it seems to work quite well.