Sat May 17 13:54:47 EDT 2014

Capacitor / current dimensions

Main restrictions:
- PIC comparator input leakage: 0.5uA,  (0.045uA for LM324N).
- PIC driver impedance: 44Ohm.

Ballpark: 1mA per Hz full scale (2/3 V_DD = 2.2V).
20mA -> 20kHz -> 50uS

C = I T / V.

(/ (* 0.02 0.00005) 2.2) 4.5e-7  450nF.

Driver output impedance: Z_OUT is 28 to 44 Ohm.

That's an RC time of (* 44 0.45) 19uS or 50kHz.  Way too high.  This
needs a driver.

To get a good sharp edge at 20kHz the discharge current should at
least be 10x the charge current.  Probably 100x is better to not cause
too much frequency deviation.  This is 2A spread over 50ns.  Can a
2N3904 take this?

Maybe best not to worry about this.  Just drive it at 2A / 300(beta) =
6 mA base current or (/ 2.6 0.006) 470 Ohm.

Seems the 2N7000 mosfet is going to better here: datasheet mentions 2A
pulsed current is OK.

(see next post) Conclusion: just use a 2N7000 at 3V3.  The RC time is
going to be around 3uS which compared to 50uS for 20kHz is quite
alright.  For frequency control, this can be taken into account but
probably doesn't matter for f > 500Hz.

How long to keep it on?  Let's say about 5 uS.  That's (/ 5000 83) 60
cycles.  Might be better to use ISR for switching it on and off.  Both
comparators can be used.