Shop OBEX P1 Docs P2 Docs Learn Events
Another question on SEROUT/SERIN — Parallax Forums

Another question on SEROUT/SERIN

holelyholely Posts: 9
edited 2005-03-27 21:15 in BASIC Stamp
Hi all,

I am doing a race management system project, and it requires the system to be able to detect the rankings of each car. Hence I came up with the following simple test programs.

For the host BS2sx, the program is as follows:
=======================
' {$STAMP BS2sx}
com VAR Byte
check:
SERIN 1, 17405, [noparse][[/noparse]com]
IF com=230 THEN l1
IF com=231 THEN l2
GOTO check
l1:
DEBUG "1"
GOTO check
l2:
DEBUG "2"
GOTO check

For lane 1:
=======================
' {$STAMP BS2}
lapin VAR IN7
WAIT1:
IF lapin=1 THEN out
GOTO WAIT1
out:
SEROUT 1, 16780, [noparse][[/noparse]230]
GOTO wait1

For lane 2:
=======================
' {$STAMP BS2}
lapin VAR IN6
WAIT1:
IF lapin=1 THEN out
GOTO WAIT1
out:
SEROUT 1, 16780, [noparse][[/noparse]231]
GOTO wait1



The problem is after the first car(for e.g., lane 1 passes first), "1" is being debugged. Even though lane 2 passes subsequently, "2" is not being debugged.

What could be the problem?

Thanks in advance for any reply.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-27 21:15
    You will very likely run into data collisions with this kind of system. Probably better that you put a group of sensors on the tracks that you can monitor with the master Stamp to look for changes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.