Problem Reading ADC Register in Micro MC9S12C32

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

Problem Reading ADC Register in Micro MC9S12C32

1,466 Views
mdeepamenon
Contributor I
We are using the AN0 of the microcontroller to read the RTD input. When probed the pin of the controller, the voltage appears to be 3.28v. But when we read the ADC register, the value read is 678 counts i.e, 0.05v. The reference voltage is 4.96v (Vcc).
 
The same problem is also seen across AN1-3. We are unable to determine the problem. Though one problem which we suspect would be that the pins might have got damaged. I am not sure whether this is possible. 
 
Other information:
We are using MC9S12C32 and Code warrior 3.1v as the IDE. We are using P&E HCS12 multilink Rev.B for programming and debugging.
 
The ADC register configuration is:
ATDCTL2 = 0x80;
ATDCTL3 = 0x08;
ATDCTL4 = 0x63;
 
ATDCTL5 = 0xA1; // For ADC channel 1
ATDCTL5 = 0xA2; // For ADC channel 2
ATDCTL5 = 0xA3; // For ADC channel 3
ATDCTL5 = 0xA4; // For ADC channel 4
 
We are taking the readings from ATDDR0.
 
 
Please let us know what might be the possible problem.
 
Thanks & regards,
Deepa.
 
Labels (1)
0 Kudos
1 Reply

293 Views
bigmac
Specialist III
Hello Deepa,
 
I cannot quite see that you have a problem.  For 10-bit conversion of an input of 3.28 volts, and with Vref of 4.96 volts, the predicted result would be -
1024 * 3.28 / 4.96 = 677
 
This is very close to the result you are getting.
 
Regards,
Mac
 
0 Kudos