Dear Sir,
While it is not clear what sort of testing you may have already
undertaken, I hope the following information will be helpful.
From your question, it seems that your code works slowly, but possibly
unreliably.
Initially, eliminating hardware problems or trying hardware handshake
is an extremely useful step when debugging serial communication
problems.
Peter Andersons excellent tutorial addresses such issues as the
different voltage levels available from the Basic Stamps various
ports, the need for RX AND TX even if only communicating in one
direction and the details of the Basic Stamps hardware handshake pin
loopbacks. I appreciate that these will be of little relevance if you
have already established a reliable connection between the Basic Stamp
and the PC using another program or application.
I am afraid I could not see where the parameters such as 10, 20 and
120 were passed to waitstamp this may account for some timing issues.
The WebReference.com link is quite relevant to parameter passing. It
was not clear from the question as to whether any of your timeout
errors had been triggered. I apologise if I am missing something.
Peter H. Andersons excellent tutorial specifically dealing with
serial communications for the Basic Stamp.
http://www.phanderson.com/stamp/tutorial_10.html
WebReference.com: Chapter 7 Subroutines from Professional Perl by
Peter Wainwright, Aldo Calpini, Arthur Corliss, Simon Cozens,JJ
Merelo-Guervós, Chris Nandor, Aalhad Saraf, Wrox Press Ltd.
http://www.webreference.com/programming/perl/professional/chap7/3/
This may be of more general interest for other Basic Stamp projects
ideas.
Nuts & Volts Magazine has about 30 mainly hardware projects for the
Basic Stamp
http://www.nutsvolts.com/stmpindx.htm |