d@nny
Full Member level 5
![Full Member level 5](/styles/images/ranks/flevel2.gif)
here is picture of my LG remote with keys press 0 , 1 , to , 9 .
![0.jpg 0.jpg](https://www.edaboard.com/data/attachments/9/9380-f33f9d7aa88aaacb7cd282a581f6f60c.jpg)
![8.jpg 8.jpg](https://www.edaboard.com/data/attachments/9/9388-6576840753a3547feaf46e69051459e9.jpg)
![7.jpg 7.jpg](https://www.edaboard.com/data/attachments/9/9387-674cba3e563712f463b976ef6cf53f08.jpg)
![6.jpg 6.jpg](https://www.edaboard.com/data/attachments/9/9386-3a1d175033e74c31ece8774f6c93e0dd.jpg)
![5.jpg 5.jpg](https://www.edaboard.com/data/attachments/9/9385-da92afe576d150a0760223a32eda95a4.jpg)
![4.jpg 4.jpg](https://www.edaboard.com/data/attachments/9/9384-3edd784cab582f1d5e1be248cbbf94b6.jpg)
![3.jpg 3.jpg](https://www.edaboard.com/data/attachments/9/9383-52ba6af6a3797daf36d961014e873e65.jpg)
![2.jpg 2.jpg](https://www.edaboard.com/data/attachments/9/9382-9086bdc03a9a8264c6f1eeda5ee0950a.jpg)
![1.jpg 1.jpg](https://www.edaboard.com/data/attachments/9/9381-f6ddecb12f61183f35ba9f4072c361c4.jpg)
![9.jpg 9.jpg](https://www.edaboard.com/data/attachments/9/9389-04bcf07240d155ccf1d94fe4b2ced765.jpg)
How should i scan this keys into the PIC16F76?????/
i am using the following time delays in interrupt routine and watching them on cd4094 shift register with the help of PORTC. But it is not correct at all and i cant find a way to scan them so no two keys present me the same code as currently this programme doing?
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 De175ms ;1.75ms
call De28ms ; 2.8ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call de500ms
call serout
bsf PORTC , 5
bsf PORTC , 5
banksel INTCON
bcf INTCON , INTF
nop
nop
nop
nop
nop
retfie
scan:
btfsc PORTA , 2
goto one
goto zero
zero:
bcf STATUS , 0
rlf r1 , 1
one:
bsf STATUS , 0
rlf 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
De28ms:
movlw 0xF3
movwf d1
movlw 0x02
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_0
;2 cycles
goto $+1
return
De175ms:
movlw 0x5D
movwf d1
movlw 0x02
movwf d2
Delay_01
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_01
;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
![0.jpg 0.jpg](https://www.edaboard.com/data/attachments/9/9380-f33f9d7aa88aaacb7cd282a581f6f60c.jpg)
![8.jpg 8.jpg](https://www.edaboard.com/data/attachments/9/9388-6576840753a3547feaf46e69051459e9.jpg)
![7.jpg 7.jpg](https://www.edaboard.com/data/attachments/9/9387-674cba3e563712f463b976ef6cf53f08.jpg)
![6.jpg 6.jpg](https://www.edaboard.com/data/attachments/9/9386-3a1d175033e74c31ece8774f6c93e0dd.jpg)
![5.jpg 5.jpg](https://www.edaboard.com/data/attachments/9/9385-da92afe576d150a0760223a32eda95a4.jpg)
![4.jpg 4.jpg](https://www.edaboard.com/data/attachments/9/9384-3edd784cab582f1d5e1be248cbbf94b6.jpg)
![3.jpg 3.jpg](https://www.edaboard.com/data/attachments/9/9383-52ba6af6a3797daf36d961014e873e65.jpg)
![2.jpg 2.jpg](https://www.edaboard.com/data/attachments/9/9382-9086bdc03a9a8264c6f1eeda5ee0950a.jpg)
![1.jpg 1.jpg](https://www.edaboard.com/data/attachments/9/9381-f6ddecb12f61183f35ba9f4072c361c4.jpg)
![9.jpg 9.jpg](https://www.edaboard.com/data/attachments/9/9389-04bcf07240d155ccf1d94fe4b2ced765.jpg)
How should i scan this keys into the PIC16F76?????/
i am using the following time delays in interrupt routine and watching them on cd4094 shift register with the help of PORTC. But it is not correct at all and i cant find a way to scan them so no two keys present me the same code as currently this programme doing?
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 De175ms ;1.75ms
call De28ms ; 2.8ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call De28ms
call scan
call de500ms
call serout
bsf PORTC , 5
bsf PORTC , 5
banksel INTCON
bcf INTCON , INTF
nop
nop
nop
nop
nop
retfie
scan:
btfsc PORTA , 2
goto one
goto zero
zero:
bcf STATUS , 0
rlf r1 , 1
one:
bsf STATUS , 0
rlf 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
De28ms:
movlw 0xF3
movwf d1
movlw 0x02
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_0
;2 cycles
goto $+1
return
De175ms:
movlw 0x5D
movwf d1
movlw 0x02
movwf d2
Delay_01
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_01
;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