Discussion in "General help Guidance and Discussion" started by    lucky6772    Mar 25, 2013.
Wed May 08 2013, 06:00 am
#31

#include <REG2051.H>
void delay1(void);
sbit mybit=P1^2;

void main(void)
{
while(1)
{
mybit=~mybit;
delay1();

}
}
void delay1(void)
{

TMOD=0X02;
// TL0=0XF4;
TH0=0xf4;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}




sir plz telll me now whats wrong with this code why is not produce excat 38khz i have checked on proteus the frequency its producing is 16khz..:(


[ Edited Wed May 08 2013, 06:02 am ]
Wed May 08 2013, 06:05 am
#32
proteus file...frequency showing is 17752HZ

Attachment
Wed May 08 2013, 10:21 am
#33
if I were you, I would use interrupt for generating 38Khz square wave.

void timer0_isr () interrupt 1
{
	mybit = ~mybit;
}

void main ()
{
	TMOD = 0X02;
	TH0 = 0xf4;
	TL0 = 0xF4
	IE = 0x82;
	TR0 = 1;
	while(1);
}
Wed May 08 2013, 02:51 pm
#34
but y sir..isnt my code and calculation was correct?? i have to use interrupt when i detect the person and perform sum function in that..!
Fri May 10 2013, 12:49 am
#35
At 38kHz a full cycle is 26.3 micro seconds.
You would need to toggle the output every 13 micro seconds.
This 13 micro seconds includes the time for the micro to call delay() and set up the registers.

Given the processing overheads trial and error may be the best method , but it may not be possible !
Try a simple loop in assembly code .
Fri May 10 2013, 03:22 am
#36
now i have genrated the 38khz frequency using crystal vallue 11.0582mhz but still no good sign of detection low output at tsop1738,also the pin a microcontroller as per where pulses are genrating i am getting no variation in voltage practical its shold 5v then 0 on off on off resulting pulses but voltage is constant 2.5v..:(

#include <REG2051.H>

void delay1(void);
sbit mybit=P1^7;


void timer0_isr () interrupt 1
{
        mybit = ~mybit;
}

void main ()
{
	P1=0x00;
        TMOD = 0X02;
        TH0 = 0xf4;
        TL0 = 0xF4;
        IE = 0x82;
        TR0 = 1;
        while(1);
	
}
Fri May 10 2013, 10:59 am
#37
Are you sure you are using TSOP1738? its not 1736? coz market has all kind of variants and often seller mix them up. they are one of the common part of TV IR receivers. Try 36Khz too and see what happens.
Fri May 10 2013, 05:25 pm
#38
ok sir i will first chck,,..!
Sat May 11 2013, 06:06 am
#39
ok now when i started detecting low voltage at TSOP but range too short as in just 5cm hardly..!
the 38khz output pin of micntrl have voltage 2.4v which is further feed to ir transmitter with resistace of 100ohm..
Mon May 13 2013, 10:26 am
#40
2.4 is fine as we have 50% duty cycle. so output voltage becomes half when you check using a multimeter. if you check on Oscilloscope you will see pulses going from 0 to 5V. Make sure you driver IR led using a transistor like 2N2222. remote control uses similar transistor for driving IR LEDs for good range.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

BrettTibre
Fri May 17 2024, 06:14 pm
Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am
Patricknoind
Fri May 17 2024, 09:53 am
JeremyCycle
Fri May 17 2024, 09:46 am
FrabSeby
Thu May 16 2024, 07:31 pm
PeterGem
Thu May 16 2024, 06:27 am
Timothywalay
Thu May 16 2024, 04:40 am