PDA

View Full Version : Good way to divide 10bit adc by 4?



jmgelba
- 17th February 2016, 18:24
Looking to convert a 10 bit 0 - 1023 adc reading to 0 - 255. I've tried dividing by 4, dividing by 2 and putting into a byte then dividing that byte by 2 but I keep getting errors. Is there a better way to do this? Thanks.

falingtrea
- 17th February 2016, 19:16
Left shift 2 bits is my favorite way to do so. But you can only do this to an unsigned value.

aerostar
- 17th February 2016, 19:43
Left shift 2 bits is my favorite way to do so. But you can only do this to an unsigned value.

Shouldn't that be Right Shift 2 ?

HenrikOlsson
- 18th February 2016, 08:32
Why not save the program space and execution time by using the ADC in 8-bit mode instead. Same result as far as I can see, ie throw away the the two least significant bits.

/Henrik.