Shop OBEX P1 Docs P2 Docs Learn Events
Tranmitting Code/ receiving Code — Parallax Forums

Tranmitting Code/ receiving Code

pbasic7pbasic7 Posts: 5
edited 2011-08-09 18:10 in BASIC Stamp
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
' {$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


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

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2011-08-08 14:51
    It is hard to follow code that is simply pasted into the message box. There is a way to make it keep its formatting..

    attachment.php?attachmentid=78421&d=1297987572

    It would help to know what kind of transceiver, too.
  • $WMc%$WMc% Posts: 1,884
    edited 2011-08-09 18:10
    It looks like your forcing k to = 0 in your RX code.So it will never = 1
Sign In or Register to comment.