10bit ADC Issue

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

10bit ADC Issue

803 Views
vishaka_maithil
Contributor I

Hello there,

 

Iam using a 16bit controller(MC9S12XS128) for my application.I have configured ADC(10-bit resolution) on 2MHz and my crystal is 16 MHz.

The variables I have used to acquire ADC data(Potentiometer) are 16 bit and when I ty to read the adc data in the transmission buffer of CAN (8 byte dataframe), the value of ADC showing in the buffer is a wrong value. Can anyone please tell me few ADC routines on how to convert 16bit data to 8 bit without losing my actual data?

Labels (1)
Tags (1)
0 Kudos
1 Reply

291 Views
Lundin
Senior Contributor IV

I might be missing something here, but if you configured ADC for 10 bits, you will most likely want to only read those relevant 10 bits from the register. Are you doing this? If you are using the C programming language, this is done by the bitwise & operator. If you are using assembler, it is done by the AND instructions.

 

It is not possible to reduce the 10 bit result to 8 bit without losing accuracy.

 

Could you post the code?

0 Kudos