XC2000, ADC Problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
Hello @ all,

we have a problem to read in an analog input with an XC2000 (XC2269I).
Normaly this task should be very straight forward but we are stuck here for quite some time. I attached a document with our Dave settings and our Main C-Function.
No matter what voltage we put into the adc the converted value is always 300 decimal. No changes in the registers of the ADC.
Does anyone have an idea what we do wrong?

Br, Joe
0 Likes
3 Replies
Not applicable
Short update: I tried the code with the Demo-Board and it works fine. The only difference is that on the Demo Board they use ADC0, Channel 0, we use Channel 3.
Can it be that there is a bug in the call: ADC0_vStartParReqChNum(0x0004); ?
Here is the description which Dave generates:
//****************************************************************************
// @Function void ADC0_vStartParReqChNum(uword uwChannelNum)
//
//----------------------------------------------------------------------------
// @Description This function starts conversion request of analog
// channel.The possible values for the request channels are:
// Bit 0 = 1 -> analog channel 0 is requested for
// conversion
// Bit 4 = 1 -> analog channel 4 is requested for
// conversion
// Bit 8 = 1 -> analog channel 8 is requested for
// conversion
// Bit 12 = 1 -> analog channel 12 is requested for
// conversion
//
//----------------------------------------------------------------------------

I just interpolated that the missing channel 3 is the 3rd Bit set to 1 -> 0x0004
0 Likes
chismo
Employee
Employee
First like received
Hello Joe,

Bit 3 is effectively the 4th bit (assuming we are counting bit 0 <=> 1st bit).
Therefore, the value should be 0x0008, instead of 0x0004?

Regards,
Min Wei
0 Likes
Not applicable
Hello Min Wei,

yes, that was the Problem. Thank you a lot.

Br, Joe
0 Likes