10bit ADC Issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

10bit ADC Issue

1,245 次查看
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?

标签 (1)
标记 (1)
0 项奖励
回复
1 回复

733 次查看
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 项奖励
回复