ADC problem in CrossView Pro C166/ST10

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
Dear Sir/Madam,

I use Tasking EDE C166-ST10 ver 8.8r1 and CrossView Pro C166/ST10 simulator to debug the code. I set PIN_ADC00 =3, PIN_VAREF= 5; PIN_VAGND=0; But the ADC result is always 0. And the ADC0_GLOBSTR.BUSY bit is always 0, ADC0_RCR0.VF bit is always 0. It seems that I cannot get the correct ADC value. Could you please help me to solve this problem?

The following is the code design(also shown in the attached file):

I used Infenion XC2365b to design ADC driver. Using Dave configuration; using ADC0, Parallel source, Permanent arbition; Configure ADC0 Channel 0, resultReg 0; enable Autoscan in Parallel source;

The code is as follows:
main ()
{

MAIN_vInit();

while(1)
{

// USER CODE BEGIN (Main,4)
static uword ChannelNum;


ChannelNum = (1< ADC0_vStartParReqChNum(ChannelNum);
ADC0_vStartParPReqChNum(ChannelNum);
ADC0_vSetLoadEvent();
while((ADC0_uwBusy()==1 );
raw_result = ADC0_uwGetResultData(RESULT_REG_0);
}
}
0 Likes
0 Replies