I’m working on ADuC 7021 microcontroller. But now I’m stucked with ADC reading. While reading the ADC channel directly it gives the correct count. But if I’m trying to read the ADC count on the timer ISR, some error occurred. Timer 0 (400ms)and timer 1 (50ms)are enabled. But by giving some delay (delay count 1500)on the ADC reading routine, exact value have been obtained. Here what may be the issue?
Also the temperature obtained by means of the internal temperature is also wrong. Say, for 30c it gives 130c.
Here is the routine.
ADCCON = 0x0624;
unsigned short usGetADCChannel(unsigned char ucChannel)
unsigned short usADCData;
IRQEN &= ~RTOS_TIMER_BIT;
IRQEN &= ~GP_TIMER_BIT;
ADCCP = ucChannel;
REFCON = 0x01;
ADCCON |= SWSTART;
while((ADCSTA & EOC) == 0);
ADCCON &= ~SWSTART;
usADCData = ADCDAT>>16;
IRQEN |= RTOS_TIMER_BIT;
IRQEN |= GP_TIMER_BIT;
Thanks 4 ur replys………..JJJ
thanks and regards,
Sreekumar K S
From: MMA firstname.lastname@example.org
Sent: Thursday, April 07, 2011 10:22 AM
To: Sreekumar K S
Subject: New message: "ADC is not working properly in ADuC7021"
<http://ez.analog.com/index.jspa> Analog Devices EngineerZone
ADC is not working properly in ADuC7021
reply from MMA <http://ez.analog.com/people/MMA> in Analog Microcontrollers - View the full discussion <http://ez.analog.com/message/22488#22488