Tranmitting Code/ receiving Code
pbasic7
Posts: 5
I have two transeivers, one acts as a receiver side that also tranmits out a k=1 . The other is my tranmitter side. My problem is that my tranmitter side doesnt ackknoedge the 1 to the serin command in my code below. I used the debug ? k in my code to do error testing but its appears to show bunch of random junk values for my k. ex: k=12345, x=70, y=80 and k=2343, x= 70, y=80. I have been trying to make sure that the tranmitter acknoledges the 1 and the junk values for the k's to disappear. Please see if someone can guide me .
RECEIVER SIDE
TRANSMITTER SIDE
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
y VAR Word
k VAR Word
k=1
HIGH 1
DO
IF (IN3=1) THEN
DO
PULSOUT 1, 1200
SEROUT 0, 84, ["!", k.HIGHBYTE, k.LOWBYTE]
PAUSE 500
LOW 1
'PULSOUT 0, 1200
SERIN 0, 84, [WAIT ("ABC"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 1
PAUSE 10
'SLEEP 3
DEBUG ? x
DEBUG ? y
LOOP
ENDIF
LOOP
' {$PBASIC 2.5}
x VAR Word
y VAR Word
k VAR Word
k=1
HIGH 1
DO
IF (IN3=1) THEN
DO
PULSOUT 1, 1200
SEROUT 0, 84, ["!", k.HIGHBYTE, k.LOWBYTE]
PAUSE 500
LOW 1
'PULSOUT 0, 1200
SERIN 0, 84, [WAIT ("ABC"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 1
PAUSE 10
'SLEEP 3
DEBUG ? x
DEBUG ? y
LOOP
ENDIF
LOOP
TRANSMITTER SIDE
' Tcvr_TxCode_v1.1.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
k VAR Word
x VAR Word
y VAR Word
k = 0
x = 70
y = 80
HIGH 1
LOW 13
DO
DO WHILE (k <> 1) 'the code does not acknowledge k=1 from here
LOW 1
SERIN 0, 84, [WAIT("!"), k.HIGHBYTE, k.LOWBYTE]
HIGH 1
DEBUG ? k
'DEBUG DEC5 k, CR
'LOOP 'does not acknowledge till this point, the rest of
'code works
PULSOUT 0, 1200
SEROUT 0, 84, ["ABC", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
PAUSE 10
'SLEEP 3
DEBUG ? x
DEBUG ? y
SLEEP 1
'ENDIF
k = 0
LOOP
PLEASE help
Comments
It would help to know what kind of transceiver, too.