Page 1 of 10 1 2 3 ... LastLast
Results 1 to 10 of 97

Thread: 08M2 TX/RX Project

  1. #1
    New Member
    Join Date
    Oct 2011
    Location
    New England
    Posts
    20

    Default 08M2 TX/RX Project

    Hey everyone,

    I have two breadboards setup with the attached circuits and I am using these transmitter and receiver chips, http://www.sparkfun.com/products/10533 and http://www.sparkfun.com/products/8945. I want to trigger an LED on the receiver side to flash once a mercury switch is tripped on the transmitter side, so pretty simple. I have come a very long way with this project as I have absolutely no prior experience with any of these components or this specific programming language but I am at a bump in the road. I want to flash the LED as long as the mercury switch is connected and when the switch is reset I want the flashing to stop. Here is the code I have for both the transmitter and receiver:

    Transmitter code:

    Code:
    main:
    
        if pinC.3 = 1 then alarm 
            
        goto main
    
    
    alarm:
    
        SEROUT 2,N4800,(1)
        
        if pinC.3 = 0 then main
        
        goto alarm
    Receiver code:
    Code:
    main:
    	SERIN 3,N4800,b1
    	
    	if b1 = 1 then flash
    	
    	goto main
    	
    flash:
    
    	high C.2
    	
    	pause 100
    	
    	low C.2
    
    	pause 100
    	
    	goto main
    I can get the LED to flash a single time when I hold the switch down but it will not continue flashing. I know there is a programming error somewhere because I am not familiar with how a system like this works with sending the data and everything. I believe the use of an interrupt could permit the function I am looking for but I am not sure how to use it in this situation.

    Any help is greatly appreciated! Thanks!RX.pngTX.png
    Last edited by DRock; 05-10-2011 at 20:35.

  2. #2
    Senior Member
    Join Date
    Mar 2011
    Location
    Connecticut, USA
    Posts
    188

    Default

    It looks to me that you added your transmitter code twice and did not include your receiver code.

    Joel

  3. #3
    New Member
    Join Date
    Oct 2011
    Location
    New England
    Posts
    20

    Default

    Why yes I did, thanks for catching that.

    Just updated the post with the receiver code.

  4. #4
    Senior Member
    Join Date
    Mar 2011
    Location
    Connecticut, USA
    Posts
    188

    Default

    Looking at some of the info on the modules that you are using, I would suggest that you use t4800 (non-inverted) serial output instead of the n4800 (inverted) serial out that you tried. Before you send any data set your serout pin high (high c.2).

    Try that, It may help.

    Joel
    Last edited by jtcurneal; 05-10-2011 at 21:10.

  5. #5
    New Member
    Join Date
    Mar 2010
    Location
    italy
    Posts
    2

    Default re

    transmitter code:
    Code:
    main:
    
        if pinC.3 = 1 then alarm 
            
        goto main
    
    
    alarm:
    
        SEROUT 2,N4800,(1)
        
        if pinC.3 = 0 then 
         
         SEROUT 2,N4800,(0)
         
         goto main
        
        endif
    
        goto alarm


    Receiver code:
    Code:
    main:
    	SERIN 3,N4800,b1
    	
    	if b1 = 1 then 
    
    	high C.2
    	
    	pause 100
    	
    	low C.2
    
    	pause 100
    
        endif
    	
    goto main
    evidence in this way
    excuse for English but I'm Italian
    use google to translate

  6. #6

    Default

    If you look through past entries in this forum, you will find that users of wireless TX/RC systems strongly encourage a known prefix to the data in order for the receiver to "train" itself to the signal from the transmitter and to reject spurious noise.

    Also, your code could use some optimizing. So, with that in mind, I suggest...

    Code:
    ' Transmitter code
    do
      if pinC.3 = 1 then
        SEROUT 2,N4800,("ABC", 1)
      end if      
    loop
    
    ' Receiver code
    do
      SERIN 3,N4800,("ABC"), b1
      if b1 = 1 then
        high C.2
        pause 100
        low C.2
        pause 100
      end if
    loop
    The transmitter code should continuously transmit as long as the button is held down. The transmitter will flash the LED every time it receives a transmission.

  7. #7
    New Member
    Join Date
    Oct 2011
    Location
    New England
    Posts
    20

    Default

    Both of those codes just flash the LED one time while I hold the switch down and the T4800 doesn't work at all.

    Hmm, not sure what is going wrong.

    Thanks for the help.

  8. #8
    Senior Member
    Join Date
    Jan 2009
    Location
    Northampton
    Posts
    257

    Default

    if you look at the walkthru on the sparkfun site it says non inverted serial connection (N2400)

    http://www.sparkfun.com/datasheets/R...alkthrough.pdf

    if you search the forum for "rf module" there are loads of examples.
    Using a preamble and a qualifier in the code will help the modules to decipher each other from noise in this band.
    from memory Stan Swan (AKA manuka) is the guru on this subject !

    Regards
    Neil

  9. #9
    New Member
    Join Date
    Oct 2011
    Location
    New England
    Posts
    20

    Default

    Thanks! I wasn't quite sure what to search for but I will do that right now.

    EDIT: After a little research, do I need to add the 10k and 22k resistors to my schematic and breadboard like in this schematic?

    Thanks!

    08M to 08M RF Comms Project 240711.JPG
    Last edited by DRock; 06-10-2011 at 01:45.

  10. #10
    New Member
    Join Date
    Oct 2011
    Location
    New England
    Posts
    20

    Default

    Do you believe adding those would fix my problem? I have been struggling with this project for the greater part of a month now and have done a lot of research but I am a mechanical engineer by trade so this stuff does NOT come easy to me.

    Thanks!

Bookmarks

Posting Permissions

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