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.

remote controlled fan regulator using 8051 need details pls help me out urgent!!!

Status
Not open for further replies.

ravirkm

Newbie level 2
Newbie level 2
Joined
Feb 22, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
i am trying to build this project but i am not getting coding part pls help me out with coding and circuit diagram for coding.
Pls its urgent!!
 

you can use RC5/NEC format for remote
Code:
/* NEC REMOT CANTROL INTERFACE WITH 8051 MCU ADD. AND CMD. DISPLAY ON HYPERTERMINAL*/
/*PROGRAM BY ARUN KUMAR SHARMA JHUNJHUNU RAJASTHAN INDIA   */
/*PHONE +919829147145*/ 
#include<reg51.h>
//#include<stdio.h>
#define T 516//560us 11.0592MHz
#define _9MS 8295//9000ms 11.0592MHz
#define _4MS 4198//4500ms 11.0592MHz
#define _2T ((T)+(T))//1120us 11.0592MHz
#define _3T (T*3)//1680us 11.0592MHz
#define POW 0x12
#define V_UP 0x02
#define V_DW 0x13
#define uint unsigned int
#define cmp(VALUE,MS) (VALUE>=(MS-MS*.1)&&VALUE<=(MS+MS*.1))?1:0
#define uint unsigned int 
#define lint long int
#define uchar unsigned char
static uchar DATAPORT,key;
uchar add1,add2,cmd1,cmd2;
sbit ir=P3^2;
sbit Power=P3^0;
sbit io=P3^1;
uint value,value1;
static uchar count;
uchar irtemp,i,j;
/*void send_TX(unsigned char *c)
{
while(*c)
{
if(*c=='\n')
{
SBUF=0x0D;
*c++;
}
else
SBUF=*c++;
while(TI==0);
TI=0;
}
}
*/
void delay(uint a)
{
uint r,t;
for(r=0;r<a;r++)
for(t=0;t<120;t++);
}
void ir_data() interrupt 0 using 1
{
TH0=TL0=0;
EX0=0;
IE0=0;
TR0=1;
io=0;
while((!ir)&&(TH0<<8|TL0)<9500);
TR0=0;
value=(TH0<<8)|TL0;
TH0=TL0=0;
TR0=1;
while(ir&&(TH0<<8|TL0)<5000);
TR0=0;
value1=(TH0<<8)|TL0;
if(cmp(value,_9MS)&&cmp(value1,_4MS))
{
{

for(i=0;i<4;i++)
{
for(j=0;j<8;j++)
{
irtemp>>=1;///* Recive 'byte' bit-by-bit from MSB to LSB. */
TH0=TL0=0;
while(!ir);
TR0=1;
while(ir);
TR0=0;
value=TH0<<8|TL0;
irtemp|=(cmp(value,_3T))?0x80:0x00;
}
switch(i)
{
case 0:
       add1=irtemp;break;
case 1:
       add2=irtemp;break;
case 2:
       cmd1=irtemp;break;
case 3:
       cmd2=irtemp;break;
default :;break;
}
irtemp=0x00;
}
}i=0,j=0;
}
irtemp=0;
if((cmd1==~cmd2)&&(add1==~add2))
{
key=cmd1;
//printf("%X %X %X %X\n",add1,cmd1,add2,cmd2);//Display on hyperterminal
}
else
;//printf("Recive Errer\n");
add1=add2=cmd1=cmd2=0;
delay(200);
io=1;
IE0=0;
EX0=1;
}


void main()
{
EA=0;
TMOD=0x01;
//SCON=0x50; 
//PCON=0x80; //for high baud rate SMOD=1
//TH1=0xFD; //19200 baud rate
//TI=0;
TR1=1;
ET1=1;
TH0=0;TL0=0;
IT0=1;
EX0=1;
PX0=1;
DATAPORT=0x0F;
P1=DATAPORT;
Power=0;
io=1;
EA=1;
//send_TX("     *CREATED BY ARUN*\n");
//send_TX("CHIRAWA JHUNJHUNU Rajasthan\n");
while(1)
{
while(key==0x00);
switch (key)
{
case POW :
Power^=0x01;P1=DATAPORT=0x0F; break;
case V_UP:
if(DATAPORT>0x00&&Power)
{
DATAPORT=DATAPORT-1;
P1=DATAPORT;
//printf("%X",P1);
//puts("VOL+");
}break;
case V_DW :
if(DATAPORT<0x0F&&Power)
{
DATAPORT=DATAPORT+1;
P1=DATAPORT;
//printf("%X",P1);
//puts("VOL-");
}break;
default :
break;
}
key=0x00;
}
}
pls modify as per your application
 

Dear Mr. Arun is it tested and working code ???







you can use RC5/NEC format for remote
Code:
/* NEC REMOT CANTROL INTERFACE WITH 8051 MCU ADD. AND CMD. DISPLAY ON HYPERTERMINAL*/
/*PROGRAM BY ARUN KUMAR SHARMA JHUNJHUNU RAJASTHAN INDIA   */
/*PHONE +919829147145*/ 
#include<reg51.h>
//#include<stdio.h>
#define T 516//560us 11.0592MHz
#define _9MS 8295//9000ms 11.0592MHz
#define _4MS 4198//4500ms 11.0592MHz
#define _2T ((T)+(T))//1120us 11.0592MHz
#define _3T (T*3)//1680us 11.0592MHz
#define POW 0x12
#define V_UP 0x02
#define V_DW 0x13
#define uint unsigned int
#define cmp(VALUE,MS) (VALUE>=(MS-MS*.1)&&VALUE<=(MS+MS*.1))?1:0
#define uint unsigned int 
#define lint long int
#define uchar unsigned char
static uchar DATAPORT,key;
uchar add1,add2,cmd1,cmd2;
sbit ir=P3^2;
sbit Power=P3^0;
sbit io=P3^1;
uint value,value1;
static uchar count;
uchar irtemp,i,j;
/*void send_TX(unsigned char *c)
{
while(*c)
{
if(*c=='\n')
{
SBUF=0x0D;
*c++;
}
else
SBUF=*c++;
while(TI==0);
TI=0;
}
}
*/
void delay(uint a)
{
uint r,t;
for(r=0;r<a;r++)
for(t=0;t<120;t++);
}
void ir_data() interrupt 0 using 1
{
TH0=TL0=0;
EX0=0;
IE0=0;
TR0=1;
io=0;
while((!ir)&&(TH0<<8|TL0)<9500);
TR0=0;
value=(TH0<<8)|TL0;
TH0=TL0=0;
TR0=1;
while(ir&&(TH0<<8|TL0)<5000);
TR0=0;
value1=(TH0<<8)|TL0;
if(cmp(value,_9MS)&&cmp(value1,_4MS))
{
{

for(i=0;i<4;i++)
{
for(j=0;j<8;j++)
{
irtemp>>=1;///* Recive 'byte' bit-by-bit from MSB to LSB. */
TH0=TL0=0;
while(!ir);
TR0=1;
while(ir);
TR0=0;
value=TH0<<8|TL0;
irtemp|=(cmp(value,_3T))?0x80:0x00;
}
switch(i)
{
case 0:
       add1=irtemp;break;
case 1:
       add2=irtemp;break;
case 2:
       cmd1=irtemp;break;
case 3:
       cmd2=irtemp;break;
default :;break;
}
irtemp=0x00;
}
}i=0,j=0;
}
irtemp=0;
if((cmd1==~cmd2)&&(add1==~add2))
{
key=cmd1;
//printf("%X %X %X %X\n",add1,cmd1,add2,cmd2);//Display on hyperterminal
}
else
;//printf("Recive Errer\n");
add1=add2=cmd1=cmd2=0;
delay(200);
io=1;
IE0=0;
EX0=1;
}


void main()
{
EA=0;
TMOD=0x01;
//SCON=0x50; 
//PCON=0x80; //for high baud rate SMOD=1
//TH1=0xFD; //19200 baud rate
//TI=0;
TR1=1;
ET1=1;
TH0=0;TL0=0;
IT0=1;
EX0=1;
PX0=1;
DATAPORT=0x0F;
P1=DATAPORT;
Power=0;
io=1;
EA=1;
//send_TX("     *CREATED BY ARUN*\n");
//send_TX("CHIRAWA JHUNJHUNU Rajasthan\n");
while(1)
{
while(key==0x00);
switch (key)
{
case POW :
Power^=0x01;P1=DATAPORT=0x0F; break;
case V_UP:
if(DATAPORT>0x00&&Power)
{
DATAPORT=DATAPORT-1;
P1=DATAPORT;
//printf("%X",P1);
//puts("VOL+");
}break;
case V_DW :
if(DATAPORT<0x0F&&Power)
{
DATAPORT=DATAPORT+1;
P1=DATAPORT;
//printf("%X",P1);
//puts("VOL-");
}break;
default :
break;
}
key=0x00;
}
}
pls modify as per your application
 

Can you please let me know any ref., which remote you use ! I try with Chinese Remote not response !
 

use LG TV remote having chip IRSC6121
 

Attachments

  • IRSC6121.pdf
    148.2 KB · Views: 156
  • IR CANTROL.rar
    306.1 KB · Views: 141
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top