PDA

View Full Version : 10Bit ADCIN into 8-Bit WORD?



TerryN
- 15th November 2008, 02:30
Clarify for me, please: I use: "DEFINE ADC_BITS 10" to indicate I'm going to read an analogue value with 10 bits, then later use "ADCIN 2, J_MidPnt", when the value is put into a variable "J_MidPnt" which had been declared a VAR of type WORD. I thought WORDs were 8-bits... What happens to the other two bits? I'm a confused NewBe (Obviously) Thanks!!!!

sinoteq
- 15th November 2008, 03:11
How about if a BYTE is 8 bits and a WORD is 16 bits. Would that make things easier? Now you are so lucky because a WORD is actually 16 bits :) and you are now less confused.

TerryN
- 15th November 2008, 03:27
Immediate accurate information. You gotta love it. Thanks!

sinoteq
- 15th November 2008, 06:01
Just make sure you use the LOW 10 bits of the Word variable, or you will get really funny results. There is a function in the PIC that makes the ADC result left or right justified but maybe you have found this already?