converting decimal to 8 bit binary, or do I even need to?


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default converting decimal to 8 bit binary, or do I even need to?

    I need an 8-bit binary number to make the digital potentiometer I'm using work. I'm using an analog potentiometer connected to the ADC to get that number. It seems to give me a decimal number between 0 - 255. I'm assuming this, because the LABX-1 example program http://melabs.com/samples/LABX1-16F887/adcin3x.htm found here. The ADC_BITS is set to 8 instead of the default 10. But I don't see anywhere in the program where the 8-bit ADCIN is converted to decimal. Yet the LCD displays the value in decimal. So I'm assuming that the ADC output is in decimal. Is that correct? If so, what is the best way to convert it to an 8-bit binary number.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: converting decimal to 8 bit binary, or do I even need to?

    Decimal ard hexadecimal just ways for us dumb humans to represent numbers. The PIC does everything in binary so if you want to set the top bit of a port it makes no difference if you write $80 or 128 or %10000000.
    George

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: converting decimal to 8 bit binary, or do I even need to?

    Thanks! I got the digital pot working. It wasn't a matter of binary vs. decimal. I was configuring something else incorrectly.

Similar Threads

  1. Replies: 3
    Last Post: - 22nd June 2015, 16:15
  2. Hex to Decimal to Binary
    By Ramius in forum FAQ - Frequently Asked Questions
    Replies: 3
    Last Post: - 28th March 2014, 01:01
  3. How to convert binary to decimal?
    By Cabomba in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th October 2007, 01:27
  4. Decimal to Binary Conversion
    By schlaray in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2006, 14:58
  5. Binary to Decimal from ADC
    By RYTECH in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th July 2005, 18:51

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