PDA

View Full Version : ARRAYWRITE to print acsi string



spcw1234
- 15th February 2012, 23:05
I just upgraded to PBP3 because I need to do a bunch of asci strings to an LCD display, and I was told you can do this with arraywrite. Well, I can't get it to work. This code just prints the first letter, how can I make it work?



myarray var byte[20]

arraywrite myarray, ["Hello World",0]
lcdout myarray

Normnet
- 15th February 2012, 23:34
I just upgraded to PBP3 because I need to do a bunch of asci strings to an LCD display, and I was told you can do this with arraywrite. Well, I can't get it to work. This code just prints the first letter, how can I make it work?



myarray var byte[20]

arraywrite myarray, ["Hello World",0]
lcdout myarray


Try

For i = 0 to 19
lcdout myarray[i]
Next

Norm

spcw1234
- 15th February 2012, 23:44
I will give that a try, but that will not suit my application. This is how I am trying to write to my 4D Systems display, I was hoping to minimize having to do a bajillion serout commands, and instead setup an array for the text.



myarray var byte[20]

arraywrite myarray, ["Hello World",0]

serout2 tx, baud, ["s", 0, 1, 2, white1, white2, myarray, $00]
gosub wait1 'check for ACK from display

pedja089
- 16th February 2012, 00:06
Try

LCDOUT $FE,$80, STR myarray

spcw1234
- 16th February 2012, 00:29
Thanks! Exactly what I needed!

pedja089
- 16th February 2012, 02:03
Do same for SEROUT2. STR sends bytes until it reaches byte with value 0. So always keep last byte in array cleared, because pbp doesn't check boundary.

Ioannis
- 16th February 2012, 08:43
Or use STR myarray\x where x is the number of bytes.

Ioannis