Shop OBEX P1 Docs P2 Docs Learn Events
Serin issues — Parallax Forums

Serin issues

WA6ARAWA6ARA Posts: 1
edited 2010-08-26 21:08 in BASIC Stamp
I am reading data from the computer using the SERIN command. In particular the data stream looks like this "AZxxx.x ELxx.x ". I am using the SERIN command like this:
SERIN portin,84,[WAIT("AZ"), DEC AZNew, WAIT(".")]

AZNew return the value 1, always. I can get the individual pieces out using something like this:
SERIN Portin,84,[dum1, dum2, dum3, dum4, dum5, dum6, dum7]

and I can see the individual values and they are correct, for example, dum1="A", dum2="Z", dum3="3", dum4="2" and dum5="0". but DEC AZnew returns the value 1 always. BUT if I use just SERIN portin,84,[DEC AZnew], it returns the correct value of 320.

It appears that the WAIT is not working correctly. What am I doing wrong?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-26 21:08
    The DEC absorbs the terminating character for the number (xxx.) so the WAIT will never see it. If you use DEC3 instead, it stops after 3 characters and the WAIT will succeed. You can then use DEC1 to get the digit after the decimal point.
Sign In or Register to comment.