How to read the IR sensor , as i m using NEC protocol

Status
Not open for further replies.

ajit4u

Banned
Joined
Nov 26, 2010
Messages
54
Helped
15
Reputation
30
Reaction score
15
Trophy points
1,288
Activity points
0
i m facing problem in reading the bits of IR sensor . is der any body to help me

with 8051
 

which IR sensor you are using..
 
Reactions: ajit4u

    ajit4u

    Points: 2
    Helpful Answer Positive Rating
It will function at 38khz frequency that can be generated in uc itself.
view the link below:

http://www.datasheetcatalog.org/datasheets/208/301092_DS.pdf

if you have any code for Reading byte by byte code from IR sensor through remote please give me.
in my project i hv to read the remote keys and display on the LCD.
In LCD side i dont hv any prob . but READING IR sensor Bytes Using NEC protocol is the problem,
please Help me sir
 
here is my code , but how to get the proper byte and dislay,
i knows the NEC protocol


#include"IR_controller.h"
void LoadTimer0(unsigned char LoadCode)
{
switch(LoadCode)
{
case LoadValue9ms: TH0=0xDF;TL0=0x99; break;
case LoadValue4ms5: TH0=0xEF;TL0=0xCC; break;
case LoadValue0ms56: TH0=0xFD;TL0=0xFB; break;
case LoadValue0ms565: TH0=0xFD;TL0=0xF7; break;
case LoadValue1ms69: TH0=0xF9;TL0=0xEA; break;
}
TF0 = 0; //reset the TF value
}

void IRsend(IRaddress,IRcommand)

unsigned char IRaddress,IRcommand;

{
unsigned char x,y,temp;

TMOD = (TMOD & 0xF0) | 0x01;
TR0 = 1;

IRsendport = 1;
LoadTimer0(LoadValue9ms);
while(TF0!=1);

IRsendport = 0;
LoadTimer0(LoadValue4ms5);
while(TF0!=1);

for(y=0;y<4;y++)
{
switch
{
case 0: temp = IRaddress; break;
case 1: temp = ~IRaddress; break;
case 2: temp = IRcommand; break;
case 3: temp = ~IRcommand; break;
}
for(x=0;x<8;x++)
{
IRsendport = 1;
LoadTimer0(LoadValue0ms56);
while(TF0!=1);

IRsendport = 0;

if ((temp & 0x01) == 0)
{
LoadTimer0(LoadValue0ms565);
}
else
{
LoadTimer0(LoadValue1ms69);
}

while(TF0!=1);
temp = temp >> 1;
}

}
IRsendport = 1;
LoadTimer0(LoadValue0ms56);
while(TF0!=1);
IRsendport = 0;

}

---------- Post added at 15:19 ---------- Previous post was at 15:06 ----------

 
the above program u write is for ir transmission
if u find ir reception code for nec protocol , the remote i m using have ic sc6121
if anyone has c code for that then send it on my email id plzzzzzz.
munishgoyal2008@gmail.com
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…