Shop OBEX P1 Docs P2 Docs Learn Events
Binary To Decimal Conversion — Parallax Forums

Binary To Decimal Conversion

ArchiverArchiver Posts: 46,084
edited 2003-02-26 22:25 in General Discussion
HELP!

I need to write a program to convert a binary number to a decimal
number and visaversa. It can either be in BASIC or JAVA.
Ultimately, I need to port it to the Javelin (Java Stamp by
Parallax), but I am not that sharp on Java, so I will probably get
it running on my BasicII stamp, first.

Any code ideas using pure math (no special BIN2DEC.EXE routines)
would greatly be appreciated.

Thanks,

Matts Persic
mpersic@p...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-02-26 22:25
    See the value prefixes on page 59 of the manual, and the debug command for
    alot of info on this.

    but basically, its easy to go from dec to bin. just get the value to the
    stamp then output it using DEC, HEX, BIN.
    variablea var byte

    variablea = 137

    debug "DEC: ", DEC variablea, CR, "HEX: ", HEX variablea, CR, "BIN: ", BIN
    variablea

    outputs:
    DEC: 137
    HEX: 89
    BIN: 10001001

    -Rob

    Original Message
    From: <mattpersic@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, February 26, 2003 4:33 PM
    Subject: [noparse][[/noparse]basicstamps] Binary To Decimal Conversion


    > HELP!
    >
    > I need to write a program to convert a binary number to a decimal
    > number and visaversa. It can either be in BASIC or JAVA.
    > Ultimately, I need to port it to the Javelin (Java Stamp by
    > Parallax), but I am not that sharp on Java, so I will probably get
    > it running on my BasicII stamp, first.
    >
    > Any code ideas using pure math (no special BIN2DEC.EXE routines)
    > would greatly be appreciated.
    >
    > Thanks,
    >
    > Matts Persic
    > mpersic@p...
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.