lucky6772
Junior Member level 2
- Joined
- Sep 4, 2010
- Messages
- 21
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,441
If you read the tsop datasheet thoroughly, you'll realize that it's not designed to receive continuous 38 kHz carrier. You can expect better sensitivity by superimposing a square wave modulation.
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
void timer0_isr () interrupt 1
{
mybit = ~mybit;
}
void main ()
{
P1=0x00;
TMOD = 0X02;
TL0 = 0xf4;
TH0 = 0xf4;
IE = 0x82;
TR0 = 1;
while(1);
}
Much too long. According to the datasheet, a burst length in the ms range is expected.Make transmitter transmit 38 KHz burst signals like transmit 38 KHz signal for 1.2 sec and then silent for 0.5 sec then repeat.
Count pulses and send an intermitted signal.what else should i do in my code
so exactly nw how much should b the burst length tell me excatly....in datasheet it mention 70cycles...but in c language i need in sec or milli sec..so plz tell me..!cant calculate cycles..!Much too long. According to the datasheet, a burst length in the ms range is expected.
Count pulses and send an intermitted signal.
On/off frequency is 38 kHz, so I guess you can easily calculate and generate burst duration.
P.S.: I presumed that your code generates 38 kHz, but as I don't know the crystal frequency, I'm unable to check.
Use Astable multivibrator using 555 timer for generating 38KHz......... You can ON/OFF it using microcontroller by connecting the Reset pin of 555 to an output pin of microcontroller. Note that the Reset input is active low...........So 38KHz will be generated when it is HIGH ...
When the 38KHz IR rays falls on TSOP1738, its output will be low.. otherwise it will be high..
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int a;
void delay(unsigned int msec ) // Time delay function
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1912; j++);
}
void timer0_isr () interrupt 1
{
delay(1);
mybit = ~mybit;
delay(1);
mybit=0;
delay(1);
}
void main ()
{
P1=0x00;
TMOD = 0X02;
TL0 = 0xf4;
TH0 = 0xf4;
IE = 0x82;
TR0 = 1;
while(1);
}
No. The timer interrupt must run continuously during the burst.will this thng works
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;
void timer0_isr () interrupt 1
{
mybit = ~mybit;
}
void main ()
{
P1=0x00;
TMOD = 0X02;
TL0 = 0xf4;
TH0 = 0xf4;
IE = 0x82;
TR0 = 1;
while(1)
{
if(n%2!=0)
{
for(c=0;c<=1912;c++)
{
TR0=1;
}
n++;
}
else
{
for(c=0;c<=1912;c++)
{
TR0=0;
}
n++;
}
}
}
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;
void delay(unsigned int msec ) // Time delay function
{
int i ,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}
void timer0_isr () interrupt 1
{
mybit = ~mybit;
}
void main ()
{
P1=0x00;
TMOD = 0X02;
TL0 = 0xf4;
TH0 = 0xf4;
IE = 0x82;
TR0 = 1;
while(1)
{
TR0 = 1;
delay(2);
TR0=0;
}
}
#include <REG2051.H>
sbit ir=P1^7;
sbit motor=P1^6;
sbit motor1=P1^4;
sbit sense=P3^3;
int a,b,c,d,e,j,k,l,m,i,n,flag;
void delay3()
{
for(j=0;j<1000;j++)
for(k=0;k<500;k++);
}
void delay7()
{
for(i=0;i<7;i++)
{
for(l=0;l<1000;l++)
for(m=0;m<75;m++);
}
}
void timer0_isr () interrupt 1
{
if(n>0) // 1.5ms ON-OFF Burst for 10 cycles
{
if(n%2!=0)
{
TR1=0;
TH0=0xfa; // 1.5ms OFF
TL0=0x99;
ir=0;
n++;
}
else
{
TH0=0xFA; // 1.5ms ON
TL0=0x99;
TR1=1;
//ir=0;
n=1;
}
}
}
void timer1_isr () interrupt 3
{
ir = ~ir;
}
void isr(void) interrupt 2
{
e=1;
if(flag==0)
{
motor=1;
delay3();
motor=0;
a=1;
flag=flag+1;
}
else
;
}
void main ()
{
a=0;
flag=0;
e=0;
n=1;
P1=0x00;
//P3=0xff;
TMOD=0X21;
TH1=0xf4;
TH0=0xFA;
TL0=0x99;
IE=0x8f; //0x8f;
IT1=0; // Configure interrupt 0 for falling edge on /INT1 (P3.2)
//EX1=1; // Enable EX1 Interrupt
//EA=1; // Enable Global Interrupt Flag
TR1=1;
TR0=1;
while(1)
{
if(a==1)
{
e=e-1;
if(e<0)
{
EX1=0;
TR0=0;
// P3=0xff;
// EA=0;
motor1=1;
delay7();
motor1=0;
// TR0= 1;
EX1=1;
TR1=1;
a=0;
flag=0;
e=0;
}
else;
}
else;
}
}
#include <REG2051.H>
void delay1(void);
sbit mybit=P1^7;
int c, n;
void delay_ms (unsigned int count) // @ 11.0592 MHz
{
unsigned int i;
while(count) {
i = 115;
while(i>0) i--;
count--;
}
}
void timer0_isr () interrupt 1
{
mybit = ~mybit;
}
void main ()
{
P1=0x00;
TMOD = 0X02;
TL0 = 0xf4;
TH0 = 0xf4;
IE = 0x82;
while(1)
{
TR0=1;
delay_ms(1);
TR0=0;
mybit=0; //LED off
delay_ms(6);
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?