how to develop RF 16f84a programming

Status
Not open for further replies.

zawani

Newbie level 6
Joined
Mar 15, 2006
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,701
I MEAN HOW TO DEVELOP PROGRAMMING FOR RF CONTROLLER USING PIC 16F84A. I TAKE SORCE CODE AT https://www.hobby-elec.org BUT NOT FUNTION TO CIRCUIT. CAN SOME BODY HELP ME TO REPAIR PROGRAMMING BELOW

;********************************************************
;
; Remote Controller Transmitter
;
; Author : zawani
;********************************************************

list p=pic16f84a
include p16f84a.inc
__config _HS_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
errorlevel -302 ;Eliminate bank warning


;**************** Label Definition ********************
cblock h'0c'
tx_status ;TX status save area
tx_substatus ;TX substatus save area
pattern ;Pattern save area
endc

ptn1 equ b'11110000' ;Pattern 1 data
ptn2 equ b'00001111' ;Pattern 2 data
ra4 equ d'4' ;RA4 bit position

;**************** Program Start ***********************
org 0 ;Reset Vector
goto init
org 4 ;Interrupt Vector
goto int

;**************** Initial Process *********************
init bsf STATUS,RP0 ;Change to Bank1
movlw b'00000011' ;RA4:OUT RA1,0:IN mode
movwf TRISA ;Set TRISA reg
movlw b'00000101' ;RBPU/TOCS/PSA=0,PS=101
movwf OPTION_REG ;Set OPTION_REG
bcf STATUS,RP0 ;Change to Bank0

clrf PORTA ;Stop wave emission
clrf tx_status ;Clear TX status
clrf tx_substatus ;Clear TX substatus

movlw b'00000001' ;Set mask pattern
andwf PORTA,W ;Pick up RA0
btfsc STATUS,Z ;RA0 = 1 (SW1 ON) ?
goto in1 ;No. Check next input
movlw ptn1 ;Set pattern1 data
in0 movwf pattern ;Save pattern data
goto tm ;Jump to timer set
in1 movlw b'00000010' ;Set mask pattern
andwf PORTA,W ;Pick up RA1
btfsc STATUS,Z ;RA1 = 1 (SW2 ON) ?
goto init ;No. Illegal input
movlw ptn2 ;Set pattern2 data
goto in0 ;Jump to pattern save

tm movlw d'100' ;256-10000us/64us = 100
movwf TMR0 ;Set 10msec to TMR0
movlw h'a0' ;GIE=1,TOIE=1
movwf INTCON ;Interruption enable

goto $ ;Wait interruption

;********* Begin Timer Interruption Process ***********
int
bcf INTCON,T0IF ;Clear timer int flag

stchk0
movf tx_status,W ;Read TX status
btfss STATUS,Z ;TX status = 0 ?
goto stchk1 ;No. Next

;************ Preamble data send Process **************
movlw d'7' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfsc STATUS,Z ;Substatus = 7 ?
goto stinc ;Yes. Substatus + 1
movlw d'8' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfsc STATUS,Z ;Substatus = 8 ?
goto st01 ;Yes.
movlw d'9' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfsc STATUS,Z ;Substatus = 9 ?
goto st02 ;Yes.
movlw b'00000001' ;Set mask pattern
andwf tx_substatus,W ;Pick up LSB
btfss STATUS,Z ;LSB = 0 (Even) ?
goto st00 ;No. (Odd)
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1
st00 bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st01 bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st02 bsf PORTA,ra4 ;Start wave emission
clrf tx_substatus ;Clear TX substatus
incf tx_status,f ;Set TX status = 1
goto int_end ;Jump to timer int end

;********************************************************
stchk1
movlw d'1' ;Set check data
subwf tx_status,W ;TX status - check data
btfss STATUS,Z ;TX status = 1 ?
goto stchk2 ;No. Next

