Shop OBEX P1 Docs P2 Docs Learn Events
Byte question from a newbie — Parallax Forums

Byte question from a newbie

HughHugh Posts: 362
edited 2008-11-16 20:57 in Propeller 1
Hi,

This is my first post and it may expose me as being a bit of a thickie, so please bear with me - I've checked the manual and the stickies but not found the information I need, (or that I think I need...)

I am driving a serial LCD module (using LCD_Debug.spin as a starting point, but adapted for a Matrix Orbital display)

If I use:

lcd.str(string("Hello World", 13))

everything is hunky-dory.


If, however, I set up a variable 'Tes' as

DAT Tes BYTE "Hello World"

and then in MAIN

Index := 0
Repeat 8
Temp := Tes[noparse][[/noparse]Index++]
lcd.str(Temp)


a lot of gobbledeegook is displayed. My question is basically, how I can persuade it that each byte of the byte array is a String?

lcd.str(string(Temp))

doesn't compile.

As I say, I may just be being a thickie, but any help would be gratefully received.

Thanks
Hugh

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-16 20:08
    lcd.str expects the address of a string of bytes ended by a byte containing zero.

    What you want is lcd.out which expects a character as an argument. You'd use lcd.out(Temp)
  • HughHugh Posts: 362
    edited 2008-11-16 20:09
    Thanks Mike!
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-11-16 20:57
    I'm not using it on an LCD at the moment, but I suspect you could also do this:

    DAT Tes BYTE "Hello World", 0
    
    lcd.str(@Tes)
    



    That is, end your output string with a 0, and then pass its address using "@".
Sign In or Register to comment.