problem with sending data using RF module


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    19

    Default problem with sending data using RF module

    Hello everyone,
    I have a problem with sending data using my RF module, I don't know what the problem is.I try to change the baud rate but nothing happens.Actually I want to send a character using my RF module.But before I accomplish that, I want to test my RF module whether it's function or not.So I use this simple program to test it but my LCD at the receiver board display nothing. I don't know how to troubleshoot the problem because I'm new to this thing.Please help me guys.
    Here is the code and the schematic of my hardware.

    Transmitter part

    CMCON = 7 'Alla I/O Digitala
    LEDPin VAR PORTB.4
    TransmitterPIN VAR PORTA.0
    INCLUDE "modedefs.bas"
    Counter VAR BYTE
    Synk VAR BYTE
    Synk = $55
    DEFINE CHAR_PACING 500
    Counter = 0

    Main:
    HIGH LEDPin
    PAUSE 100
    LOW LEDPin
    PAUSE 100

    SEROUT TransmitterPIN,T2400,[Synk,Synk,9,Counter]

    HIGH LEDPin
    PAUSE 100
    LOW LEDPin
    PAUSE 100

    Counter = Counter + 1
    PAUSE 600
    GOTO Main
    END


    Receiver part

    Define LOADER_USED 1

    ' Define LCD connections
    define OSC 20

    DEFINE LCD_DREG PORTC 'LCD data port
    DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
    DEFINE LCD_RSREG PORTB 'LCD register select port
    DEFINE LCD_RSBIT 7 'LCD register select bit
    DEFINE LCD_EREG PORTB 'LCD enable port
    DEFINE LCD_EBIT 5 'LCD enable bit
    DEFINE LCD_RWREG PORTB 'LCD read/write port
    DEFINE LCD_RWBIT 6 'LCD read/write bit
    DEFINE LCD_BITS 8 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    DEFINE LCD_COMMANDUS 2000 'Command delay time in us
    DEFINE LCD_DATAUS 50 'Data delay time in us

    TRISC = %00000000 'Set port B as output
    TRISB = %00000000 'Set port D as output
    low PORTB.6 'Set the R/W bit to low

    pause 1000 'wait until the LCD initializes

    INCLUDE "modedefs.bas"
    Counter VAR WORD
    ReciverPIN VAR PORTC.0
    ADCON1 = 7 ' Alla digitala
    PAUSE 500

    Main:
    SERIN ReciverPIN,T1200,[9],Counter
    GOSUB LCD
    GOTO Main

    LCD:
    LCDOUT $FE,1
    LCDOUT $FE,$80,#Counter
    PAUSE 500
    RETURN

    END
    Attached Images Attached Images   
    Last edited by rano_zen06; - 2nd April 2008 at 11:19.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    On the receiver code, you must change your ReciverPIN to PORTA.0, Counter must be a Byte, also baudrate must be the same on both sides.

    On the transmitter side, there's a missing DEFINE OSC 20.

    I will suggest you to test it without the RF modules for now. Once you have something workable, just add the modules.

    Make sure the PIC config fuses are correctly set. At least HS_OSC and LVP_OFF.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    On the receiver code, you must change your ReciverPIN to PORTA.0, Counter must be a Byte, also baudrate must be the same on both sides.

    On the transmitter side, there's a missing DEFINE OSC 20.

    I will suggest you to test it without the RF modules for now. Once you have something workable, just add the modules.

    Make sure the PIC config fuses are correctly set. At least HS_OSC and LVP_OFF.
    first of all..thanks mister_e for reply.I already change the code and increase my baud rate.But the result goes the same.My LCD still display nothing, but something unexpectedly happens, when I disconnect the power supply at transmitter board, my LCD at receiver part shows a number.What's actually happens ?Do I need to use encoder/decoder IC? and one more ,how do I test it without RF modules? some tips please? your answer will be greatly appreciated.

    here's my new code

    Tx part

    DEFINE OSC 20
    CMCON = 7 'Alla I/O Digitala
    LEDPin VAR PORTB.4
    TransmitterPIN VAR PORTA.0
    INCLUDE "modedefs.bas"
    Counter VAR BYTE
    Synk VAR BYTE
    Synk = $55
    DEFINE CHAR_PACING 1000
    Counter = 0

    Main:
    HIGH LEDPin
    PAUSE 100
    LOW LEDPin
    PAUSE 100

    SEROUT TransmitterPIN,T9600,[Synk,Synk,Synk,Synk,Synk,Synk,9,Counter]

    HIGH LEDPin
    PAUSE 100
    LOW LEDPin
    PAUSE 100

    Counter = Counter + 1
    PAUSE 600
    GOTO Main
    END

    Rx Part


    Define LOADER_USED 1

    ' Define LCD connections
    define OSC 20

    DEFINE LCD_DREG PORTC 'LCD data port
    DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
    DEFINE LCD_RSREG PORTB 'LCD register select port
    DEFINE LCD_RSBIT 7 'LCD register select bit
    DEFINE LCD_EREG PORTB 'LCD enable port
    DEFINE LCD_EBIT 5 'LCD enable bit
    DEFINE LCD_RWREG PORTB 'LCD read/write port
    DEFINE LCD_RWBIT 6 'LCD read/write bit
    DEFINE LCD_BITS 8 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    DEFINE LCD_COMMANDUS 3000 'Command delay time in us
    DEFINE LCD_DATAUS 200 'Data delay time in us

    TRISD = %00000000 'Set port B as output
    TRISB = %00000000 'Set port D as output
    low PORTB.6 'Set the R/W bit to low

    INCLUDE "modedefs.bas"
    Counter VAR byte
    ReciverPIN VAR PORTA.0
    ADCON1= 7
    PAUSE 500

    Main:
    SERIN ReciverPIN,T9600,[9],Counter
    GOSUB LCD
    GOTO Main

    LCD:
    LCDOUT $FE,1
    LCDOUT $FE,$80,#Counter
    PAUSE 500
    RETURN

    END

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    when I disconnect the power supply at transmitter board, my LCD at receiver part shows a number.What's actually happens ?
    What you receive is some kind of noise generated by the transmitter... kinda garbage stuff... normal thing.

    Do I need to use encoder/decoder IC?
    Not suppose to. Can you post your RF module model?

    and one more ,how do I test it without RF modules? some tips please?
    remove your RF module, and connect your transmitter PORTA.0 directly to your receiver PORTA.0 pin.

    <hr>
    Since you're using True mode, i will suggest you to add the following line in your transmitter code, just before the Main label
    Code:
    HIGH TransmitterPIN
    PAUSE 100
    This will ensure your TransmitterPin idle at the right logic level before sending your data.

    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What PIC are you using? Does it have an ADC that needs disabled?

    When testing the com link with wires, do not forget to also connect the ground between both circuits.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    See pics in POST#1. 16F877A, and seems ADCON1 and CMCON settings are right.

    Once the wire connection will work, i may suspect 2 other things.
    1)open collector output of the receiver
    2)use inverted mode instead. so the pin will idle low.
    Last edited by mister_e; - 2nd April 2008 at 13:48.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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