Shop OBEX P1 Docs P2 Docs Learn Events
One of two LCD problems — Parallax Forums

One of two LCD problems

GuidoGuido Posts: 195
edited 2004-12-02 00:00 in BASIC Stamp
As usual I am stumped. I am trying to display a result from a lookup expression. Basically just trying to display a Letter. I have two examples here. Example 1 I have converted the letter· to see if I could Display· it using an ASCII and not converting it. Example 2 , is just using the Letter then convert it to an ASCII. Either way I can not get it to display properly. Any help would be greatly appreciated.
Thank You
Guido

EXAMPLE 1
LOOKUP M,[noparse][[/noparse]"78","78 ","83","83","83","69","69 "],A······················· ' Lookup First compass indicator A
ADDR=A
ADDR=ADDR
char =addr
GOSUB LCDcommand
char = DDRam + 14············································································· ' show address at position 14
GOSUB LCDcommand
temp = addr
width = 1
GOSUB lcdwrite·················································································· ‘RESULTS =ASCII just write it

EXAMPLE· 2
LOOKUP M,[noparse][[/noparse]"N","N ","S","S","S","E","N "],A·································· ' Lookup First compass indicator A
ADDR=A
ADDR=ADDR
char =addr
GOSUB LCDcommand
char = DDRam + 14·············································································· ' show address at position 14
GOSUB LCDcommand
temp = addr
width = 1
GOSUB putval······················································································ ‘ Go convert to ASCII then write
············

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-11-30 16:37
    You're working WAY too hard. What you need to do is position the LCD cursor, then send the character to that position.

    char = DDRam + 14
    GOSUB LCDcommand
    LOOKUP (direction / 45), [noparse][[/noparse]"NSSEEWWN"], char
    GOSUB LCDwrite

    This example assums that direction has a value of 0 - 359.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • GuidoGuido Posts: 195
    edited 2004-12-01 00:20
    Jon
    You are a Great! Dam been pulling my hair out along time on that one. Sure feel stupid after you show the problem…Well guess I am! It works great now, and I am learning….The last problem I have with this is trying to display the Compass Degrees. It seems that the readings,·I get goes from 0-about 250 or so before it goes crazy. Sounds like a byte thing, but as you can see I have identified all aspects of it to a word value? Any good ideas?
    Thanks Again for your Help..

    AZIMUTH·············· VAR··· WORD
    RESULT·················· VAR··· WORD

    AZIMUTH = RESULT */360
    ADDR=AZIMUTH
    char = addr
    GOSUB LCDcommand
    char = DDRam + 13 + LINE2
    GOSUB LCDcommand
    temp = addr
    width = 3
    GOSUB PUTVAL
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-01 01:23
    Since you haven't revealed your PutVal code I can't tell what the problem is.· Have a look at this thread:

    http://forums.parallax.com/showthread.php?p=519247

    I attached a program that will print a right-justified number to an LCD -- it should be helpful.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • GuidoGuido Posts: 195
    edited 2004-12-02 00:00
    Jon,

    Thank you for your help, I did find the problem. Its seems I had the addr variable as a byte...changed to Word and worked great. Thanks Again
Sign In or Register to comment.