Processor Expert ADC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Processor Expert ADC

1,404 Views
delv41
Contributor I

I am rather inexperienced and need some help with Processor Expert's ADC bean. I am simply trying to read a 0 to 5 Volt signal. The lines of code I have used are as follows:

/*************************************/

word MyReading;

MYBEANNAME_Measure(TRUE);

MYBEANNAME_GetValue16(&MyReading);

/******************************************/

With 0 to 2.5 Volts at the appropriate pin, MyReading contains 0 to 32768 cnts as expected, but above 2.5 Volts the variable becomes either 0 or indeterminate.

The bean is set to 10 bit resolution.

My processor is MC68HC908QBMDW

I cannot find any "Result Mode" choice on the Bean Inspector.

Thank you in advance,

Len

Labels (1)
0 Kudos
2 Replies

364 Views
Ake
Contributor II
Hello,
I connected a DEMO908QB8 to my PC and tried to get some values from the ADC using Processor Expert.
To get a +5 V and 0 V, I programmed PTA1 to be an output, and measured the signal on the AD1 (PTA1) pin.
It ran nice producing values from 64 to 65472 or 0x0040 to 0xffc0.
As the function GetValue16() was used, the measurements were shifted up, to make the 10 bit result 16 bits. So in reality the 0xffc0 was 0x3ff or 1023 and the 0x0040 was 1.
 
But I guess that this is not your problem.
If you are usng the AD0 input pin, remembere that it is used for the MON08 communication, which could make the input quite unusable.
 
I am including my program.
 
 
Regards,
Ake
 
 
Message Edited by t.dowe on 2009-10-27 01:52 PM
0 Kudos

364 Views
delv41
Contributor I
Thank you Ake,
 
At least I now know that the code should work and my problem is elsewhere. In my case, of course, I am applying actual voltage the pin and not just writing a value to its register. I am pretty sure that PE intializes the pin as input since I do not use it for any other purpose.  I get the problem on AD2 and AD3. AD4 and AD5  are used as well, but I haven't yet determined if they also have the problem. I scan all four channels at 21 microseconds per reading averaging 16 readings (configured in PE). Should I have started with AD1?
 
Len
0 Kudos