Shop OBEX P1 Docs P2 Docs Learn Events
LCDDemo - writestr — Parallax Forums

LCDDemo - writestr

babinda01babinda01 Posts: 54
edited 2008-06-17 14:48 in Propeller 1
Hi
Could someone please point me in the right direction here, I am going nuts trying to figure this out - and I can't afford to go any more crazy.jumpin.gif
I am using the LCDDemo from the object exchange, and I am trying to use the writestr command to display a variable on my LCD like this -·lcd.writestr(ch),
but my problem is that I need to have a "carrage return" and an "end of string" put onto this variable to make it legible, I just can't seem to get it to work.·
If I use a constant ie lcd.writestr(string("Hello", cr , eos)), this works fine.

repeat
if ser.rxcheck
······ ch:=ser.rx
······· 'ser.tx(ch)
······ lcd.pos (1,1)
······ lcd.writestr(string("X:", eos)
······ lcd.pos(1,8)
······ lcd.writestr(ch)····· 'it works up to this point, but when I add this line the display is as crazy as I am.

Regards
Andrew
·

Comments

  • BradCBradC Posts: 2,601
    edited 2008-06-17 14:47
    I suspect the object has a single character output somewhere..
    lcd.out() or similar.
    Short of that you can take the nasty way out and try
    lcd.writestr(string(ch))

    I'd have a look at the object and find the routine that lcd.writestr() uses to output a single character at a time (after all, it has to!)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-17 14:48
    Your problem is that "writestr" expects the address of a string as its argument and "ch" is not a string or the address of a string. I don't have a copy of "LCDDemo" handy, but I'm sure there's another method like "writestr" that handles a single character. That's what you should use instead.
Sign In or Register to comment.