how to count a part of 38khz
be80be
Posts: 56
I'm looking for a way to count 38mhz that my Ir diode is putting out I no the stamp not that fast. but I was thinking i could use a IR module with resistor capacitor added to the output to divide it to some thing in khz range. I have a pickit2 that can read up to 500khz. I was going to use it to count the out put.
Post Edited (be80be) : 10/2/2008 12:37:57 PM GMT
Post Edited (be80be) : 10/2/2008 12:37:57 PM GMT
Comments
-Phil
the next 1 i know it's on but its way to fast it doesn't turn on my ir module
Once the IR light stops blinking, the IR-Module continues to hold the pin low for some period, long enough that the BS2 can read the pin after the FREQOUT statement.
Oh, and typical TV IR-Remotes output 'pulse patterns' of this light. I believe the Sony protocol uses 600 uSec and 1200 uSec for bit-times. A "pulse pattern" being defined as "blinking the light at a 38 Khz rate for 600 uSec, then NOT blinking the light for 600 uSec, equals a "One" ". Mind you, there's hundreds of different manufacturer pulse-patterns.
Given that's what's happening, the answer is no, the BS2 cannot count the 38 Khz. But usually you don't want to. It CAN read the size of the IR-Module output pulses, however.
Oh, and the reason they all use this magic 38,000 times a second blink rate is that this filters out sunlight.
Now, if you REALLY want to put the blink-rate on an oscilloscope or logic-analyzer or something, you can use a true IR recieving transistor.
If you're just trying to insure the IR-LED is working, look at it with a digital camera -- they recieve IR light.
be80be, if you want to use the BS2 to verify that your 38KHz circuit is really clocking at that rate, you can use a phototransistor, as Mike suggested, or connect the circuit's output directly to a BS2 pin and it's ground to Vss. (That's assuming the output operates at normal logic levels. If not, use the phototransistor.) Then, using a WORD variable for the result, COUNT the number of pulses in a 100ms time interval and multiply by 10 to get the frequency.
-Phil
-Phil