PDA

View Full Version : RF Tx and Rx programming to transmit a character



07-17-2009, 01:08 AM
Here is our code for the RFrx. It isgiving us funny outputs even in the absennse of any input:

RECEIVED VALUE is:ww
RECEIVED VALUE is:NN
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:ss
RECEIVED VALUE is:{{
RECEIVED VALUE is:
UE is: VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:]]
RECEIVED VALUE is:vv
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:
RECEIVED VALUE is:

we used the functions on the object exchange (http://obex.parallax.com/objects/30/) as follows for the receiver:

OBJ
pst : "Parallax Serial Terminal" 'from display (Serial communication)
PUB main
pst.Start(2400)
repeat 50
rec := SERIN_CHAR(1,2400,0,8)
pst.Str(String(pst#NL,"RECEIVED VALUE is:")) ' Announce output
pst.Chars(rec,2)


and for the transmitter we used:
PUB main
pst.Start(2400)
pst.Chars(pst#NL, 2) ' Carriage returns
pst.Str(String("Enter character: ")) ' Prompt user to enter value
val := pst.CharIn
PULSOUT_uS(7,2400) 'SYNCHRONIZATION SIGNAL
SEROUT_CHAR(7,val,2400,0,8)


we also tried taking out the repeat from the rx code and inserting repeat in both cases with no meaningful output.

Any help would be appreciated

Thanks

Leon
07-17-2009, 02:52 AM
Wireless chip? You might need Manchester code.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Mike Green
07-17-2009, 03:02 AM
You didn't say what transmitter / receiver you're using. If it's Parallax's UHF units, then I believe they use inverted signal levels with the signals idling at ground instead of Vdd. You need to use inverted mode. Instead of using "pst.start(2400)" try "pst.startRxTx(31,30,%0011,2400)"

07-21-2009, 09:46 PM
we are using parallax RF modules (Tx Rx)
We are using mode = 0 in the SERIN_CHAR function and that is inverted mode?!
We also tried replacing the start with the line you sent instead and it didnt work (the enter character line didn't even pop up like it used to?)

Still receiving funny characters?
we also tried the debug in function and are having the same problem?

any help is appreciated!
thanks

Mike Green
07-21-2009, 10:08 PM
Please post your entire program as an attachment. It's very difficult to figure out what's wrong when there are pieces missing.

07-21-2009, 10:24 PM
this is what we have been trying to use with the BS2 functions
-the repeat can be taken out but i put it in to make sure it will get a signal.

Mike Green
07-21-2009, 11:32 PM
' DO NOT USE Parallax Serial Terminal. It's not needed. You already have DEBUG
' You may want to change DEBUG_BAUD depending on the Baud used by your PC program
' since the default value is 9600.



'OBJ
'
' pst : "Parallax Serial Terminal" 'from display (Serial communication)
PUB main
' ************************************************** ************************************
' * NOTE: YOU MUST START THE OBJECT as it sets up the timing for many functions *
' ************************************************** ************************************
start(31,30) ' Start the BS2 object
repeat 50
rec := SERIN_CHAR(1,2400,0,8)
DEBUG_STR(String(13,"RECEIVED VALUE is:")) ' Announce output
DEBUG_CHAR(rec) ' You don't need to display the character twice






'OBJ
'
' pst : "Parallax Serial Terminal" 'from display (Serial communication)
PUB main
' ************************************************** ************************************
' * NOTE: YOU MUST START THE OBJECT as it sets up the timing for many functions *
' ************************************************** ************************************
start(31,30) ' Start the BS2 object
DEBUG_STR(String(13,13,"Enter character: ")) ' Prompt user to enter value
val := DEBUGIN_CHAR
repeat 50
PULSOUT_uS(7,2400) ' Send SYNCHRONIZATION SIGNAL
SEROUT_CHAR(7,val,2400,0,8) ' Send character
PAUSE(250) ' Allow time for receiver to display
' received value before sending again



Note: You've taken the BS2 Compatibility Library and grafted on a small start routine
to make your program. That's not how the BS2 Compatibility Library is supposed to be
used. You're supposed to use it as an object without changes. Look at the demo program
that comes with the BS2 Compatibility Library. That's what you're supposed to modify to
make your own program

Note: The serial I/O routines in the BS2 Compatibility Library are not buffered just like
the Stamp itself. The Parallax Serial Terminal routines are buffered, but you don't need
that for testing purposes as long as you include the PAUSE in the transmit program. That
allows the receive program to display its message, then start the SERIN_CHAR routine again.
Without the PAUSE, the transmit program would send another character while the receive
program is displaying its message and it would miss the character being sent.

JD
07-22-2009, 04:33 AM
Akash,

Have you tried what Mike has suggested? If so, what were the results?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

07-22-2009, 07:04 AM
yes, we tried what mike said but it does not show the "enter character" in the parallax serial terminal. When i type a character the receiver gets a bunch of weird letters. im guessing that is noise and other things in the air.

Mike Green
07-22-2009, 07:43 AM
Remember that you need to set the Parallax Serial Terminal and DEBUG_BAUD to the same Baud. The default for the BS2 Compatibility Library is 9600 as I mentioned earlier.

JD
07-22-2009, 10:05 PM
Akash,

It does sounds like the modules are not using the proper baud rate; garbage characters are a key indicator that the baud rate should be reviewed. Can you post a screen shot of your PST giving the wierd characters?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

cessnapilot
07-22-2009, 11:47 PM
Akash,


Rf receivers usually increase the gain in absence of RF input. That results in random TTL levels at their output. Those random bits/bytes can fill the buffer of the UART quickly. From the transmitting size send a continuous series of a character, like 'AAAAAAAAAAAAAAAAA...'. At the receiver size that will quiet the noise, and after having the correct baud rate, you should receive 'AAAAAAAAAA's. Then to get the signal out of the noise, send a synchronizing header like 'ITSME' before the message. That message is not likely to came out from the noise, and the characters after it are probably correct, if your Rf has enough field strength. This method worked several times to get Rf link between BS2s, and now works between 2 Props.

Istvan