Decimal to Binary Conversion


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default For your purpose . . .

    Hi schlaray,
    Are you asking how to display a number in a different format?
    You can store a number in a variable and display it as you want using the BIN, DEC, or HEX modifiers - see page 143 PB PRO manual and it will display in whichever format you choose. Hope this helps. JS

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    It's not clear what you are trying to do. Study what Joe has proposed. In case you really want to do this ....

    Code:
    ' n^p (n to the power of P)
    ' n = 2
    ' p = 5
    ' x = 2^5 = 32
    ' in PBP
    x var byte
    p var byte
    p = 5
    x = 1
    x = x << p	' x = 32
    
    ' or 
    ' n = 10
    ' p = 3
    ' x = 10 ^ 3 = 1000
    ' in PBP
    x var word
    y var byte
    p var byte
    x = 1
    for y = 1 to p
    x = x * 10
    next y	
    ' x = 1000
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. Binary Coded Decimal
    By -Dan- in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 25th May 2009, 09:23
  2. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  3. microns to decimal conversion
    By Rleonard in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2007, 14:37
  4. Binary to Decimal from ADC
    By RYTECH in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th July 2005, 18:51
  5. Decimal to binary conversion
    By Demon in forum Code Examples
    Replies: 9
    Last Post: - 25th February 2005, 20:05

Members who have read this thread : 0

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