My remote output 0 to 9 keys
**broken link removed**
I have 35 keys on my remote control . I have decode them with following code. But only 15 keys out of 35 have output same code in pairs 2 * 6 = 12 keys and a pair of 3keys total 15 keys
Do i need some fine tune in the timing?
processor PIC16F676
#include <p16f676.inc>
d1 equ 21h
d2 equ 22h
d3 equ 23h
r1 equ 24h
org 0x00
goto main
org 0x04
goto INTR
main:
banksel ANSEL
movlw B'00000000'
movwf ANSEL
banksel PORTA
clrf PORTA
banksel TRISA
movlw b'00000100'
movwf TRISA
banksel PORTC
clrf PORTC
banksel TRISC
clrf TRISC
banksel INTCON
bcf OPTION_REG , INTEDG
bsf INTCON , INTE
bcf INTCON , INTF
bsf INTCON , GIE
FIN:
goto FIN
INTR:
banksel PORTC
clrf PORTC
clrf r1
call left
call scan
call count
call scan
call count
call scan
call count
call scan
call count
call scan
call count
call scan
call count
call scan
call count
call scan
call serout
bsf PORTC , 5
bcf PORTC , 5
call de500ms
banksel INTCON
bcf INTCON , INTF
nop
nop
nop
nop
nop
retfie
scan:
btfsc PORTA , 2
goto one
goto zero
zero:
bcf STATUS , 0
rrf r1 , 1
one:
bsf STATUS , 0
rrf r1 , 1
return
de500ms:
movlw 0x03
movwf d1
movlw 0x18
movwf d2
movlw 0x02
movwf d3
De500_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto De500_0
;6 cycles
goto $+1
goto $+1
goto $+1
return
count: ;0.001645 seconds
movlw 0x48
movwf d1
movlw 0x02
movwf d2
count_0
decfsz d1, f
goto $+2
decfsz d2, f
goto count_0
;2 cycles
goto $+1
return
left: ;0.00965 seconds
movlw 0x89
movwf d1
movlw 0x08
movwf d2
left_0
decfsz d1, f
goto $+2
decfsz d2, f
goto left_0
;2 cycles
goto $+1
return
serout:
movlw 0x08
movwf d3
testbit:
bcf PORTC , 4
btfsc r1 , 7
bsf PORTC , 4
bsf PORTC , 3
bcf PORTC , 3
rlf r1 , f
decfsz d1 , f
goto testbit
return
end