View previous topic :: View next topic |
Author |
Message |
Charudatt
Joined: 05 Dec 2005 Posts: 4 Location: INDIA
|
Posted: Mon Dec 05, 2005 7:38 pm Post subject: Generate 38Khz IR Signal ! |
|
|
Hello Guru's
for a project involving Object detection I am interested in generating a 38Khz IR Signal on a 89C2051.
Any code assistance in either BASCOM or ASM would be appreciated.
regards |
|
Back to top |
|
|
vinodkumar
Joined: 18 Oct 2005 Posts: 7 Location: Jabalpur
|
Posted: Mon Dec 12, 2005 7:14 pm Post subject: |
|
|
you could use a 555 to generate 38KHZ and connect a IR led directly to its output, on the reciever side you can use a TSOP1738 reciever IC to recieve. but most probably you should use two 555 to generate a modulated 38KHz signal as the TSOP17XX gets saturated due to continuous 38KHz. there is a application note on the net describing a simple IR obstacle sensor using three 555's and a TSOP |
|
Back to top |
|
|
Charudatt
Joined: 05 Dec 2005 Posts: 4 Location: INDIA
|
Posted: Mon Dec 12, 2005 8:25 pm Post subject: Decided to use PIC |
|
|
Thank you vinodkumar for your suggestion. Anyway I am wanting to write a code for an already existing Urinal Flush System using 89C2051.
Since I did not get any reply to my post (at various places) i decided to go in for PIC with Hardware PWM.
I then realised that it would be difficult to generate the IR signal on One of the pins and switch over to the detection fast. Not too sure if it could (would) detect any signal.
My experiment with PIC has been successful and I have just decided to use a PIC16F72 (Code tested on 16F873)
Oops sorry, are we allowed to talk different MCU on this foroum.
regards. _________________ Information : If you need information don't wait for it to come to you - go and search for it. |
|
Back to top |
|
|
vasan
Joined: 21 Jun 2004 Posts: 13 Location: Chennai
|
Posted: Thu Dec 15, 2005 10:10 am Post subject: |
|
|
It is very simple. Use a Timer in mode2 and then on timer interrupt,increment some variables . whenever a particular variable reaches the value toggle the particular output pin of the 2051. With this you can do other programs also. |
|
Back to top |
|
|
Charudatt
Joined: 05 Dec 2005 Posts: 4 Location: INDIA
|
Posted: Sat Dec 17, 2005 10:17 am Post subject: THANK YOU |
|
|
DO YOU HAVE ANY CODE SAMPLES OF WHAT YOU SAID.
THAT WOULD BE REALLY APPRECIATED.
REGARDS _________________ Information : If you need information don't wait for it to come to you - go and search for it. |
|
Back to top |
|
|
vasan
Joined: 21 Jun 2004 Posts: 13 Location: Chennai
|
Posted: Wed Dec 21, 2005 12:43 pm Post subject: |
|
|
Config Timer0 = Timer, Mode = 2, Gate = Internal
Load Timer, 200 ' This value may change according to your crystal
On Timer0 Tick
Enable Interrupts
Enable Timer0
Start Timer0
Main:
Do
'YOur Code goes in here
Loop
End
Tick:
Incr Tick1
If Tick1 = 5 Then
Tick1 = 0
Incr Tick2 ' Tick2 value corresponds to 1 msec increments.
If Tick2 > 16 Then
Tick2 = 0
$asm
cpl P1.0
$end asm
End IF
End IF
Return
Note:
Above is assumed for a 12 Mhz clock. It is for 32 msec period clock. pls. tinker the values according to your need.
Regards.
Vasan.
Help Tsunami and Earthquake Victims. |
|
Back to top |
|
|
|