Shop OBEX P1 Docs P2 Docs Learn Events
decimal to acsii string for LCD — Parallax Forums

decimal to acsii string for LCD

ArchiverArchiver Posts: 46,084
edited 2003-04-29 05:15 in General Discussion
Hello,
I'm trying to get the temp inputs from my DS1620 temp chip to display
on my parallel 2x16 LCD screen. Using DEBUG's SDEC or DEC command
allowed me to echo the temp out the serial line to my terminal window
but that's not want I'm tring to do. Somehow I have to break up the
16-bit word into seperate ASCII char's(up to 3 char's, like "-10"
or "104" ) so I can pulse them out to my LCD. I'm in 4 bit mode BTW

so far this is all I have.

char = TempF.LOWBYTE ' this loads char with the current temp stored
in the lower byte of TempF(WORD VAR)

so now I have a decimal number stored in a variable, and need to get
it on my LCD
any ideas? or maybe someones had this problem and has a subroutine?

only thing I've come up with is to use serialin and serialout
functions(DEC) using 2 pins and then take the in data and out it to
the LCD. (sounds CPU intensive and probly the incorrect way to do it,
must be some math routine.)

also,
Should I just buy a serial LCD? and use serialout with its built in
data formatter? the main reason I don't want to is I bought the
complete stampworks package and would kinda like to use what I have.
Also parallel LCD's are more in my price range also. If anyone can
help please respond ASAP. I'd really like to contine my project.
Thank you very much,
Sean T. Pinkerton

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-04-29 05:15
    It's not tough: Use a loop, the DIG function, then add "0" (to convert to
    ASCII) to send the value to the display. This will work for values less than
    1000:

    Print_Digit:
    FOR idx = 2 TO 0
    char = (myNumber DIG idx) + "0"
    GOSUB LCD_Write
    NEXT


    -- Jon Williams
    -- Parallax


    In a message dated 4/28/2003 9:30:11 PM Central Standard Time,
    mpink2002@y... writes:

    > Hello,
    > I'm trying to get the temp inputs from my DS1620 temp chip to display
    > on my parallel 2x16 LCD screen. Using DEBUG's SDEC or DEC command
    > allowed me to echo the temp out the serial line to my terminal window
    > but that's not want I'm tring to do. Somehow I have to break up the
    > 16-bit word into seperate ASCII char's(up to 3 char's, like "-10"
    > or "104" ) so I can pulse them out to my LCD. I'm in 4 bit mode BTW
    >
    > so far this is all I have.
    >
    > char = TempF.LOWBYTE ' this loads char with the current temp stored
    > in the lower byte of TempF(WORD VAR)
    >
    > so now I have a decimal number stored in a variable, and need to get
    > it on my LCD
    > any ideas? or maybe someones had this problem and has a subroutine?
    >
    > only thing I've come up with is to use serialin and serialout
    > functions(DEC) using 2 pins and then take the in data and out it to
    > the LCD. (sounds CPU intensive and probly the incorrect way to do it,
    > must be some math routine.)
    >
    > also,
    > Should I just buy a serial LCD? and use serialout with its built in
    > data formatter? the main reason I don't want to is I bought the
    > complete stampworks package and would kinda like to use what I have.
    > Also parallel LCD's are more in my price range also. If anyone can
    > help please respond ASAP. I'd really like to contine my project.
    > Thank you very much,
    > Sean T. Pinkerton



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