A couple of things about what you have.
First off holder=0 doesn't really do anything. I would suspect you were hoping it would make all the bytes 0 in the array. That isn't the case. You would need to create a loop that places a zero in each byte of the array. Second, you don't have a timeout. Without a timeout, you run the real possibility the code will stall.
I altered the code to address some of the issues you are running into. Keep in mind there are a least 3 different ways (maybe more) to accomplish what you are asking. It’s really a matter of style and application, neither of which I can decide for you. In this version of the code, I added length and command. Command handles the command portion of LCDOut (see manual). Length tells the string command when to stop. This should eliminate the blocks. Using this approach, you need to expand the string you are sending from the stamp. (See below) If you didn’t want to specify a length you would need to create a loop to collect the data byte by byte and then use the terminating character that was in the code before. Here again both work, it depends on style and application. Enjoy.
Code:
Holder var byte[20]
Length var byte
Command var byte
main:
serin2 PORTB.0, 16780, Data_Error,[Command, Length ,STR holder\20\Length]
LCDOUT $FE,Command, STR holder\Length
goto main
BS2p Pbasic Code:
Start:
SEROUT 0,17405, [1,5,"hello"] ‘ 1=LCD Clear, 5=Length of hello
PAUSE 1000
GOTO Start
In regards to HSERIN, like the rest of us you will eventually run into a problem and you will need to use hserin to solve it. Usually this occurs when your code starts doing other things and polling for serial data becomes impractical. We all get there at some point.
Bookmarks