guys i have developed a code in assembly for decoding Rc-5 protocol but it seems that there is some problem....
what i am doing is im giving a delay of 8x1.778ms as soon as my start bit puts a zero on 8051 pin(demodulator gives inverted output to 8051) because i am ignoring first 8 bits...
then i am just saving remaining 6 command bits into A register.....
i am using buttons 1-6 of remote which have values 1,2,3......6 respectively..
but as i press buttons on remote nothing happens...i wonder whats the problem
here is my code
;-------------------------------------------------------------------------
ORG 00H
IPIN EQU P1.0
COUNT EQU R0
PIN0 EQU P2.0
PIN1 EQU P2.1
PIN2 EQU P2.2
PIN3 EQU P2.3
PIN4 EQU P2.4
PIN5 EQU P2.5
MOV A,0H
CLR C
MOV COUNT,8
MOV TMOD,01H
MAIN:
JB IPIN,$
DO:
LCALL DELAY
DJNZ COUNT,DO
MOV COUNT,6
CLR C
AGAIN:
MOV C,IPIN
RLC A
LCALL DELAY
DJNZ COUNT,AGAIN
DEV1:
CJNE A,1H,DEV2
CPL PIN0
LJMP MAIN
DEV2:
CJNE A,2H,DEV3
CPL PIN1
LJMP MAIN
DEV3:
CJNE A,3H,DEV4
CPL PIN2
LJMP MAIN
DEV4:
CJNE A,4H,DEV5
CPL PIN3
LJMP MAIN
DEV5:
CJNE A,5H,DEV6
CPL PIN4
LJMP MAIN
DEV6:
CJNE A,6H,MAIN
CPL PIN5
LJMP MAIN
LJMP LAST
;------1.778ms DELAY----------;
DELAY:
MOV TH0,0F9H
MOV TL0,99H
SETB TR0
HERE: JNB TF0,HERE
CLR TF0
CLR TR0
RET
;------------------------------;
LAST:
END