Transmission works with wires but not always with wireless


Results 1 to 40 of 43

Threaded View

  1. #32
    Join Date
    Apr 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dhouston View Post
    I'm not going to try to read your unformatted code or write the entire application but here are code snippets that show you what you need to do. It sends 4 bits both "as is" and as bitwise complement using a variation of the NEC protocol. I've hardcoded the 4 bits of data as 1101. This is adapted from code I use to send and receive 2-4 bytes so the pins are the ones I used. There are more efficient ways to do things but I've tried to show it step-by-step so you see the logic.
    Code:
    '-----Transmit-----
    SendRF: wb.0=data0  '00000001
            wb.1=data1  '00000001 
            wb.2=data2  '00000101
            wb.3=data3  '00001101
            wb=~wb      '11110010
            wb=wb<<4    '00100000
            wb.0=data0  '00100001
            wb.1=data1  '00100001
            wb.2=data2  '00100101
            wb.3=data3  '00101101
            'bits 0-3=data, bits 4-7=~data
            Low 4
    	For c=1 To Copies
    	  PulsOut 4, 500
              PauseUs 2500
    	  For i=0 To 7
    	    PulsOut 4, 50
    	    If wb.0=1 Then
    	      PauseUs 1500
    	    Else
    	      PauseUs 500
    	    EndIf 
    	    wb=wb>>1
    	  Next
    	  PulsOut 4, 50
    	  Pause 20			
    	Next
    
    '-----Receive-----	
    DEFINE PULSIN_MAX = 550
    	
    RcvRF:  PulsIn GPIO.1, 1, STX
            wb=0
            If STX<450 Then RcvRF
            While GPIO.1=0:Wend
            For i = 0 To 7
              PulsIn GPIO.1, 0, space
              If (space<40) Or (space>175) Then RcvRF
              If (space>75) Then
                wb.0=1				
              EndIf
              wb=wb<<1
            Next i	
            comp=wb>>4
            wb=wb & 7
            If wb + comp = 15 Then
              'wb is good data
            Else
              'wb is corrupt
            EndIf
    If I were to run your code to test it would I code data0=0000001, data1=00000001, data2=00000101, data3=00001101 and then code data0=001000001, data1=00100001, data3=00100101, data3=00101101? Also in the for c=1 to Copies, what is Copies supposed to mean?Also, I discover that when I use my old code and send it through once and view the digital output of the receiver and transmitter input the on the oscilloscope the sequence appears but it does not get picked up by the microcontroller.
    Last edited by jyi1; - 25th April 2007 at 22:26.

Similar Threads

  1. Wireless Tachometer - Design Help
    By DanPBP in forum Off Topic
    Replies: 2
    Last Post: - 3rd May 2009, 09:06
  2. RS485 Vs Wireless (TWS-434A)
    By koossa in forum Off Topic
    Replies: 3
    Last Post: - 11th April 2009, 12:40
  3. Serial Wireless
    By mackrackit in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th May 2007, 16:06
  4. Serial comm - are 2 wires for TX only enough?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 30th August 2006, 03:23
  5. RS 485 wireless communication
    By Armadus in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 26th January 2006, 19:30

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