Shop OBEX P1 Docs P2 Docs Learn Events
Byte value to ASCII — Parallax Forums

Byte value to ASCII

ArchiverArchiver Posts: 46,084
edited 2003-10-01 06:50 in General Discussion
Hello,

I'm working on a project to display a temperature value (with temp.
sensor DS1624) on a LCD (4-bit mode, hitachi compatible).

The problem I experienced is displaying the temperature value on the
LCD, because I don't know how to convert a binairy value to a string
value (a string value is needed to send to the LCD)

example:

value = %00010011 ( = 19)

howto convert %00010011 to characters "1" and "9" with a minimum of
code?


Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-09-30 09:52
    You can send this directly:
    For BS2:
    LcdBusOut = %0001
    PULSOUT E, 3 : PAUSE 5
    LcdBusOut = %0011
    PULSOUT E, 3
    For BS2p:
    LCDCMD E, %00010011 : PAUSE 5
    might want to look at the LCD Appmod code in AppNote #29121 for more
    details.
    http://www.parallax.com/dl/docs/prod/appmod/lcd%20terminal.pdf

    Dave.


    Original Message
    From: timvlaer [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cdlIgiqxYGm8N8aZF7exo4hnkMbd71SHginLxhkXHDUzDSzKDgn292Kc5i3Mz3EE79kmsLbR]stevie77@m...[/url
    Sent: Tuesday, September 30, 2003 3:08 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Byte value to ASCII

    Hello,

    I'm working on a project to display a temperature value (with temp.
    sensor DS1624) on a LCD (4-bit mode, hitachi compatible).

    The problem I experienced is displaying the temperature value on the
    LCD, because I don't know how to convert a binairy value to a string
    value (a string value is needed to send to the LCD)

    example:

    value = %00010011 ( = 19)

    howto convert %00010011 to characters "1" and "9" with a minimum of
    code?


    Thanks


    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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-30 09:58
    Also, the Help for the PBasic command LCDCMD (BS2p) has very useful
    information even if you are programming to the BS2.
    Dave.

    Original Message
    From: Dave Waddell [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=BsYvW-AcemdX8uTwjbMVSfwZ5QwW-MoyVONyPRYKf_N0wXUMKyxTKpFrBYLJfIojaOAKQ9WFSTE]waddell@p...[/url
    Sent: Tuesday, September 30, 2003 3:52 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Byte value to ASCII

    You can send this directly:
    For BS2:
    LcdBusOut = %0001
    PULSOUT E, 3 : PAUSE 5
    LcdBusOut = %0011
    PULSOUT E, 3
    For BS2p:
    LCDCMD E, %00010011 : PAUSE 5
    might want to look at the LCD Appmod code in AppNote #29121 for more
    details.
    http://www.parallax.com/dl/docs/prod/appmod/lcd%20terminal.pdf

    Dave.


    Original Message
    From: timvlaer [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Am39WDPGofWkaJ6l5CDdfcdpJLKgFHkDEWvu5sLheuEB9422VAXwkls82wWtEt4q6m1iW1BNyPjV]stevie77@m...[/url
    Sent: Tuesday, September 30, 2003 3:08 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Byte value to ASCII

    Hello,

    I'm working on a project to display a temperature value (with temp.
    sensor DS1624) on a LCD (4-bit mode, hitachi compatible).

    The problem I experienced is displaying the temperature value on the
    LCD, because I don't know how to convert a binairy value to a string
    value (a string value is needed to send to the LCD)

    example:

    value = %00010011 ( = 19)

    howto convert %00010011 to characters "1" and "9" with a minimum of
    code?


    Thanks


    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/



    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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-30 14:14
    Value VAR BYTE
    HiVal VAR BYTE
    LowVal VAR BYTE

    Value = %00010011
    HiVal = Value/10
    LowVal = Value - (HighVal * 10)
    ' At this point, HiVal = 1, LowVal = 9
    ' It depends onr you LCD character set
    ' what offset (if any) you need to add
    ' before you send each character to it.

    --- In basicstamps@yahoogroups.com, "timvlaer" <stevie77@m...> wrote:
    > Hello,
    >
    > I'm working on a project to display a temperature value (with temp.
    > sensor DS1624) on a LCD (4-bit mode, hitachi compatible).
    >
    > The problem I experienced is displaying the temperature value on
    the
    > LCD, because I don't know how to convert a binairy value to a
    string
    > value (a string value is needed to send to the LCD)
    >
    > example:
    >
    > value = %00010011 ( = 19)
    >
    > howto convert %00010011 to characters "1" and "9" with a minimum of
    > code?
    >
    >
    > Thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-30 15:53
    Look up the DIG operator in your HELP file or in your manual:

    value = 19 ' %00010011
    debug (value dig 1 + 48) ' ascii 49 = "1"
    debug (value dig 0 + 48) ' ascii 57 = "9"

    -- Tracy


    >Hello,
    >
    >I'm working on a project to display a temperature value (with temp.
    >sensor DS1624) on a LCD (4-bit mode, hitachi compatible).
    >
    >The problem I experienced is displaying the temperature value on the
    >LCD, because I don't know how to convert a binairy value to a string
    >value (a string value is needed to send to the LCD)
    >
    >example:
    >
    >value = %00010011 ( = 19)
    >
    >howto convert %00010011 to characters "1" and "9" with a minimum of
    >code?
    >
    >Thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-01 06:50
    Thanks Tracy, I think the DIG operator will work. It saves me a lot
    of code!

    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > Look up the DIG operator in your HELP file or in your manual:
    >
    > value = 19 ' %00010011
    > debug (value dig 1 + 48) ' ascii 49 = "1"
    > debug (value dig 0 + 48) ' ascii 57 = "9"
    >
    > -- Tracy
    >
    >
    > >Hello,
    > >
    > >I'm working on a project to display a temperature value (with temp.
    > >sensor DS1624) on a LCD (4-bit mode, hitachi compatible).
    > >
    > >The problem I experienced is displaying the temperature value on
    the
    > >LCD, because I don't know how to convert a binairy value to a
    string
    > >value (a string value is needed to send to the LCD)
    > >
    > >example:
    > >
    > >value = %00010011 ( = 19)
    > >
    > >howto convert %00010011 to characters "1" and "9" with a minimum of
    > >code?
    > >
    > >Thanks
Sign In or Register to comment.