problem with sending data using RF module


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 52
  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.

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


    Did you find this post helpful? Yes | No

    Default

    877A
    Well that is what happens when you do not look at the attachments.

    But on the transmitter part I still do not see ADCON1 = 7.
    And on the receiver part I do not see CMCON = 7.

    And in the schematic pin 3 of the LCD goes straight to ground. No pot for contrast. I know on some modules this works, but are you sure it is this time.

    not much help.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    woopseee ... just saw that missing ADCON1
    but in theory... analog comparator are already disabled at POR...
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    As drawn, both Reset switches are shorting +5V to GND.

    Can you provide details for your transmitter and receiver module manufactiurer/model/pinouts?

    See http://davehouston.org/RFTipsTricks.htm

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hello rano_zen06,
    Looking at your code . . . not however, trying it out . . . Is this all of it? I do not see anything to cause the transmitter to send data from the keypad, unless I have become legally blind . . . or stupid . . . that is why I asked is this all of it. As I said . . I see empty variables in the serout routine.
    Code:
     SEROUT TransmitterPIN,T2400,[Synk,Synk,9,Counter]
    I would try adding a string to the serout routine for test purposes only, something like
    Code:
    SEROUT TransmitterPIN,T2400,$FE,1,["1 2 3 "]
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Joe, seems you missed the underlined section...
    Code:
    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
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Maybe Joe has bifocals like me
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dhouston View Post
    As drawn, both Reset switches are shorting +5V to GND.

    Can you provide details for your transmitter and receiver module
    manufactiurer/model/pinouts?

    See http://davehouston.org/RFTipsTricks.htm
    Sorry for late reply guys,got a lot of homeworks to do. ; )
    The fact is I have less information about my RF module.I just buy it from the nearest electronic store.Since I live here in Chiang Mai ,Thailand...It's hard for me to find a good types of RF module such as PArallax or TWS/RWS 434...For your reference I attach the picture of the RF modules .The link below may help. It was the datasheet of receiver chip used in my RF module.
    http://www.himark.com.tw/images/pdf/...df/RX3310A.zip


    Quote Originally Posted by Joe S. View Post
    Hello rano_zen06,
    Looking at your code . . . not however, trying it out . . . Is this all of it? I do not see anything to cause the transmitter to send data from the keypad, unless I have become legally blind . . . or stupid . . . that is why I asked is this all of it. As I said . . I see empty variables in the serout routine.
    Code:
     SEROUT TransmitterPIN,T2400,[Synk,Synk,9,Counter]
    I would try adding a string to the serout routine for test purposes only, something like
    Code:
    SEROUT TransmitterPIN,T2400,$FE,1,["1 2 3 "]
    Actually what I want to do right now is display the counting numbers on my LCD at receiver board and it's nothing to do with my keypad.I just want to try send a data using my RF module first before I proceed with sending the data from my scanning keypad because I need to know if my RF module able to do it's job or not.

    Quote Originally Posted by mister_e View Post
    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.
    I already connect the Transmitter and the receiver pin directly but it's not work.my LCD only shows a bunch of black box .Maybe the major problem is from my coding or hardware??
    Any other suggestion mister_e ? and how to use inverted mode??
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    LCD only shows a bunch of black box
    PIN 3 on the LCD is for contrast. Hook a pot up as a voltage divider with the wiper going to display pin #3. Then adjust until the black boxes go away. Then try sending "HELLO WORLD" to the display.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Hi, try a direct connection (porta to porta) with following. And of course don't forget to connect the Transmitter board GND with the Receiver board GND.

    Receiver
    Code:
            @       __CONFIG _HS_OSC & _LVP_OFF
            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 BYTE
            ReciverPIN VAR PORTA.0
            ADCON1 = 7 ' Alla digitala
            PAUSE 500
    
    Main:
            SERIN ReciverPIN,T2400,[9],Counter
            GOSUB LCD
            GOTO Main
    
    LCD:
            LCDOUT $FE,1
            LCDOUT $FE,$80,#Counter
            PAUSE 500
            RETURN
    
            END
    Transmitter
    Code:
            @       __CONFIG _HS_OSC & _LVP_OFF
            DEFINE OSC 20
            ADCON1=7
            ;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
            
            HIGH TransmitterPin
            pause 200
    
    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
    If you want to switch to the inverted mode, you just need to change T2400 to N2400, and the HIGH TransmitterPIN to LOW TransmitterPIN.

    Work just fine here.

    Unfortunately your picture don't help... it's a bit fuzzy
    Last edited by mister_e; - 2nd April 2008 at 19:46.
    Steve

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

  16. #16
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Arrow

    Quote Originally Posted by mackrackit View Post
    PIN 3 on the LCD is for contrast. Hook a pot up as a voltage divider with the wiper going to display pin #3. Then adjust until the black boxes go away. Then try sending "HELLO WORLD" to the display.
    thanks for the advice mackrackit.I've tested my LCD before and I found nothing's wrong with it.Even I connect pin 3 directly to the ground, my LCD still can display variable words clearly.

    Quote Originally Posted by mister_e View Post
    Hi, try a direct connection (porta to porta) with following. And of course don't forget to connect the Transmitter board GND with the Receiver board GND.

    Receiver
    Code:
            @       __CONFIG _HS_OSC & _LVP_OFF
            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 BYTE
            ReciverPIN VAR PORTA.0
            ADCON1 = 7 ' Alla digitala
            PAUSE 500
    
    Main:
            SERIN ReciverPIN,T2400,[9],Counter
            GOSUB LCD
            GOTO Main
    
    LCD:
            LCDOUT $FE,1
            LCDOUT $FE,$80,#Counter
            PAUSE 500
            RETURN
    
            END
    Transmitter
    Code:
            @       __CONFIG _HS_OSC & _LVP_OFF
            DEFINE OSC 20
            ADCON1=7
            ;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
            
            HIGH TransmitterPin
            pause 200
    
    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
    If you want to switch to the inverted mode, you just need to change T2400 to N2400, and the HIGH TransmitterPIN to LOW TransmitterPIN.

    Work just fine here.

    Unfortunately your picture don't help... it's a bit fuzzy
    hi mister_e, I feel very sorry about the picture quality. I will attach the better one soon. Just try the code above but the error occur when I try to compile it using my microcode studio and it says " Error TRANSM~1.ASM 94 : [235] opcode expected instead of '0' "
    After remove ' & _LVP_OFF ', microcode studio compile it succesfully.
    The code works fine when I connect my transmitter and receiver pin directly and I can see the counting number display on my LCD.but It only works once when I try it using my RF modules.I got no result after try it the 2nd time.Only static number ( noise) shows up on my LCD.How do i reduce the noise??

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


    Did you find this post helpful? Yes | No

    Default

    There's a long long long way in between, i think you could try the Inverted mode first and then slow the baudrate, say 300bauds.

    You should have a decent distance between the transmitter and receiver ... i think over 3 feets could be enough. Now , i don't know the RF receiver you have, but it's possible that it's output is an open-collector type. I would suggest you to add a 10K pull-up resistor between Vcc and RA.0 to see if it works better.

    If you have any Scope, in the transmitter code, do a loop with SEROUT TransmitterPIN,N2400,[Synk] monitor the RF module output to see how good, bad the signal is.

    On the transmitter AND the receiver module, use a 10-22uF tantalum+0.1uF as close as possible of your rf module. Same thing for your PICs. Try to sit your RF module away of your PICs.

    You can also try to add 1-2 more Synk character at the begining of your transmission. For 1-2 bytes of data you shouldn't need any encoding/decoding even if.

    Begin with it and see what happen. Without any spec of your module, it's a bit hard. Hope you have a scope
    <hr>
    For the compilation error, i used MPASM config fuse syntax, PM will use the following.
    Code:
    @      device HS_OSC, LVP_OFF
    Last edited by mister_e; - 3rd April 2008 at 16:08.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    I'll also suggest you to follow Dave's post
    http://www.picbasic.co.uk/forum/show...79&postcount=9

    If the transmitter output signal is a bit messy, you will need to 'shape it'. Probably the internal comparator could be used here..
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Seems to be the one you're using right?
    http://szyishi.en.alibaba.com/produc..._Receiver.html

    5. Output of receiver module come with noise, also can be no noise in case of special requirement, but the receiving sensitivity will be reduced
    Steve

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

  20. #20
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Seems to be the one you're using right?
    http://szyishi.en.alibaba.com/produc..._Receiver.html
    yes, the model is what I'm using right now. It says the output come with noise and it seems like the main problem.Is there any chance for the receiver to get the sending data clearly without noise If I connect the data pin to LM 741 ?

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


    Did you find this post helpful? Yes | No

    Default

    as i said you could use the internal analog comparator instead.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rano_zen06 View Post
    yes, the model is what I'm using right now. It says the output come with noise and it seems like the main problem.Is there any chance for the receiver to get the sending data clearly without noise If I connect the data pin to LM 741 ?
    If you read the page I referenced earlier, it gives you a method for dealing with the noise.

  23. #23
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    as i said you could use the internal analog comparator instead.
    ok..now there is 3 pin for comparator inside the 16F877A. How do I connect it with my
    Receiver..?? I'm just a little bit confuse with C1out and C2 out which is port A.4 and Port A.5. What's the different between these 2 pins ?? which one should I use? and what is the instruction to turn on the internal comparator??

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


    Did you find this post helpful? Yes | No

    Default

    OK, i'll start a new thread later about how using the internal comparators.

    Do you have any oscilloscope?

    In meantime you could do some test with an external comparator... LM339 and.. yeah lm741 or any other op-amp COULD work.
    Steve

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

  25. #25
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    OK, i'll start a new thread later about how using the internal comparators.

    Do you have any oscilloscope?
    yes, there's a digital oscilloscope at my lab. But at this time, my lab still not open for student. It's just 6.30 in the morning here..so, must wait for 2 hour before I can use it.
    I will use the oscilloscope later to check the output of RF module.Then I will attach the picture of TX and Rx signal for your review.
    Last edited by rano_zen06; - 3rd April 2008 at 21:07.

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


    Did you find this post helpful? Yes | No

    Default

    Almost all (in fact, all of the many that I've used) ASK RF receivers have a dataslicer just before the digital output. The dataslicer uses a comparator (as I explain at http://davehouston.org/RFTipsTricks.htm). Adding another comparator might be useful for educational purposes but is of little practical value (IMO). In this case, the only output from the receiver is digital so the noise pulses will have the same amplitude as the data and the duration of the noise pulses are likely to be nearly the same as the bit period. What kind of comparator circuit are you planning?

    It is far simpler to use a relatively wide sync pulse followed by the data. The receiver can look for the sync pulse and only after receiving it, look for the data. The data can use almost any protocol desired, including RS232 with or without manchester coding. The single, wide sync pulse works much better than multiple $55 sync bytes. I also recommend sending 3 or more copies of each packet, including the wide sync pulse.

  27. #27
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dhouston View Post
    Almost all (in fact, all of the many that I've used) ASK RF receivers have a dataslicer just before the digital output. The dataslicer uses a comparator (as I explain at http://davehouston.org/RFTipsTricks.htm). Adding another comparator might be useful for educational purposes but is of little practical value (IMO). In this case, the only output from the receiver is digital so the noise pulses will have the same amplitude as the data and the duration of the noise pulses are likely to be nearly the same as the bit period. What kind of comparator circuit are you planning?

    It is far simpler to use a relatively wide sync pulse followed by the data. The receiver can look for the sync pulse and only after receiving it, look for the data. The data can use almost any protocol desired, including RS232 with or without manchester coding. The single, wide sync pulse works much better than multiple $55 sync bytes. I also recommend sending 3 or more copies of each packet, including the wide sync pulse.
    I use oscilloscope to check the data pin for my Rx and Tx module without comparator and the result is not very good.The signal I got show a lot of noise especially at my receiver. You can see the waveform picture at my attachment. I also add the comparator using LM741 to my Rx but something bad happen.my LCD shows nothing and my voltage drop from 5v to 2.3V. I think there is something wrong with my comparator circuit.So..I attached together the schematic of my comparator.Anyone here..please help me to troubleshoot this problem.
    Attached Images Attached Images    
    Last edited by rano_zen06; - 4th April 2008 at 16:14.

  28. #28
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Check your comp drawing. If it's correct, you're sending the comp to rails. I think you ment to take the output of the rec to the inverting input, not ground. The 100uf cap is a bit much. I'd use a 1uf or even a .1uf.

    Also, what's the signal look like at 1.8khz (same speed as the tx). Your receiving scope pix says you'r reading at 19.3mhz. If your data is riding on the noise at 1.8khz, you'll need to filter the noise in a LF band pass amp.
    Last edited by JD123; - 4th April 2008 at 16:34.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

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


    Did you find this post helpful? Yes | No

    Default

    There's a load of noise indeed... with that signal.. i don't feel the comparator will be of any help... need something else indeed...

    I have to ask, The RX signal is the one [from the Receiver Without your comparator connected too and a Pull-up on Vcc] or at the output of your LM741.. which will never work as is (forget pin 5 and 1, and connect pin 3 directly to RX pin).

    Maybe the following link will help you a little bit
    http://www.uoguelph.ca/~antoon/gadgets/741/741.html
    http://www.ecircuitcenter.com/Circui...mp/op_comp.htm
    Last edited by mister_e; - 4th April 2008 at 16:44.
    Steve

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

  30. #30
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    There's a load of noise indeed... with that signal.. i don't feel the comparator will be of any help... need something else indeed...

    I have to ask, The RX signal is the one [from the Receiver Without your comparator connected too and a Pull-up on Vcc] or at the output of your LM741.. which will never work as is (forget pin 5 and 1, and connect pin 3 directly to RX pin).

    Maybe the following link will help you a little bit
    http://www.uoguelph.ca/~antoon/gadgets/741/741.html
    http://www.ecircuitcenter.com/Circui...mp/op_comp.htm
    It' s not the output from my LM741. At the moment my Rx data pin connected directly to port A.0. also not using pull up on vcc at that time. In your opinion., should I use filter??

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


    Did you find this post helpful? Yes | No

    Default

    I'm really in between few things... it would be nice to have one of those receiver here to do some test on my side... as shown here there's a load of noise... but your Vmax measure says 80mv, Vamp 136mV (assuming the measure is good... we don't see the v/div input setting)... i don't think it's really the real big problem. the TX show an amplitude of 2.72V :eeK: not sure how good it is for your TX module.

    What i suggest for now, is to use 2 channel on your scope, 1 for TX, 1 for RX, Use 5v/div probe scalling for TX, 500mV - 1 for RX, and post the result(screenshot) here.
    Last edited by mister_e; - 4th April 2008 at 17:30.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    I have tested a SAW controlled transmitter and superregenerative receiver from the same company.Given that they use the same terminology to describe the outputs of both receivers (i.e. output signal is TTL and can be directly connected to decoder) I am confident that the output of your receiver is digital, as is the output of my test receiver. There is not much you can do with a comparator to reduce the noise. Your best bet is to use the techniques I've recommended repeatedly.

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


    Did you find this post helpful? Yes | No

    Default

    Furthermore, if you look at the block diagram in the datasheet from the HiMark RX3310A chip, you will see the comparator in the output circuit. Adding another will not help.

  34. #34
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Wow that really is some sloppy output stage. Try sending a continuous data stream of an
    equal number of 1's & 0's like 55h with a 1mS pause between each byte of data, and capture
    a scope shot of this.

    I'm curious is this data-slicer is ever squaring anything.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  35. #35
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Hello Guys..Thanks for all the advice
    Now my Rx module works fine in a short distance around 5-6 feet.I just add 10k pull up resistor at Rx data pin and 10uF at Vcc.But If I move more than 6 feets, my Rx module start receiving noise and my LCD will display wrong counting numbers.But It's fine to me.At least it's work.I think maybe the problem is from the antenna.I just use a small wire with length 10cm each for my Tx an Rx.So anyone here have any ideas about the antenna??
    Now I'm moving foward to send a data from my keypad. IF I pressed pad1,pad2 and so on..my LCD at transmitter board will display BUS01,BUS02....What I want to do is send the word "BUSxx" each time I pressed the keypad and display it on my LCD at receiver board. So with help and some advice from mister_e..I wrote the code below.But It's not work even I Connect the transmitter and receiver pin directly.
    The FAct Is..I'm very poor with the coding..please help me guys..

    Tx part

    @ device HS_OSC, LVP_OFF
    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

    ' Define program variables
    col var byte ' Keypad column
    row var byte ' Keypad row
    key var byte ' Key value
    TransmitterPIN VAR PORTA.0
    YourByteVar var byte
    INCLUDE "modedefs.bas"
    Synk VAR BYTE
    Synk = $55
    DEFINE CHAR_PACING 500

    ADCON1 = 7 ' Make PORTA and PORTE digital


    Pause 100 ' Wait for LCD to start

    Lcdout $fe, 1, "Key In Bus ID" ' Display sign on message

    loop:
    Gosub getkey ' Get a key from the keypad
    Lcdout $FE, $C0, "BUS",DEC2 key ' Display ASCII key number
    PAUSE 200
    Goto loop ' Do it forever

    ' Subroutine to get a key from keypad
    getkey:
    Pause 50 ' Debounce

    getkeyu:
    ' Wait for all keys up
    PORTD = 0 ' All output pins low
    TRISD = $f0 ' Bottom 4 pins out, top 4 pins in
    If ((PORTD >> 4) != $f) Then getkeyu ' If any keys down, loop
    Pause 50 ' Debounce
    getkeyp:
    ' Wait for keypress
    For col = 0 to 3 ' 4 columns in keypad
    PORTD = 0 ' All output pins low
    TRISD = (dcd col) ^ $ff ' Set one column pin to output
    row = PORTD >> 4 ' Read row
    If row != $f Then gotkey ' If any keydown, exit
    Next col

    Goto getkeyp ' No keys down, go look again

    gotkey: ' Change row and column to key number 1 - 16
    key = (col * 4) + (ncd (row ^ $f))
    Return ' Subroutine over

    Main:
    High TransmitterPin
    pause 200
    SEROUT TransmitterPIN,T2400,[Synk,Synk,"~",YourByteVar]
    pause 500
    GOTO Main
    END


    Rx part

    @ device HS_OSC, LVP_OFF
    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"
    ReciverPIN VAR PORTA.0
    ADCON1 = 7 ' Alla digitala
    YourByteVar var byte


    pause 100
    LCDOUT $FE,1, " Receiving Bus ID"

    Main:
    SERIN ReciverPIN,T2400,["~"],YourByteVar
    GOSUB LCD
    GOTO Main

    LCD:
    LCDOUT $FE,1
    Lcdout $FE,$C0,"BUS",DEC2 YourByteVar
    PAUSE 500
    RETURN

    END

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


    Did you find this post helpful? Yes | No

    Default

    Try those with direct connection.
    Code:
            '
            '       TX code
            '       =======
            '
            @ device HS_OSC, LVP_OFF
            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
            
            TransmitterPIN VAR PORTA.0
            
            DEFINE CHAR_PACING 500
            
            TRISA = 0 'Set port A as output         
            TRISB = 0 'Set port B as output
            TRISC = 0 'Set port C as output
            TRISD = 0 'Set port D as output
            
            ' Define program variables
            INCLUDE "modedefs.bas"
            col     var byte ' Keypad column
            row     var byte ' Keypad row
            key     var byte ' Key value
            Synk    VAR BYTE
                    Synk = $55
            
            ADCON1 = 7 ' Make PORTA and PORTE digital
            
            low PORTB.6 'Set the R/W bit to low        
            High TransmitterPin
            Pause 500 ' Wait for LCD to start
            Lcdout $fe, 1, "Key In Bus ID" ' Display sign on message
    
    loop:
            Gosub getkey ' Get a key from the keypad
            Lcdout $FE, $C0, "BUS",DEC2 key ' Display ASCII key number
            SEROUT TransmitterPIN,T2400,[Synk,Synk,"~",KEY]
            Goto loop ' Do it forever
    
            ' Subroutine to get a key from keypad
    getkey:
            PORTD = 0                   ' All output pins low
            TRISD = $f0                 ' Bottom 4 pins out, top 4 pins in
            WHILE PORTD != $F0 : wEND   ' Wait 'till all key=up
            PAUSE 50                    ' Debounce
    
    ScanKeypad:
            For col = 0 to 3                '
                TRISD=~(DCD COL)            ' Set one I/O to output
                PAUSEUS 5                   ' wait a little bit to avoid
                                            '   erratic results
                                            '
                ROW=ncd((~(PORTD>>4)) & $f) ' read row
                                            '
                IF ROW THEN                 ' Any key pressed?
                    key = ((row-1)*4)+ col+1' --- YES convert key value
                    return                  '     and getout of here
                    ENDIF                   '
                NEXT                        '
            Goto ScanKeypad                 ' No keys down, go look again
    Notice the change in the Keypad scanning routine... this one seems to never have any erratic results now.

    Code:
            '
            '       RX code
            '       =======
            '
            @ device HS_OSC, LVP_OFF
            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
                   
            TRISA = 1 ' PORTA.0 input, other as output
            TRISB = 0 ' Set port B as output
            TRISC = 0 ' Set port C as output
            TRISD = 0 ' Set port D as output
    
            ReciverPIN VAR PORTA.0
           
            ADCON1 = 7 ' Alla digitala
    
            INCLUDE "modedefs.bas"
            YourByteVar var byte 
    
            low PORTB.6 'Set the R/W bit to low
            pause 500 'wait until the LCD initializes
            LCDOUT $FE,1, " Receiving Bus ID"
    
    Main:
            SERIN ReciverPIN,T2400,["~"],YourByteVar
            Lcdout $FE,$C0,"BUS", DEC2 YourByteVar
            GOTO Main
    Side note...There's no major advantage to use LCD in 8 bit mode.. R/W pin could also be tied directly to ground. This done you save 5 I/Os.
    Last edited by mister_e; - 5th April 2008 at 23:25.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rano_zen06 View Post
    So anyone here have any ideas about the antenna??
    To start learning about antennas, go here
    http://www.linxtechnologies.com/Supp...ication-Notes/
    and read app notes AN-00500 and AN-00501.

    Let us know if you need anything clarified.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Forgot to answer you question.

    It looks like you could have the 315 or 434 MHz
    The antenna length for

    315 MHz = 22.63 cm
    434 MHz = 16.43 cm

    The above figures are just "ball park" starting lengths. Use the one for your frequency and even with out a good ground plane you should see improvement.
    Dave
    Always wear safety glasses while programming.

  39. #39
    Join Date
    Mar 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Hello Steve,
    Since I still receive noise..I decide to use Holtek encoder/decoder which is HT12E/HT12D. I construct the circuit following your advice and connect all data pins at HT12E/HT12D to port A0-PortA3.The decoder works fine but the encoder have a little bit problem.That's why I'm not receiving any signal because When I check OSC pin at encoder using logic probe,it show logic low at OSC 1 and show nothing at OSC 2.For your Information, I put 1M resistor between these 2 pins. Don't know what's really happen with my encoder. If you have any idea about the problem..can you please share it with me??

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


    Did you find this post helpful? Yes | No

    Default

    I never used those ICs... maybe you could some something in this document
    http://rentron.com/remote_control/remotes.pdf

    It show different value for the resistor. I didn't read the according datasheet to see if it affect anything though.

    Maybe you screw the OSC signal with your probe.. use a scope instead, set your probe to 10X (or 100X if you have any) and see what happen.

    TE pin should be tied low too unless the oscillator won't run.. as per Their Block Diagram (page 2) in their datasheet.
    http://www.holtek.com/pdf/consumer/2_12ev110.pdf

    As usual, Before you attach your RF modules, try direct connection, Dout to Din of your Holtek ICs.

    HTH
    Last edited by mister_e; - 8th April 2008 at 17:02.
    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 : 1

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