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 in RC5 remote decoder in 8051

Status
Not open for further replies.

kelvinmanoj

Member level 1
Joined
Mar 18, 2012
Messages
36
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
chennai
Activity points
1,507
hello friends.
im trying to make a ir remote controle for some operations. i just want to enable and disable port pins while pressing the button in remote.
im using rc5 protocol. it is transmitting 14 bits. i dont know how to decode that in 8051. pls help me out with this. should i have to give the received bits in timer interupt or in external intrupt pin. im totally confused with this. i need program in embedded c for RC5 protocol and also circuit diagram.
thankyou...
 

Do you have any documentation which you can share with us?

How I understand you, you have problem and with receving algorithm. Put here some atached documents or links where somebody could read more, and help will come soon, I hope so.
 

sorry friend.... i dont have any documents.... i just wanted some sample c program for interfacing RC5 remote with 8051... with that only i can start writing my program...
 

Re: embedded c code(8051) to decode IR RC5 remote control required

HTML:
http://www.sunrom.com/files/1142-datasheet.pdf

HTML:
http://www.codeforge.com/read/94749/rc5.c__html
 

SM5964 is microcontroller. If you like, you can see datasheet of this microcontroller on this web page

I do not know for which compiler it is. But, how you can see datasheet of microcontroller is hosted on keil.com so, you are probably right. I suppose, you could use code like example, and write some similar code in compiler which you use.
 

Re: embedded c code(8051) to decode IR RC5 remote control required

i need a program for at89s52 controller..
HTML:
http://www.sunrom.com/files/1142-datasheet.pdf

HTML:
http://www.codeforge.com/read/94749/rc5.c__html
 

Which compiler or editor you use? Do you have some development board, or you will develop your own schematic?
 

im using keil compiler, and at89s52 controller... i dont have any schematic im just connecting tsop out to external interupt.. but i dont know how to get a 14 bits from rc remote and store it in controller..
 

i have need it with pic muc (pic16f72/676 ) . it may posibol ? any body help me.

- - - Updated - - -

i have need it with pic muc (pic16f72/676 ) . it may posibol ? any body help me.
 


see the attachment
HTML:
http://educypedia.karadimov.info/electronics/televisionrc5.htm

- - - Updated - - -

see the attachment
HTML:
http://www.sbprojects.com/knowledge/ir/rc5.php
 

I am tried one code
But from this am not getting the output plz suggest me where I done fault
Am using hs0038 ir receiver

#include<reg51.h>
#define TF0_VECTOR 1
#define IE1_VECTOR 2

#define UINT8 unsigned char
#define UINT16 unsigned int
#define UINT32 unsigned long
#define _TOGGLE 0x80
#define _FIELD 0x40
#define _START 0x20
sbit Data = P3^3;
sbit relay = P0^1;
sbit relay1 = P0^2;
#define RELOAD 421
#define FIRST_RELOAD 421
#define High(value) (value & 0xff)
#define Low(value) ((value>>8) & 0xFF)


typedef struct _BYTE
{
UINT8 b0;
UINT8 b1;
UINT8 b2;
UINT8 b3;
}BYTES;

typedef union _LONGINT
{
UINT32 l;
BYTES b;
}LONGUNION;

bit bRC5valid;
bit blevel;
UINT8 command, subaddress, slopecount;
LONGUNION shiftreg;

void RC5start(void) interrupt IE1_VECTOR
{
EX1=0;
slopecount=26;
TH0=High(RELOAD);
TL0=Low(RELOAD);
TR0=1;
TF0=0;
ET0=1;
}

void Timing(void) interrupt TF0_VECTOR
{

blevel=Data;
while(slopecount)
{
TR0=0;
TH0=High(FIRST_RELOAD);
TL0=Low(FIRST_RELOAD);
TR0=1;
if(blevel)
{
shiftreg.b.b0 = shiftreg.b.b0 | 1;
}
shiftreg.l = shiftreg.l <<1;
slopecount --;
return;
}
TR0=0;
ET0=0;
bRC5valid=1;
}

bit DecodeRC5Code(void)
{
UINT8 i,b;
command=0;
subaddress=0;
shiftreg.l = shiftreg.l >>1;
for(i=0;i<6;i++)
{
b=shiftreg.b.b0 & 0x03;
if(b==0x02)
{
command = command | 0x40;
}
else if(b==0x01)
{
command = command & ~0x40;
}
else
return 0;
command = command >> 1;
shiftreg.l = shiftreg.l >>2;
}

for(i=0;i<5;i++)
{
b=shiftreg.b.b0 & 0x03;
if(b == 0x02)
{
subaddress = subaddress | 0x20;
}
else if(b == 0x01)
{
subaddress = subaddress & ~0x20;
}
else
return 0;

shiftreg.l = shiftreg.l >> 2;
}

b=shiftreg.b.b0 & 0x03;
if(b == 0x02)
{
command = command | _TOGGLE;
}
else if(b == 0x01)
{
command = command & ~_TOGGLE;
}
else
return 0;
shiftreg.l = shiftreg.l >>2;
b=shiftreg.b.b0 & 0x03;
if(b == 0x02)
{
command = command | _FIELD;
}
else if(b == 0x01)
{
command = command & ~_FIELD;
}
else
return 0;
shiftreg.l = shiftreg.l >> 2;
b=shiftreg.b.b0 & 0x03;
if(b == 0x02)
{
subaddress = subaddress | _START;
}
else if(b == 0x01)
{
subaddress = subaddress & ~_START;
}
else
return 0;


return 1;
}

void InitEX1(void)
{
EX1=1;
ET0=1;
// IE1=0;
}

void InitTimer(void)
{
TMOD = 0x11;
}

void main()
{


InitTimer();
InitEX1();
shiftreg.l = 0x02;
EA=1;



while(1)
{
if(bRC5valid)
{
bRC5valid=0;
if(DecodeRC5Code())
{
if(command == 0x13)
{
relay=~relay;
}
else if (command == 0x98)
{
relay1 = ~relay1;
}
}
}
shiftreg.l = 0x02;
EA=1;
}

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top