
Originally Posted by
Dennis
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.

Originally Posted by
Dennis
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.
Bookmarks