Wed Nov 21 22:31:09 CET 2007
input works seemingly without problems. output is going to be a bit
more problematic.. i think it's not a good idea to drive the speaker
with the pin directly.. for 2 reasons: 8 ohms is to high a load and
the drive point needs to be tolerant for analog voltages (a CMOS input
is not, and i'd like to use the PWM)
with the current setup, a PNP switch is probably best.
so, design variables:
* PNP / NPN (cap to ground or Vdd)
* suppression diode?
* feed from battery (9V) or Vdd (5v regulated)
1K with PNP on 13/RC2/CCP1
ok. make sure the speaker is not full-on, the transistor gets really hot.
running into a problem: i'm using high = off, which apparently the PWM
doesn't like: it gives a single spike. so i need to explicitly turn
the chip resets unexpectedly. trying now with ICD2 attached: seems to
be stable. so something's wrong with my reset circuit probably. could
be power supply stuff. some spikes..