;************ Control data send Process ***************
movf tx_substatus,W ;Read TX substatus
btfss STATUS,Z ;Substatus = 0 ?
goto st11 ;No. Next
movlw b'00000001' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st10 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st10 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st11 movlw d'1' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 1 ?
goto st12 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st12 movlw d'2' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 2 ?
goto st13 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st13 movlw d'3' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 3 ?
goto st15 ;No. Next
movlw b'00000010' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st14 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st14 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st15 movlw d'4' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 4 ?
goto st16 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st16 movlw d'5' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 5 ?
goto st17 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st17 movlw d'6' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 6 ?
goto st19 ;No. Next
movlw b'00000100' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st18 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st18 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st19 movlw d'7' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 7 ?
goto st20 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st20 movlw d'8' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 8 ?
goto st21 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st21 movlw d'9' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 9 ?
goto st23 ;No. Next
movlw b'00001000' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st22 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st22 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st23 movlw d'10' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 10 ?
goto st24 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st24 movlw d'11' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 11 ?
goto st25 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st25 movlw d'12' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 12 ?
goto st27 ;No. Next
movlw b'00010000' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st26 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st26 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st27 movlw d'13' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 13 ?
goto st28 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st28 movlw d'14' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 14 ?
goto st29 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st29 movlw d'15' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 15 ?
goto st31 ;No. Next
movlw b'00100000' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st30 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st30 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st31 movlw d'16' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 16 ?
goto st32 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st32 movlw d'17' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 17 ?
goto st33 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st33 movlw d'18' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 18 ?
goto st35 ;No. Next
movlw b'01000000' ;Set mask pattern
andwf pattern,W ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st34 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st34 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st35 movlw d'19' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 19 ?
goto st36 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st36 movlw d'20' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 20 ?
goto st37 ;No. Next
bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st37 movlw d'21' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 21 ?
goto st39 ;No. Next
movlw b'10000000' ;Set mask pattern
andwf pattern,w ;Pick up data
btfss STATUS,Z ;Data = 0 ?
goto st38 ;No. Data = 1
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1
st38 bsf PORTA,ra4 ;Start wave emission
goto stinc ;Jump to Substatus + 1

st39 movlw d'22' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 22 ?
goto st40 ;No. Next
bcf PORTA,ra4 ;Stop wave emission
goto stinc ;Jump to Substatus + 1

st40 bsf PORTA,ra4 ;Start wave emission
clrf tx_substatus ;Clear TX substatus
incf tx_status,f ;Set TX status = 2
goto int_end ;Jump to timer int end

;************** End data send Process *****************
stchk2 movlw d'2' ;Set check data
subwf tx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 2 ?
goto stinc ;No.Jump to Substatus + 1
bcf PORTA,ra4 ;Stop wave emission
clrf tx_substatus ;Clear TX substatus
clrf tx_status ;Clear TX status
goto int_end ;Jump to timer int end

;*********** Substatus Increment Process **************
stinc incf tx_substatus,f ;Substatus + 1

;******** End of Timer Interruption Process ***********
int_end movlw d'100' ;256-10000us/64us = 100
movwf TMR0 ;Set 10msec to TMR0
retfie ;End of interruption

;********************************************************
; END of Remote Controller Transmitter
;********************************************************

end



;********************************************************
;
; Remote Controller Receiver
;
; Author : zawani ichigo
;********************************************************

list p=pic16f84a
include p16f84a.inc
__config _HS_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
errorlevel -302 ;Eliminate bank warning


;**************** Label Definition ********************
cblock h'0c'
rx_status ;RX status save area
rx_substatus ;RX substatus save area
rx_edge ;Input edge check flag
last_look ;Input last look flag
code_ck ;Code check flag
cont_data ;Control Data
relay ;Relay ON counter
w_save ;W reg save area
s_save ;Status reg save area

endc

ptn1 equ b'11110000' ;Pattern 1 data
ptn2 equ b'00001111' ;Pattern 2 data
ra1 equ d'1' ;RA1 bit position
rb5 equ d'5' ;RB5 bit position
rb7 equ d'7' ;RB7 bit position

;**************** Program Start ***********************
org 0 ;Reset Vector
goto init
org 4 ;Interrupt Vector
goto int

;****************** Initial Process *******************
init bsf STATUS,RP0 ;Change to Bank1
movlw b'00011111' ;RA4-0:IN mode
movwf TRISA ;Set TRISA reg
movlw b'00000000' ;RB7-0:OUT mode
movwf TRISB ;Set TRISB reg
movlw b'00000101' ;RBPU/TOCS/PSA=0,PS=101
movwf OPTION_REG ;Set OPTION_REG
bcf STATUS,RP0 ;Change to Bank0

clrf PORTB ;RL1,RL2 OFF
clrf rx_status ;Clear RX status
clrf rx_substatus ;Clear RX substatus
clrf rx_edge ;Clear Edge check flag
incf last_look,f ;Set Last Look flag ON
clrf code_ck ;Clear code check flag
clrf cont_data ;Clear Control Data
clrf relay ;Clear Relay ON counter
movlw d'100' ;256-10000us/64us = 100
movwf TMR0 ;Set 10msec to TMR0
movlw h'a0' ;GIE=1,TOIE=1
movwf INTCON ;Interruption enable

