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.
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.
Left shift 2 bits is my favorite way to do so. But you can only do this to an unsigned value.
Tim Barr
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.
Bookmarks