Good way to divide 10bit adc by 4?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Good way to divide 10bit adc by 4?

    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.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Good way to divide 10bit adc by 4?

    Left shift 2 bits is my favorite way to do so. But you can only do this to an unsigned value.
    Tim Barr

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Good way to divide 10bit adc by 4?

    Quote Originally Posted by falingtrea View Post
    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 ?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Good way to divide 10bit adc by 4?

    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.

Similar Threads

  1. 10bit ADC thorugh EASY HID (pic 18f2550)
    By jsags1 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2014, 15:20
  2. 10bit ADC with offset on 16F88
    By Amoque in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2012, 16:11
  3. Converting 10bit ADC result to 8 bit
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 5th March 2012, 21:38
  4. Multiple 10bit adc on pic 16f887?
    By Helgeland in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th March 2012, 17:33
  5. 10bit ADC = 65536 ????
    By erpalma in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th January 2007, 18:57

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts