xbee programming question, flow control...
Annoying
Posts: 50
I am communicating between two xbees on two BS2s and I want data to be sent in an alternating fashion, so one xbee sends data, then receives data, back and forth,·indefinitely. I was wondering what the best way is to have the program send the xbee #1 data until the·xbee #2·receives it and then the·xbee #2·sends its data back and so on. maybe it's obvious that the answer is flow control, but i'm really confused about how to use it from the sample code I have seen.
I think this should be enough to show what my code tries to do:
GOSUB GetOwnValue
GOSUB SendValue
·GOSUB GetOtherValue
a lot of IF statements
THE END.
subroutines----
GetOwnValue:
PULSIN Yin, HiPulse, pulse2
RETURN
SendValue:
SEROUT TX,84, [noparse][[/noparse]"*",pulse2.HIGHBYTE, pulse2.LOWBYTE,CR,CR]
RETURN
GetOtherValue:
SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse1.HIGHBYTE,pulse1.LOWBYTE]
RETURN
thank you...
I think this should be enough to show what my code tries to do:
GOSUB GetOwnValue
GOSUB SendValue
·GOSUB GetOtherValue
a lot of IF statements
THE END.
subroutines----
GetOwnValue:
PULSIN Yin, HiPulse, pulse2
RETURN
SendValue:
SEROUT TX,84, [noparse][[/noparse]"*",pulse2.HIGHBYTE, pulse2.LOWBYTE,CR,CR]
RETURN
GetOtherValue:
SERIN RX, 84, [noparse][[/noparse]WAIT ("*"),pulse1.HIGHBYTE,pulse1.LOWBYTE]
RETURN
thank you...
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen