Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help regarding RC-5 protocol

Status
Not open for further replies.
Perhaps Tahmid can help - the last time I used an 8051 I think they
were made out of valves ....

jack
 



---------- Post added at 09:12 ---------- Previous post was at 08:56 ----------

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

The start bit starts from second half! So u have to use (7.5*1.778ms) ..
 
Last edited:

I've never understood why people write programs like this in assembler.
If you had used a higher level language - C or even Basic at least
you would stand a better chance of more people being able to help.

The fact that an 8051 is being used then becomes a hardware only issue.

Seriously - high level languages exist for good reasons. If you need assembler
for some reason just read the output file from the compiler and use high level
for the structure design.

jack
 

Perhaps Tahmid can help - the last time I used an 8051 I think they
were made out of valves ....

jack

I would but I've never worked with 8051 and have no idea what he wrote. Maybe if it was in BASIC or C, I could try.

I've never understood why people write programs like this in assembler.
If you had used a higher level language - C or even Basic at least
you would stand a better chance of more people being able to help.

The fact that an 8051 is being used then becomes a hardware only issue.

Seriously - high level languages exist for good reasons. If you need assembler
for some reason just read the output file from the compiler and use high level
for the structure design.

jack

I agree but there's many reasons. They maybe starting out with the controller from an institution where they're taught assembly, or starting on their own, not having much idea about C or BASIC, thus jumping into assembler.
I think learning assembler is a plus to understanding the architecture. However it's so tedious, I haven't touched it for use after I started using mikroBASIC, seeing as to how easy it makes everything.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top