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.

[SOLVED] remote control code decoding using micorcontroller

Status
Not open for further replies.

Disha Karnataki

Full Member level 5
Joined
Jul 20, 2013
Messages
249
Helped
9
Reputation
18
Reaction score
8
Trophy points
18
Location
india
Activity points
2,231
i have written c code 8051 microcontroller with proper timing delays but.. not displaying proper results here is the code:
in this code i am decoding only command code(i.e 6 bits in rc5 protocol) as per the image:https://www.pcbheaven.com/scripts/i...rpages/images/The_Phillips_RC5_Protocol_9.png
Code:
#include<reg51.h>
void interruptdelay(void);       
void middelay(unsigned int);	     //arbitrary delay
void delwaste(unsigned int);		 //delay to skip the reading of code upto command            
#define y P1			      //to display number in the command code  of rc5 protocol leds are connected
sbit mybit=P3^3;						 //tsop1738 signal connected at P3^3(interrupt pin)
void timer0(void) interrupt 2           //isr routine for external hardware interrupt 
{
interruptdelay();
}
void main()
{
unsigned char z=0;
P3=0XFF;  //make as input
P1=0X00;   //make as output
IE=0X84;  //low level triggered
TMOD=0X01;	  //timer 0 in mode 1
}
void interruptdelay(void)
{
unsigned int z;
delwaste(16);   //13.824ms skip
while(z!=6)    //here in rc5 protocl the command length is of 6 bits
{
  if(mybit==0)
    y=y<<1;
   else
     y|=0X01;          
   delwaste(2);
  z+=1; 
}
P1=y;   //display final value  in command code
middelay(100);   //keep the display for a little long time    

}    

void delwaste(unsigned int e)   //for e=1 creates delay of 860microsec=1.728ms/2 i.e(half of a bit)
{
for(;e>0;e--)
{
TH0=0XFC;
TL0=0XE4;
TR0=1;
if(TF0!=1);
TR0=0;
TF0=0;
}
}
void middelay(unsigned int g)   //arbitrary delay
{
unsigned int h;
for(;g>0;g--)
{
for(h=0;h<10000;h++);
}
}
 

Hi,

is there any question?

If you need help, then show what you expect and waht you get instead.

Klaus
 

thanks..
my problem is solved & the o/p is correctly displayed
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top