Simple RF Transmit and Receive


Closed Thread
Results 1 to 40 of 43

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Dave

    Thank you for all your help

    I'm not sure I know how to do this?
    Must I use something like the Pulsin command, I have not done this before?

    The PDF file says the CD signal has a fast response but doesn't say how fast. Instead of trying to use serin/serout I would first just look at the pulsetrain to determine if CD is fast enough that you won't miss bits.
    <hr>

    I am using the LED just to test if it goes low if I send data with the transmitter, just to make sure my circuit is wired correctly and that it only works if my receiver is sending data.

    I have added 2 LEDs for debugging purposes.
    A green one on PortB.4 and a Red one on PortB.5
    If CD is low, the green LED will blink, if CD is high, the Red LED will blink.
    While the transmitter is still powered down, I switch on the receiver, and the Green LED just constantly blink on and off, which tells me that the CD is Low from the beginning?
    When I then swith the Transmitter on and send data, the Green LED still blink at the same frequency?

    I'm not sure if I am missing something, but I am still in the amateur student phase.

    Here is my code.

    <code>
    '************************************************* ***************
    '* Name&nbsp;&nbsp;: Receiver.bas&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp; *
    '************************************************* ***************

    Include "modedefs.bas"

    DEFINE&nbsp;&nbsp;&nbsp;&nbsp; OSC&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp; ' Set the Xtal frequency
    SerialInPin&nbsp;&nbsp; VAR&nbsp;&nbsp; PORTC.2 ' Serial Out
    LEDPin&nbsp;&nbsp;&nbsp;&nbsp; Var&nbsp;&nbsp; PORTC.3
    REDLed&nbsp;&nbsp;&nbsp;&nbsp; VAR&nbsp;&nbsp; PORTB.5
    GreenLED&nbsp;&nbsp;&nbsp;&nbsp;VAR&nbsp;&nbsp; PORTB.4
    CDPin&nbsp;&nbsp;&nbsp;&nbsp; VAR&nbsp;&nbsp; PORTD.2
    DATAReceived&nbsp;&nbsp;VAR&nbsp;&nbsp; Byte
    I&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAR&nbsp;&nbsp; BYTE
    ADCON1 = 7

    Main:
    HIGH LEDPin
    Pause 5000
    Low LEDPin
    &nbsp;&nbsp;
    Loop:

    &nbsp;&nbsp;IF CDPin = 0 THEN
    &nbsp;&nbsp;&nbsp;&nbsp;HIGH GreenLED
    &nbsp;&nbsp;&nbsp;&nbsp;Pause 100
    &nbsp;&nbsp;&nbsp;&nbsp;LOW GreenLED
    &nbsp;&nbsp;&nbsp;&nbsp;PAUSE 100
    &nbsp;&nbsp;else
    &nbsp;&nbsp;&nbsp;&nbsp;HIGH REDLed
    &nbsp;&nbsp;&nbsp;&nbsp;Pause 100
    &nbsp;&nbsp;&nbsp;&nbsp;LOW REDLed
    &nbsp;&nbsp;&nbsp;&nbsp;PAUSE 100
    &nbsp;&nbsp;ENDIF
    Goto LOOP

    END
    </code>

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    If you are connecting the receiver CD pin (pin 3) directly to PORTD.2, CD may not go high enough to be seen as HIGH by PORTD.2. That's why the transistor is needed and why you need to monitor /CD (refer to p6 of the PDF specs for the receiver).

    Look at the code I referenced earlier in Code Examples for how to encode/transmit and receive/decode a pulse train. It's all you need for this application. It sends two bytes. Both bytes are followed by their complement so some basic error detection is built in. One can be an ID and the other indicate motion or all clear. All clear is sent when motion is followed by a period with no motion plus every hour or so to indicate "all's well".

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Dave, I will implement your code, thank you!

    Will it be possible for me to connect the Receiver's RF In Pin to the PC's Comm Port?

    Thx!!

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by koossa View Post
    Will it be possible for me to connect the Receiver's RF In Pin to the PC's Comm Port?
    No. The Receiver RF IN pin is where you connect the antenna.

  5. #5
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by koossa View Post
    Will it be possible for me to connect the Receiver's RF In Pin to the PC's Comm Port?
    No. The Receiver RF IN pin is where you connect the antenna.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    What I mean is the RXD pin, can I connect it to the PC's Comm port.
    Or do I have the wrong understanding of the RXD pin?

  7. #7
    Join Date
    Oct 2007
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Hi....I'm new here and a beginner in PICBasic Pro...

    I'm using PIC 16F877A for Tx and Rx project also....what is the simple code for Tx and Rx?

    Thanks a lot....

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Dave

    In your code for the receiver there is a pin for the pulsout, GPIO.1.
    Is this the CD Pin?

Similar Threads

  1. rf problem
    By -Dan- in forum General
    Replies: 9
    Last Post: - 20th November 2007, 16:05
  2. 16F876 Usart Receive
    By syscoder in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st March 2007, 15:43
  3. Help with CC1100 RF Modules.
    By charudatt in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th November 2006, 20:58
  4. USB Interface using PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 22nd May 2006, 16:04
  5. RF Transmitter
    By et_Fong in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2005, 16:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts