source= http://www.piclist.com/piclist/2003/11/24/174650a.txt? Bob Ammerman defined it better with:
fmax = maximum output frequency loop forever: f1 = get frequency of first input if (f1 > fmax) then f1 = fmax f2 = get frequency of second input if (f2 > fmax) then f2 = fmax fout = fmax - min(f1,f2) end loopIF I wanted to use a PIC for this, this is about what I would have written. However, I find it hard to believe that the cost of the photo detectors, LED, PIC, crystal or resonator, etc... is going to be less than the cost of photo transistors, LED, a few caps, diodes and resistors and I can't believe at all that this can't be done in a purely analog circuit. It violates KISS to use a PIC, for this doesn't it? Yes, I know there is KISS for design and KISS for production and I could have had it designed, prototyped, debugged, and off to the board house long ago if I did a KISS design using a PIC, etc... But I want to make some number of these and enable non-PIC people to cobble them together from Radio Shack parts, so I'm really hoping for an analog design. The AND part is easy... the photo transistors just get hooked in series. And the invert is easy... the LED is just powered from the difference between a cap and Vcc so when the cap is charged, the LED doesn't light. The cap is charged through a diode by the pulses from the photo transistors and discharged via a large value resistor. What I don't know is how to bias the phototransistors so that they only conduct when the light level /changes/ i.e. they need to constantly re-bias themselves so that changes in the light level produce a brief burst of current flow. So how does one bias a phototransistor? There is no darn base! Also, how do I keep the LED from coming on until the cap is discharged to the point that the LED can really get up a bright pulse before it charges up the cap again? --- James Newton: PICList.com webmaster, former Admin #3 mailto:jamesnewton@piclist.com 1-619-652-0593 phone http://www.piclist.com/member/JMN-EFP-786 PIC/PICList FAQ: http://www.piclist.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.