asyncronous serial comms
cplatt
Posts: 55
I have been communicating with my BS2p from my PC via the ComPort.
Even after reading the manual about the serin command I don't fully get it.
Could someone tell me if I am on the right track? I am not sure about how
to loop and if the pause is necessary. Thank you so much!
Even after reading the manual about the serin command I don't fully get it.
Could someone tell me if I am on the right track? I am not sure about how
to loop and if the pause is necessary. Thank you so much!
'{$STAMP BS2p} ' {$PBASIC 2.5} sData VAR Byte Main: SERIN 1, 16780, [noparse][[/noparse]DEC sData] if sData=20 then High 5 if sData=21 then Low 5 pause 50 goto Main END
Comments
What type of problems are you encountering? How did you calculate the baudmode value of 16780 for a BS2p? You will find that the members of the forum are very supportive but you need to·provide·more information·to get a specific answer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
························ Craig Eid
··········· Triad Research and Development
Electical Engineering Design and Consulting Services
··················· www.TriadRD.com
Post Edited (Craig Eid) : 4/5/2009 7:39:15 AM GMT
....
if·sData=20·then·High·5····· ' turn LED ON
if·sData=21·then·Low·5····· ' turn LED OFF
....
If your only task is to (test) manipulate LED's than "sitting in the loop" without the PAUSE is just fine.
But the real reason to eliminate the PAUSE is·you are dealing with slow data stream and 50 ms pause will make a difference if you data rate is fast.
Hence you can miss some changes as you found out..
·
Thank you everyone for your patients with my vague postings- as a real novice I will try to do better; explain more, remark all code and describe my problems better.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen