On Thu, 28 May 1998, David VanHorn wrote: > >I want to add sounds to a product--beeps and boops and the like. > > > >Can I just hook a piezo speaker to a PIC output pin? > >Or should I use a resistor and/or capacitor in series? > > Yes but. > > You'll be tempted to use two outputs to make it louder. This can, with > the wrong switching sequence, cause a voltage doubling effect, and > hang your processor with CMOS latchup! Hi, at first I could not follow your arguments. The it became clearer. However, I think, it is true only if the device connected between A and B has enough capacity to hold some coulombs during pin transition. On the other hand: the piezo devices drain not too much current, i. e. you can put a serial resistor between it and the PIC. Now, assuming the capacity is high enough to satisfy the condition described above, nothing bad will happen as the PIC has voltage clamping diodes. I guess 2 x 10k will work. Imre > > Wrong sequence. > > A B Voltage on pins at the moment of transition > > L L 0 0 > L H 0 5 > H H 5 10 (!) Possible CPU hang. > H L 5 0 > L L 0 0 > > > Right sequence > > A B > > L L 0 0 > L H 0 5 > L L 0 0 (This state just has to happen, it dosen't have to stay there > any significant time) > H L 5 0 > L L 0 0 (Same as above) > >