;*********** Initial Input check Process **************
edge_check
btfss PORTA,ra1 ;Input signal ON ?
goto check1 ;No. Signal OFF
btfsc last_look,0 ;Last Look flag OFF ?
goto edge_check ;No. Input NOT changed
bcf INTCON,GIE ;Interruption disable
incf code_ck,f ;Set code check flag ON
incf last_look,f ;Set Last Look flag ON
movlw d'178' ;256-5000us/64us = 178
movwf TMR0 ;Set 5msec to TMR0
bsf INTCON,GIE ;Interruption enable
wait
btfss rx_edge,0 ;Input edge check ?
goto wait ;No. Wait interruption
clrf rx_edge ;Clear edge check flag
goto edge_check ;Jump to Input edge check
check1
clrf last_look ;Set Last Look flag OFF
goto edge_check ;Jump to Input edge check

;************ Timer Interruption Process **************
int movwf w_save ;Save W register
movf STATUS,W ;Read STATUS reg
movwf s_save ;Save STATUS reg
bcf STATUS,RP0 ;Change to Bank0
bcf INTCON,T0IF ;Clear timer int flag

movf relay,W ;Read Relay ON counter
btfsc STATUS,Z ;Counter = 0 ?
goto stchk0 ;Yes
decfsz relay,f ;Counter - 1 = 0 ?
goto stchk0 ;No
clrf PORTB ;Relay OFF

stchk0
movf code_ck,W ;Read code check flag
btfsc STATUS,Z ;Flag ON ?
goto int_end ;No. End of interruption
movf rx_status,W ;Read RX status
btfss STATUS,Z ;Status = 0 ?
goto stchk1 ;No. Next

;*********** Preamble data check Process *************
movf rx_substatus,W ;Read RX substatus
btfss STATUS,Z ;Substatus = 0 ?
goto st00 ;No. Next
goto st_on ;Input signal ON ?
st00 movlw d'1' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 1 ?
goto st01 ;No.
goto st_off ;Input signal OFF ?
st01 movlw d'2' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 2 ?
goto st02 ;No.
goto st_on ;Input signal ON ?
st02 movlw d'3' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 3 ?
goto st03 ;No.
goto st_off ;Input signal OFF ?
st03 movlw d'4' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 4 ?
goto st04 ;No.
goto st_on ;Input signal ON ?
st04 movlw d'5' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 5 ?
goto st05 ;No.
goto st_off ;Input signal OFF ?
st05 movlw d'6' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 6 ?
goto st06 ;No.
goto st_on ;Input signal ON ?
st06 movlw d'7' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 7 ?
goto st07 ;No. Substatus=8
goto st_on ;Input signal ON ?
st07 btfsc PORTA,ra1 ;Input signal OFF ?
goto illegal ;No. Jump to illegal
clrf rx_substatus ;RX substatus = 0
incf rx_status,f ;RX status = 1
clrf cont_data ;Clear count data
goto int_end ;End of interruption

;********************************************************
stchk1
movlw d'1' ;Set check data
subwf rx_status,W ;RX status - check data
btfss STATUS,Z ;RX status = 1 ?
goto stchk2 ;No. Next

