oooo, I Like it Keith.
<br>
Sadly I cant take the credit.
The idea was originally suggested by Melanie but it stuck in my mind because I have an device that uses the HPWM to generate an IR carrier which I then gate with a transistor. Too late to change my existing design but I will use the comparator to do the gating in a later revision of the board.
Not only does it save a transistor and a couple of resistors but has a better voltage swing as well!
Keith
www.diyha.co.uk
www.kat5.tv
Darn Melanie. She's just too smart for her own "Britches".
Which is why I tend to envision her without them.
Oh wait, I'd have done that anyways.
At least you applied it to the right problem.
<br>
DT
That is a very elegant solution - just what I was looking for.
Thanks, I will look in to this. The link to Melanie's post is very helpful. Since 0 Volts is "low voltage" it should work exactly the same - when the pulse goes low, the comparator output goes high.
Brilliance is always in the simplicity...
Just for the record. I followed through on this and the above idea (using the comparator) works great on a 16f877A with a 20Mhz crystal.
I just tied the output of the HPWM pin to the Comparator input. I struggled with setting the registers properly because that part is still a bit greek to me (read - I had to experiment until I got what I wanted and then look at the data sheet to figure out WHY it did what it did.)
The wave form is very sturdy and quite square all the way up to 15Khz. I even managed to figure out how to use one of the two ADC inputs the comparator shares on PortA.
I'm learning. As an old dog, SLOWLY, but I'm learning....
Thanks everyone,
Chris Helvey
Darrel really! In exchange for a really big bag of negotiable money all in nicely used notes etc etc (pics, noddy currency and vapourware doesn't count), I'll send you a signed naughty photo... *smiles*
Bookmarks