How to WAIT for string
PVJohn
Posts: 60
I know it's very simple, but not simple enough for me. I just got my Demo board
and my plan is to switch one application from BS2 to Propeller. I read about fullduplexserial,
BS2functions and I also checked an example made for el_paisa, but I couldn't find the answer.
Can anyone help me to convert this Pbasic to Spin code? I don't know how to "WAIT" for, and catch
"OK" from replay. In my new application I would like to use pins PO and P1 without MAX233 since
the external unit has 3V UART. Regards, PVJohn
'{$STAMP BS2px}
'{$PBASIC 2.5}
RX········ PIN 4···· ' receive
TX········ PIN 6···· ' transmit
Baud······ CON 1646············ '2400-N-8-1 with MAX 233
SEROUT TX, Baud, [noparse][[/noparse]"TR",CR]····· 'Take Reading command
SERIN· RX, Baud, [noparse][[/noparse]WAIT ("OK")]
SERIN RX, Baud, [noparse][[/noparse]WAIT (34),replay\10\34]··
and my plan is to switch one application from BS2 to Propeller. I read about fullduplexserial,
BS2functions and I also checked an example made for el_paisa, but I couldn't find the answer.
Can anyone help me to convert this Pbasic to Spin code? I don't know how to "WAIT" for, and catch
"OK" from replay. In my new application I would like to use pins PO and P1 without MAX233 since
the external unit has 3V UART. Regards, PVJohn
'{$STAMP BS2px}
'{$PBASIC 2.5}
RX········ PIN 4···· ' receive
TX········ PIN 6···· ' transmit
Baud······ CON 1646············ '2400-N-8-1 with MAX 233
SEROUT TX, Baud, [noparse][[/noparse]"TR",CR]····· 'Take Reading command
SERIN· RX, Baud, [noparse][[/noparse]WAIT ("OK")]
SERIN RX, Baud, [noparse][[/noparse]WAIT (34),replay\10\34]··
Comments
If Spin had "lazy conditionals", that would work. With lazy conditonals, if the term ser.rx == "O" were false, the second term in the and wouldn't be evaluated. But in Spin the entire conditional executes even if its outcome is preordained. So, the string "AOK", for example, wouldn't be recognized as an instance of "OK", since the incoming "A" gets compared with "O" and the "O" with "K". But "ABOK" would pass muster.
-Phil
-P.
Software expect to see " ) " ·right after· "·%0000" in line
··· ser.start(0,1,%0000,2400)
It will take it when I change it to
····ser.start(0,1,%0000)
but then it doesn't work. Am I doing something wrong?
Regards, PVJohn
Thanks.