Shop OBEX P1 Docs P2 Docs Learn Events
Converting to HEX — Parallax Forums

Converting to HEX

ArchiverArchiver Posts: 46,084
edited 2004-07-17 00:43 in General Discussion
I have a 3-digit variable called AD0 - 729, 778, 810, etc.

I want to convert the first 2 digits of AD0 to HEX and store it in AD0a.

If AD0 = 729 then AD0a = $72

I want to do the same thing with digit 3 and store it in AD0b

if AD0 = 729 then AD0b = $9

Any suggestions? Remember I'm working with a variable woth unknown digits.

Sid


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-07-16 21:17
    In a message dated 7/16/2004 8:10:43 PM Eastern Daylight Time,
    klaus0@x... writes:


    > Can't you split your variable into 'HIGHNIB' and 'LOWNIB' and then do your
    > conversion on that ?
    >
    > maybe, if I know how to convert a decimal number to the same thing in hex.
    Not the equivalent, but the same thing. In other words I want to convert 72 to
    $72, not to $48, which is the equivalent of decimal 72.

    Sid





    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-07-17 00:43
    Hi Sid,

    Can't you split your variable into 'HIGHNIB' and 'LOWNIB' and then do your
    conversion on that ?

    Regards,

    Klaus
    Original Message
    From: <Newzed@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, July 17, 2004 1:36 AM
    Subject: [noparse][[/noparse]basicstamps] Converting to HEX


    > I have a 3-digit variable called AD0 - 729, 778, 810, etc.
    >
    > I want to convert the first 2 digits of AD0 to HEX and store it in AD0a.
    >
    > If AD0 = 729 then AD0a = $72
    >
    > I want to do the same thing with digit 3 and store it in AD0b
    >
    > if AD0 = 729 then AD0b = $9
    >
    > Any suggestions? Remember I'm working with a variable woth unknown
    digits.
    >
    > Sid
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > 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.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
    >
Sign In or Register to comment.