rf communication between computer and boe-bot
tom2
Posts: 10
My project is to have a bs2 and with a rx 433mhz connected to a pc by usb cable. On the tx 433 mhz side I have a bs2 on a boe-bot
that will run autonomously. I have the hatachi HM55B compass module programmed to give the coordinates. My problem is I want the boe-bot to transmitt the coordinates to the rx pc side and display them on the debug screen. Unfortunately there is not too much source code from parallax on the rx, tx. I have tried and tried and I am getting nowhere. I don't no where the problem is and I need help. I've attached the hatachi source code from parallax and it comments where the data is displayed but I still can't get it to display on the rx side.
that will run autonomously. I have the hatachi HM55B compass module programmed to give the coordinates. My problem is I want the boe-bot to transmitt the coordinates to the rx pc side and display them on the debug screen. Unfortunately there is not too much source code from parallax on the rx, tx. I have tried and tried and I am getting nowhere. I don't no where the problem is and I need help. I've attached the hatachi source code from parallax and it comments where the data is displayed but I still can't get it to display on the rx side.
Comments
DEBUG HOME, "x-axis N(-S) = ",SDEC x, ' Display axes and degrees
CLREOL, CR, "y-axis W(-E) = ",
SDEC y, CLREOL, CR, CR, "angle = ",
DEC angle, " degrees", CLREOL
PAUSE 150 ' Debug delay for slower PCs
LOOP ' Repeat main loop
Take a look at the RF module documention. Near the end they have some sample source code (available for download from the product page). Make sure that you're looking at the BS2 code.
Finally, you don't need the
PAUSE 150 ' Debug delay for slower PCs
Unless you're running a computer from the 60s, the BS2 will be much slower than the computer. [noparse]:)[/noparse]
from the tx to the rx, "x coordinates = and then the value for x" and then for y so on,
Take a look in the BS2 reference and syntax manual under SEROUT and SERIN.
A primer:
Serout Pin, Baud, [noparse][[/noparse]"!", "x coordinates = ", DEC x]
I'll add that it's not very useful to send the words "x coordinates" since what exactly will the reciever do? Most likely throw them away. It's much easier just to use some formatter like "," to seperate your data to make the DEC command work.
x VAR Word
y VAR Word
DO
PULSOUT 8, 1200 'Sync pulse for the receiver
SEROUT 8, 16468, [noparse][[/noparse] "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
x = x + 1
y = y + 1
PAUSE 10
LOOP
here is what I have on the rx side
©Parallax, Inc. • 433.92 MHz RF Transmitter and Receiver (#27980, #27981) • v1.0 1/06 Page 6 of 8
x VAR Word
y VAR Word
DO
LOW 0
SERIN 7, 16468, [noparse][[/noparse]WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 0
DEBUG " coordinates are x= , y= , " cr,
DEBUG ? y
LOOP
coordinates are x= , y= , over and over, I'm not getting the x or y numeric values
DEC n is a formatter, and it's a sub-parameter of SERIN and SEROUT. Look ath the appropriate command for information about it.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
coordinates are x= , y= ,
y = 0 coordinates are x= , y= ,
y = 0 coordinates are x= , y= ,
y = 0 coordinates are x= , y= ,
y = 0 coordinates are x= , y= ,
y = 0 coordinates are x= , y= ,
It should output this all the time, no matter what the RF modules are doing. The important part to look at is y = 0. Is it really 0 all the time, or does it change? Also, try
Debug DEC5 ? Y
Also double-check that you really do have the transmitter module wired to pin 8 of that BS2, and the receiver module wired to pin 7 of that BS2, and that you have the +5v and Gnd pins of the transmitter and receiver wired to the Vdd and Gnd of their respective BS2 modules.
Post Edited (sylvie369) : 10/30/2008 3:16:22 PM GMT
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Byte
y VAR Byte
DO
PULSOUT 8, 1200 'Sync pulse for the receiver
SEROUT 8, 16780, [noparse][[/noparse] "!", "x coordinates = ",DEC x, " y coordinates = ", DEC y ]
x = x+1
y = y+2
PAUSE 8000
LOOP
on the rx side I had
do
serin 7, [noparse][[/noparse] wait (!), dec x, dec y]
debug ? x
debug ? y
pause 2000
loop
That'd be a problem all right.