Shop OBEX P1 Docs P2 Docs Learn Events
Converting to ASCII for a Parallel PCD panel for BS2? — Parallax Forums

Converting to ASCII for a Parallel PCD panel for BS2?

ArchiverArchiver Posts: 46,084
edited 2001-11-26 11:52 in General Discussion
I am experimenting with a LCD panel and want to use it like a simple
digital thermometer.
I want to take a number and convert and output it to a LCD panel using
a BS2 Basic Stamp, the BS2 doesn't have a LCDcmd function.

if I have a word variable that is holding a value, how can I
convert that so it can be outputted to the LCD panel?

For example:
'{$STAMP BS2}
x var word
x = 1236
debug dec x
end

This displays 1236 out the serial port, but how would I show it on
a LCD panel?

Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-26 08:39
    Hi,

    When I have to display numbers, I use an array of characters.

    text VAR byte(16)

    Then, I prepare the text :

    for i=0 to 15
    lookup i,[noparse][[/noparse]"Temperature : "],text(i)
    next

    Finaly, if 'TEMP' is the variable containing the temperature, I use the DIG
    function :

    text(13)=48+(temp dig 1)
    text(14)=48+(temp dig 0)

    48 is the ASCII code of '0'. So if the temperature is 25, you get 50 and 53,
    which are the codes for '2' and '5'

    You just have to send the text array to the display (depending on the model
    you have, serial / parallel)

    Hope this helps...

    Best regards,

    Phil.



    Original Message
    From: <earlwb@w...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, November 24, 2001 5:34 PM
    Subject: [noparse][[/noparse]basicstamps] Converting to ASCII for a Parallel PCD panel for BS2?


    > I am experimenting with a LCD panel and want to use it like a simple
    > digital thermometer.
    > I want to take a number and convert and output it to a LCD panel using
    > a BS2 Basic Stamp, the BS2 doesn't have a LCDcmd function.
    >
    > if I have a word variable that is holding a value, how can I
    > convert that so it can be outputted to the LCD panel?
    >
    > For example:
    > '{$STAMP BS2}
    > x var word
    > x = 1236
    > debug dec x
    > end
    >
    > This displays 1236 out the serial port, but how would I show it on
    > a LCD panel?
    >
    > 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 2001-11-26 11:52
    Thank you very much, the DIG function was what I missed.
    I went through the manual several times and never saw it.
    In regular basic (VB for example) you have CHR, ASC, VAL, et cetera,
    I just never thought about the DIG function.
    Thanks again, I appreciate it.


    --- In basicstamps@y..., "Philippe Derenne" <derennep@s...> wrote:
    > Hi,
    >
    > When I have to display numbers, I use an array of characters.
    >
    > text VAR byte(16)
    >
    > Then, I prepare the text :
    >
    > for i=0 to 15
    > lookup i,[noparse][[/noparse]"Temperature : "],text(i)
    > next
    >
    > Finaly, if 'TEMP' is the variable containing the temperature, I
    use the DIG
    > function :
    >
    > text(13)=48+(temp dig 1)
    > text(14)=48+(temp dig 0)
    >
    > 48 is the ASCII code of '0'. So if the temperature is 25, you get
    50 and 53,
    > which are the codes for '2' and '5'
    >
    > You just have to send the text array to the display (depending on
    the model
    > you have, serial / parallel)
    >
    > Hope this helps...
    >
    > Best regards,
    >
    > Phil.
    >
    >
    >
    >
    Original Message
    > From: <earlwb@w...>
    > To: <basicstamps@y...>
    > Sent: Saturday, November 24, 2001 5:34 PM
    > Subject: [noparse][[/noparse]basicstamps] Converting to ASCII for a Parallel PCD panel
    for BS2?
    >
    >
    > > I am experimenting with a LCD panel and want to use it like a
    simple
    > > digital thermometer.
    > > I want to take a number and convert and output it to a LCD panel
    using
    > > a BS2 Basic Stamp, the BS2 doesn't have a LCDcmd function.
    > >
    > > if I have a word variable that is holding a value, how can I
    > > convert that so it can be outputted to the LCD panel?
    > >
    > > For example:
    > > '{$STAMP BS2}
    > > x var word
    > > x = 1236
    > > debug dec x
    > > end
    > >
    > > This displays 1236 out the serial port, but how would I show it on
    > > a LCD panel?
    > >
    > > Thanks
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > 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.