Shop OBEX P1 Docs P2 Docs Learn Events
RF Tx and Rx programming to transmit a character — Parallax Forums
Options

RF Tx and Rx programming to transmit a character

edited 2009-07-22 16:47 in Propeller 1
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:

Comments

  • LeonLeon Posts: 7,620
    edited 2009-07-16 19:52
    Wireless chip? You might need Manchester code.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-16 20:02
    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)"
  • edited 2009-07-21 14:46
    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 GreenMike Green Posts: 23,101
    edited 2009-07-21 15:08
    Please post your entire program as an attachment. It's very difficult to figure out what's wrong when there are pieces missing.
  • edited 2009-07-21 15:24
    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 GreenMike Green Posts: 23,101
    edited 2009-07-21 16:32
    ' 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.
  • JDJD Posts: 570
    edited 2009-07-21 21:33
    Akash,

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

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


    Joshua Donelson
    www.parallax.com
  • edited 2009-07-22 00:04
    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 GreenMike Green Posts: 23,101
    edited 2009-07-22 00:43
    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.
  • JDJD Posts: 570
    edited 2009-07-22 15:05
    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
  • cessnapilotcessnapilot Posts: 182
    edited 2009-07-22 16:47
    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
Sign In or Register to comment.