• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help in decoding Remote control of NEC protocol

Status
Not open for further replies.
Hi,

I am using a remote which is of NEC protocol. Trying to decode this remote using P89V51RD2. I need soure code to decode this remote. Kindly help.

below is my code to decode the remote data it is in isr


Code:
void ir_sense(void) interrupt 2					  
{	
	unsigned int z=0,j=0;
	unsigned int k=0,l=0,m=0;
	EX0 = 0;									 
  	EX1 = 0;
		for(z=0;z<1762;z++);               //9.97 msec
		for(j=0;j<612;j++);	      //3.5msec
			
			while(irbitcount < 0x20)   //collect 32 bits					  
  			{	
			    if(logic_1_flag==1)       //check if this flag is true
				{	for(k=0;k<129;k++);    //1.12msec
					logic_1_flag=0;
				}
				else if(logic_0_flag==1)
				{	for(l=0;l<122;l++);       //1.06msec
					logic_0_flag=0;
				}
    			if(IR)	                   //if ir pin is one	  
				{	dat1 >>=1;
					dat1|=0X80000000;
					for(m=0;m<140;m++);    //1.219msec	
					irbitcount++;
					logic_1_flag=1;						  
	  			}											  
				else if(!IR)      //if ir pin is low
    			{	dat1 >>=1; 
					dat1 |=0X00000000;
					irbitcount++;							 
	  				logic_0_flag=1;	
				}
 			} 
		IR = 1;									
  		irbitcount = 0;							
  		sensor_chk = 1;	
}
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top