;************ Control data check Process **************
movf rx_substatus,W ;Read RX substatus
btfss STATUS,Z ;Substatus = 0 ?
goto st10 ;No. Next
goto st_on ;Input signal ON ?
st10 movlw d'1' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 1 ?
goto st11 ;No.
btfss PORTA,ra1 ;B0 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,0 ;Set B0 = 1
goto stinc ;Jump to Substatus + 1
st11 movlw d'2' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 2 ?
goto st12 ;No.
goto st_off ;Input signal OFF ?
st12 movlw d'3' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 3 ?
goto st13 ;No.
goto st_on ;Input signal ON ?
st13 movlw d'4' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 4 ?
goto st14 ;No.
btfss PORTA,ra1 ;B1 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,1 ;Set B1 = 1
goto stinc ;Jump to Substatus + 1
st14 movlw d'5' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 5 ?
goto st15 ;No.
goto st_off ;Input signal OFF ?
st15 movlw d'6' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 6 ?
goto st16 ;No.
goto st_on ;Input signal ON ?
st16 movlw d'7' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 7 ?
goto st17 ;No.
btfss PORTA,ra1 ;B2 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,2 ;Set B2 = 1
goto stinc ;Jump to Substatus + 1
st17 movlw d'8' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 8 ?
goto st18 ;No.
goto st_off ;Input signal OFF ?
st18 movlw d'9' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 9 ?
goto st19 ;No.
goto st_on ;Input signal ON ?
st19 movlw d'10' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 10 ?
goto st20 ;No.
btfss PORTA,ra1 ;B3 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,3 ;Set B3 = 1
goto stinc ;Jump to Substatus + 1
st20 movlw d'11' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 11 ?
goto st21 ;No.
goto st_off ;Input signal OFF ?
st21 movlw d'12' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 12 ?
goto st22 ;No.
goto st_on ;Input signal ON ?
st22 movlw d'13' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 13 ?
goto st23 ;No.
btfss PORTA,ra1 ;B4 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,4 ;Set B4 = 1
goto stinc ;Jump to Substatus + 1
st23 movlw d'14' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 14 ?
goto st24 ;No.
goto st_off ;Input signal OFF ?
st24 movlw d'15' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 15 ?
goto st25 ;No.
goto st_on ;Input signal ON ?
st25 movlw d'16' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 16 ?
goto st26 ;No.
btfss PORTA,ra1 ;B5 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,5 ;Set B5 = 1
goto stinc ;Jump to Substatus + 1
st26 movlw d'17' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 17 ?
goto st27 ;No.
goto st_off ;Input signal OFF ?
st27 movlw d'18' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 18 ?
goto st28 ;No.
goto st_on ;Input signal ON ?
st28 movlw d'19' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 19 ?
goto st29 ;No.
btfss PORTA,ra1 ;B6 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,6 ;Set B6 = 1
goto stinc ;Jump to Substatus + 1
st29 movlw d'20' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 20 ?
goto st30 ;No.
goto st_off ;Input signal OFF ?
st30 movlw d'21' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 21 ?
goto st31 ;No.
goto st_on ;Input signal ON ?
st31 movlw d'22' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 22 ?
goto st32 ;No. Substatus=23
btfss PORTA,ra1 ;B7 = 1 ?
goto stinc ;Jump to Substatus + 1
bsf cont_data,7 ;Set B7 = 1
goto stinc ;Jump to Substatus + 1
st32 btfsc PORTA,ra1 ;Input signal OFF ?
goto illegal ;No. Jump to illegal
clrf rx_substatus ;RX substatus = 0
incf rx_status,f ;RX status = 2
goto int_end ;End of interruption

st_on
btfss PORTA,ra1 ;Input signal ON ?
goto illegal ;No. Jump to illegal
goto stinc ;Jump to Substatus + 1
st_off
btfsc PORTA,ra1 ;Input signal OFF ?
goto illegal ;No. Jump to illegal
goto stinc ;Jump to Substatus + 1

;************** End data check Process ****************
stchk2 btfss PORTA,ra1 ;Input signal ON ?
goto illegal ;No. Jump to illegal
movlw d'2' ;Set check data
subwf rx_substatus,W ;Substatus - check data
btfss STATUS,Z ;Substatus = 2 ?
goto stinc ;Jump to Substatus + 1

;**************** Data check Process ******************
movf cont_data,W ;Read control data
xorlw ptn1 ;Check Pattern1
btfss STATUS,Z ;Data = Pattern1 ?
goto dtchk0 ;No.
bcf PORTB,rb7 ;RL2 OFF
bsf PORTB,rb5 ;RL1 ON
goto dtchk1 ;Jump to ON counter set
dtchk0
movf cont_data,W ;Read control data
xorlw ptn2 ;Check Pattern2
btfss STATUS,Z ;Data = Pattern2 ?
goto illegal ;No. Jump to illegal
bcf PORTB,rb5 ;RL1 OFF
bsf PORTB,rb7 ;RL2 ON
dtchk1 movlw d'50' ;Set 500msec Relay ON
movwf relay ;Save Relay ON counter

;***************** Illegal Process ********************
illegal incf rx_edge,f ;Edge check flag ON
clrf rx_substatus ;RX substatus = 0
clrf rx_status ;RX status = 0
clrf code_ck ;Clear code check flag
goto int_end ;End of interruption

;*********** Substatus Increment Process **************
stinc incf rx_substatus,f ;Substatus + 1

;******** End of Timer Interruption Process ***********
int_end movlw d'100' ;256-10000us/64us = 100
movwf TMR0 ;Set 10msec to TMR0
movf s_save,W ;Read saved STATUS reg
movwf STATUS ;Recover STATUS reg
swapf w_save,f ;Read saved W register
swapf w_save,W ;Recover W register
retfie ;End of interruption

;********************************************************
; END of Remote Controller Receiver
;********************************************************

end
 

Do you mean that you want to programm the PIC16F84A using RF.????
 

    zawani

    Points: 2
    Helpful Answer Positive Rating
Plz explain ,what u want to do with PIC16F84A and RF
 

    zawani

    Points: 2
    Helpful Answer Positive Rating
Check this, It's for PIC16F84A.

I haven't tried it yet.
 

seadolphine2000 said:
Check this, It's for PIC16F84A.

I haven't tried it yet.

thanks. you best person
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…