RF Transmitter/Reciver


Closed Thread
Results 1 to 40 of 76

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    This codes works pretty well for upp to 50 meter if the antenna of the recviver is not moving and it uses True mode and SERIN/SEROUT and it does´t work with Inverted mode????

    If i´m in the range of 30 meters it does´t miss any numbers or loos the value in the variable "Check".

    Why does the the Serin2 and Serout2 thats used in the BS2 sampel for these 2 modules don´t work at all.

    Are you living in a city area?
    No.

    If not, it is possible that there is another transmitter within 500m?
    I don´t think so but you never know.

    Do you have an oscilloscope?
    Yes at work, but not here at home.

    I´m going to test later whit a wire direkt to the PIC.

    Maybe this modules does´t work better and this?

    What is the diffrens for the LINX modules to be driven by Inverted mode or True mode?
    inverted mode (as in the BS2 from Parallax sampel) shold be the best for these modules, or?

    Code:
    <html>
    <head></head>
    <body><!--StartFragment--><pre><code><font color="#008000"><i>'****************************************************************
    '*  Name    : Transmitter.BAS                                   *
    '*  Author  : Fredrick                                          *
    '*  Notice  : Copyright (c) 2008                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 2008-02-13                                        *
    '*  Version : 2008-02-16                                        *
    '*  Notes   : PIC16F628A @ 4MHz INTORC                          *                                   
    '*          : Anv&auml;nder INTORC BIT 4 1-0 FOSC 2 - FOSC0 = 1 0 0  *
    '*          : TransmitterPIN = PORTB.4                          *
    '*          : LEDpin = PORTB.0                                  *
    '****************************************************************
    </i></font>CMCON = <font color="#808080">7 </font><font color="#008000"><i>'Alla I/O Digitala
    </i></font>LEDPin <font color="#000080">VAR </font>PORTB.<font color="#808080">0
    </font>TransmitterPIN <font color="#000080">VAR </font>PORTB.<font color="#808080">4
    </font><font color="#000080">INCLUDE </font><font color="#FF0000">&quot;modedefs.bas&quot;
    </font>Check <font color="#000080">VAR BYTE
    </font>Counter <font color="#000080">VAR BYTE
    CLEAR
    
    </font>Check = <font color="#808080">254
    
    </font>Main:
        <font color="#000080">HIGH </font>LEDPin    
        <font color="#000080">SEROUT  </font>TransmitterPIN,T2400,[<font color="#808080">$55</font>,<font color="#808080">$55</font>,<font color="#808080">$55</font>,<font color="#808080">63519</font>,Counter,Check]
        <font color="#008000"><i>'PULSOUT TransmitterPIN, 1200 
        'SEROUT2 TransmitterPIN, 16468, [&quot;!&quot;, Counter.HIGHBYTE, Counter.LOWBYTE]
        </i></font><font color="#000080">LOW </font>LEDPin
        Counter = Counter + <font color="#808080">1
        </font><font color="#000080">PAUSE </font><font color="#808080">100
    </font><font color="#000080">GOTO </font>Main
    <font color="#000080">END 
    
    
    </font></code></pre><!--EndFragment--></body>
    </html>

    Code:
    <html>
    <head></head>
    <body><!--StartFragment--><pre><code><font color="#008000"><i>'****************************************************************
    '*  Name    : Reciver.BAS                                       *
    '*  Author  : Fredrick                                          *
    '*  Notice  : Copyright (c) 2008                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 2008-02-13                                        *
    '*  Version : 2008-02-15                                        *
    '*  Notes   : PIC16F872 @ 20 MHz                                *
    '*                                                              *                                                              *
    '*                                                              *
    '****************************************************************
    </i></font>ADCON1 = <font color="#808080">7 </font><font color="#008000"><i>' Alla digitala
    </i></font><font color="#000080">DEFINE </font>OSC <font color="#808080">20
    </font><font color="#000080">DEFINE </font>LCD_COMMANDUS <font color="#808080">3000   </font><font color="#008000"><i>'Set command delay time in us
    </i></font><font color="#000080">DEFINE </font>LCD_DATAUS <font color="#808080">200       </font><font color="#008000"><i>'Set data delay time in us
    </i></font><font color="#000080">DEFINE </font>DEBUG_BAUD <font color="#808080">2400 
    </font><font color="#000080">DEFINE </font>DEBUG_MODE <font color="#808080">0
    </font><font color="#000080">DEFINE </font>DEBUG_REG PORTC
    <font color="#000080">DEFINE </font>DEBUG_BIT <font color="#808080">7   </font><font color="#008000"><i>'PORTC.7 OLIMEX RS232Board
    </i></font><font color="#000080">INCLUDE </font><font color="#FF0000">&quot;modedefs.bas&quot;
    </font>ReciverPIN <font color="#000080">VAR </font>PORTC.<font color="#808080">0
    </font>Check <font color="#000080">VAR BYTE
    </font>Counter <font color="#000080">VAR BYTE
    
    CLEAR
    PAUSE </font><font color="#808080">500
    
    </font>Main:
        <font color="#000080">SERIN  </font>ReciverPIN,T2400,<font color="#808080">500</font>,NoSignal,[<font color="#808080">63519</font>],Counter,Check
        <font color="#008000"><i>'SERIN2 reciverpin, 16468, [WAIT(&quot;!&quot;), Counter.HIGHBYTE, Counter.LOWBYTE]
        </i></font><font color="#000080">IF </font>Check = <font color="#808080">254 </font><font color="#000080">THEN 
            GOSUB </font>LCD
        <font color="#000080">ELSE
            GOSUB </font>NoSignal
        <font color="#000080">ENDIF    
    GOTO </font>Main
    
    LCD:
        <font color="#000080">LCDOUT </font><font color="#808080">$FE</font>,<font color="#808080">1  
        </font><font color="#000080">LCDOUT </font><font color="#808080">$FE</font>,<font color="#808080">$80</font>, #Counter
        <font color="#000080">DEBUG </font>#Counter, <font color="#808080">13</font>,<font color="#808080">10
        </font><font color="#000080">PAUSE </font><font color="#808080">50    
    </font><font color="#000080">GOTO </font>Main
    
    NoSignal:
        Check = <font color="#808080">0
        </font><font color="#000080">LCDOUT </font><font color="#808080">$FE</font>,<font color="#808080">1  
        </font><font color="#000080">LCDOUT </font><font color="#808080">$FE</font>,<font color="#808080">$80</font>, <font color="#FF0000">&quot;No signal!&quot;
        </font><font color="#000080">DEBUG </font><font color="#FF0000">&quot;No signal!&quot;</font>, <font color="#808080">13</font>,<font color="#808080">10
    </font><font color="#000080">GOTO </font>Main
    <font color="#000080">END 
    </font></code></pre><!--EndFragment--></body>
    </html>

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    What is the diffrens for the LINX modules to be driven by Inverted mode or True mode?
    When Inverted logic is used there is no RF carrier while the data line is idle.
    The power amplifier is activated only when a logic "1" is present on the DATA line.

    This is what you have on the DATA line when you use the Inverted logic.


    Best regards,

    Luciano

  3. #3
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Ok, and in True mode you have RF carrier when the DATA line i in idle.

    But i´m still not understanding why its a problem to drive it in true mode, and in my case i have to drive it in true mode for inverted mode does´t work at all.

  4. #4
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Before you test with the RF modules, make sure that your system works when the
    two microcontrollers are connected with a 1k ohm resistor.
    Make sure that the two PIC microcontrollers share the same ground. (GND).

    Code:
    PIC #1                 PIC #2
                 1k
    TX Pin-----/\/\/\------RX pin
    
    GND -------------------GND
    Both microcontrollers must use inverted logic.

  5. #5
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    I have done the Test now.. and here we have the problem

    It dosen´t work whit the BS2 code (SERIN2/SEROUT2) whit wires between the pic´s but the other code whit SERIN and SEROUT works fine.

    What could be the problem?

    Code:
    SERIN2 reciverpin, 16468, [WAIT("!"),Counter]
    Code:
    PULSOUT TransmitterPIN, 1200 
    SEROUT2 TransmitterPIN, 16468, ["!",Counter]
    i´m not sure if the "16468" in the BS2 program shold be the same in a PBP program, i dont understand how to set those bits. but if there shold be "16468" then what else could be wrong?

    EDIT:
    Just find that 9600 baud may be unreliable with 4MHz clock, but it´s still not working when i try to lower the baud to 2400.
    It´s not working in inverted mode whit both SERIN/SEROUT and SERIN2/SEROUT2

    http://www.microengineeringlabs.com/.../ser2modes.htm

    What are i´m doing wrong?

    EDIT2:
    Can it have someting to do whit that i´m using a 4MHz inernal RC on the transmitter? shold i clock it up to 20MHz whit an external crystal like the reciver?
    Last edited by Fredrick; - 17th February 2008 at 00:31. Reason: More info

  6. #6
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi Fredrick,

    A sync pulse of 3000 µs is what is used in the BS1 example visible at page 5 of this doc:
    http://www.parallax.com/Portals/0/Do...ceive-v1.0.pdf
    (In the BS1 sample code the baud rate is 2400).

    I am not a PicBasic Pro user or a Basic Stamp user, so what I can do is very limited
    and based only on the user manuals.

    Here is my version of the PBP code:

    Code:
    ' Transmitter code 
    ' (Clock = 4MHz).
    '
    ' At 4MHz, a PULSEOUT of 300 is OK. 
    ' 300 * 10 µs = 3000 µs 
    ' (See PBP Manual PULSEOUT). 
    '
    ' BAUD MODE = 16780 (Baud rate 2400, 8-bit, no-parity, inverted, output DRIVEN).
    '
    '
    PULSOUT TransmitterPIN, 300  ' sync pulse of 3000 µs 
    SEROUT2 TransmitterPIN,16780,["!",Counter] 
    '

    Code:
    ' Receiver code 
    ' (Clock = From 4MHz to 20 MHz).
    '
    ' BAUD MODE = 16780 (Baud rate 2400, 8-bit, no-parity, inverted).
    '
    '
    SERIN2 reciverpin, 16780, [WAIT("!"),Counter]
    '

    Best regards,

    Luciano

  7. #7
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Does´t work....

    The PIC (16F872) stops at
    SERIN2 reciverpin, 16780, [WAIT("!"),Counter]

    Is there a bug in PBP like the one whit OWOUT that make a never ending loop
    I have version PBP 2.50a

    http://www.picbasic.co.uk/forum/show...79&postcount=4

    Note that both SERIN and SERIN2 make´s the PIC stops when i try to use them whit Inverted mode. whit SERIN and True mode it works..

    UPDATE:
    When i remove "PULSOUT TransmitterPIN, 300" it works....... ??
    Last edited by Fredrick; - 17th February 2008 at 13:30.

Similar Threads

  1. Generic RF Receiver
    By dhouston in forum Code Examples
    Replies: 0
    Last Post: - 8th September 2009, 14:35
  2. Interfacing 16F88 to RF module
    By scomi85 in forum General
    Replies: 2
    Last Post: - 19th February 2009, 12:52
  3. Help with CC1100 RF Modules.
    By charudatt in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th November 2006, 20:58
  4. RF designs
    By Travin77 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th June 2006, 07:50
  5. Interfacting RF Module
    By rastan in forum General
    Replies: 8
    Last Post: - 10th November 2004, 22:27

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