Reliable wireless data transfer


Results 1 to 12 of 12

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dennis View Post
    So if I wanted to send the value from two 8-pin dip switches I could alter the code to something like
    SW1 var byte
    SW2 var byte

    SW1 =RF[0]
    SW2 =RF[2]
    Am I correct ?
    I think you want it the other way around...
    Code:
    RF[0]=SW1
    RF[1]=~RF[0]
    RF[2]=SW2
    RF[3]=~RF[2]
    [quote'Dennis;81044]
    And since this is a rather well established protocol there should be no need for things like holtek or motorola encoder decoder pairs ..not so ?[/quote]There's no need for additional encoding.
    Quote Originally Posted by Dennis View Post
    Is there any chance of a code snippit to add a 3rd byte of data ?
    Code:
    '-----PIC12F629 using MPASM-----
    ' Sends 2 bytes + their bitwise complements using a variation of the NEC IR protocol
    ' repeats every 15 seconds
                         
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
     
    RF 	VAR	byte[6]
    Copies 	VAR	byte			'RF copies 
    c	VAR	byte			'loop index (RF copies)
    b	VAR	byte			'loop index (RF[b])
    i	VAR	byte			'bit index
    wb	VAR	byte                    'work byte
    
            CMCON = 7	
            Copies = 4       
            'Put data in RF[0],RF[2] & RF[4] & complement in RF[1],RF[3] &RF[5]
    SendRF:	RF[0]=80:RF[1]=~RF[0]:RF[2]=66:RF[3]=~RF[2]:RF[4]=33:RF[5]=~RF[4]
    	Low GPIO.2
    	For c=1 To Copies
    	  PulsOut GPIO.2, 880           '8.8mS lead-in pulse
              PauseUs 4400                  '4.4mS space
    	  For b=0 To 5
                wb=RF[b]
    	    For i=0 To 7                'LSB first
    	      PulsOut GPIO.2, 50        '0.5mS pulse
    	      If wb.0=1 Then
    	        PauseUs 1500            '1.5mS space 
    	      Else
    		PauseUs 500             '0.5mS space
    	      EndIf 
    	      wb=wb>>1
    	    Next
    	  Next
    	  PulsOut GPIO.2, 50            '0.5mS pulse
    	  Pause 40:                     '40mS GAP
    	Next
    	Pause 15000                     '15 SEC DELAY
    	GoTo SendRF
    	
    	End
    I would not try to go beyond 48 bits.
    Last edited by dhouston; - 20th November 2009 at 17:02.

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