Shop OBEX P1 Docs P2 Docs Learn Events
I2C Programming — Parallax Forums

I2C Programming

ArchiverArchiver Posts: 46,084
edited 2002-09-19 20:20 in General Discussion
Hi,

I'm writing up a Stamp program for controlling a Programmable Clock
Generator. In the message format of the I2COUT of the stamp, is the
SlaveID always in a hexadecimal format?

For example:

I2COUT 0,$A0, 5,[noparse][[/noparse]100]

1)Does $A mean that it is in a HEX format?
2)Is 5 in ASCII? What do I need to do access the address in a HEX
format?
3)What if I need to write the value 100 in a Hex format? [noparse][[/noparse]HEX 100]??

Looking forward to hearing from somebody!

Thanks
Denush

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-09-19 20:20
    You can use any numeric format you choose with any BASIC Stamp instruction.
    If no indicator is present, the value is assumed decimal. A leading $
    indicates hexadecimal and a leading % indicates binary.

    100 [noparse][[/noparse]decimal] = $64 [noparse][[/noparse]hex] = %1100100 [noparse][[/noparse]binary]

    Hint: The Windows calculator -- in Scientific view -- lets you convert
    between formats easily.

    -- Jon Williams
    -- Parallax


    In a message dated 9/19/02 2:13:06 PM Central Daylight Time,
    dineshus2002@y... writes:


    > Hi,
    >
    > I'm writing up a Stamp program for controlling a Programmable Clock
    > Generator. In the message format of the I2COUT of the stamp, is the
    > SlaveID always in a hexadecimal format?
    >
    > For example:
    >
    > I2COUT 0,$A0, 5,[noparse][[/noparse]100]
    >
    > 1)Does $A mean that it is in a HEX format?
    > 2)Is 5 in ASCII? What do I need to do access the address in a HEX
    > format?
    > 3)What if I need to write the value 100 in a Hex format? [noparse][[/noparse]HEX 100]??
    >
    > Looking forward to hearing from somebody!
    >
    > Thanks
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.