Shop OBEX P1 Docs P2 Docs Learn Events
Transceiver code — Parallax Forums

Transceiver code

boyinokcboyinokc Posts: 8
edited 2013-04-08 14:33 in BASIC Stamp
I have this code:

' Tcvr_TxCode_v1.1.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
x VAR Word
y VAR Word
HIGH 1 ' T/R Line
DO
PULSOUT 0, 1200 'Sync pulse for the receiver
SEROUT 0, 16468, [ "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
x = x + 1
y = y + 1
PAUSE 10
LOOP


Receiver:

'Tcvr_RxCode_v1.1.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
x VAR Word
y VAR Word
LOW 1 ' T/R Line
DO
LOW 0
SERIN 0, 16468, [WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 0
DEBUG ? x
DEBUG ? y
LOOP

'Tcvr_RxCode_v1.1.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
x VAR Word
y VAR Word
LOW 1 ' T/R Line
DO
LOW 0
SERIN 0, 16468, [WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 0
DEBUG ? x
DEBUG ? y
LOOP

I wanna know how to test if the reviver revives the signal from the transmitter? and I'm using 433Mhz Parralax transeciver

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-07 15:48
    The WAIT("!") tests for a specific character that's expected. If some other character is received, it is ignored. Look at the description of the WAIT() "formatter" in the chapter on the SEROUT statement in the Stamp Manual for details on its operation. The program assumes that the four bytes (plus their start bits and stop bits) that follow are correct. There's no checking for that. There's no other test done for a received signal. There are other sample programs on the webpage for the transceiver that use a CRC code (cyclic redundancy check) to test for correct reception and to force retransmission if there's an error. Look at those for more discussion on this.
  • boyinokcboyinokc Posts: 8
    edited 2013-04-07 16:55
    could you give me the link for more detail please? and btw I am using basic stamp , will it work if I use crc code for basic stamps?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-07 17:52
    Here's the webstore page for the transceiver. About 1/2 way down on the right is a heading "Downloads & Resources:". There is a link to the documentation for the transceiver as well as both a 1-way and 2-way transmit / receive routine with CRC (as .ZIP files). Most Parallax products have links on the product's webpage to documentation and sample code. Any Stamp sample code will usually be written to be used with any of the Stamp models. If you go to the main Parallax webpage and click on the Downloads button, you'll see a webpage with buttons for "Stamp Documentation" and "Educational Tutorials & Translations". The first will have a link to the "Basic Stamp Syntax and Reference Manual" and the second will have a link to the "What's a Microcontroller?" tutorial. Both are fundamental references for Stamp use and you should download and look at them.
  • boyinokcboyinokc Posts: 8
    edited 2013-04-07 21:09
    I got 2 Transceiver 433 MHz RF. One is considered to be transmitted, and one is considered to be received. How do I know my receiver receives signal from transmitter?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-07 21:26
    The only way to tell for certain is to try to send data from one transceiver to the other. The RSSI pin on the transceiver produces a voltage relative to the signal strength received, but is dependent on the actual data being transmitted since the transceiver transmits a signal only when the data line is high. In addition, the RSSI pin can respond to received noise.
  • boyinokcboyinokc Posts: 8
    edited 2013-04-07 22:20
    So I got the transmitter and receiver ! I run the program of transmitter, later I run the code of receiver. It appears a big blue screen without number? Cause I thought it is supposed to appear the value familiar with transmitter? In this case, I don't see any number on the blue screen ? :((
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-08 07:44
    When you start the transmit program from the documentation, the transmitter will start sending two numbers repeatedly incrementing them with each repetition. When you start the receive program, it should wait for the next set of data and display it (repeatedly). If you don't see that, then there's something wrong with your setup. Perhaps you have things wired wrong. Perhaps your power supply isn't working. Perhaps you've entered the programs wrong. It could be anything. The transceivers are tested before they're shipped. They can fail, but it's unlikely.

    Check your wiring. Check your power supplies. Try the CRC examples from the product page ... they transmit and receive more complex data than the simple example from the documentation.
  • boyinokcboyinokc Posts: 8
    edited 2013-04-08 12:29
    Ok, we are getting a bunch of random values for x and y on the receiver side when we aren't transmitting anything, and then as soon as we start transmitting the receiver doesn't debug any values for x and y. I wondered if this could be due to using a basic stamp 2sx to transmit and a basic stamp 2 to receive but I checked the baud rates for each and saw that they are a little different for the 2 and the 2sx but changing this didn't fix our project. I also wonder if this problem could be due to the reciever receiveing noise on this 433MHz frequency, but it doesn't make since that the receiver stops receiving as soon as we transmit..We've double checked our circuit and even had a faculty member check our circuits and they couldn't find anything wrong with the circuits..
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-04-08 13:16
    By any chance have you contacted Tech Support about this?
  • boyinokcboyinokc Posts: 8
    edited 2013-04-08 13:35
    Here is the picture of the circuit
    picture2.jpg
    Picture.jpg
    The power source of Basic Stamp is 9V and Transceiver is 5V
    1024 x 768 - 98K
    1024 x 768 - 112K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-04-08 13:43
    Okay, Tech Support will be replying to you directly via your e-mail submission.
  • boyinokcboyinokc Posts: 8
    edited 2013-04-08 14:19
    You're not using the sample code. You should use the sample code and modify it for the SX chip that you are using. For example, the sample code uses "U!" on the serin, but you just have "!".

    May you give more details please?

    'Tcvr_RxCode_v1.1.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    x VAR Word
    y VAR Word
    LOW 1 ' T/R Line
    DO
    LOW 0
    SERIN 0, 16468, [WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
    HIGH 0
    DEBUG ? x
    DEBUG ? y
    LOOP

    'Tcvr_RxCode_v1.1.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    x VAR Word
    y VAR Word
    LOW 1 ' T/R Line
    DO
    LOW 0
    SERIN 0, 16468, [WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
    HIGH 0
    DEBUG ? x
    DEBUG ? y
    LOOP

    For example: I already adjusted the 2sx on the header of code if that is the 2sx stamp. And still, I can't receive any signal ??
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-04-08 14:33
    Please reply to the e-mail rather than the forum thread. We're currently handing the same issue via forum, e-mail and phone.
Sign In or Register to comment.