Hi Jinx, I just checked your circuit, there are a couple of potential probs. First, you sould add a series R before the AN0 pin, about 220 ohms, and a C to gnd on the pin, about 1uF. You might also put a 0.1uF cap across your 0.47 ohm current sense resistor, as you will get motor commutation spikes there, probably what killed your PIC. :o) Secondly, you are using relays and limit switches direct on the motor, so keep in mind what happens when the motor coil is fully powered and a switch opens... Maybe try 2 zeners (series reversed) across the motor, rated 1v above your supply current. It might be a fairly serious voltage that got to your poor PIC, not just latchup. -Roman Jinx wrote: > > I've got this signal > > http://home.clear.net.nz/pages/joecolquitt/lv_an.html > > going into AN0 of a 16F877. It works but the signal must > have some negative-going components (or possibly a > switch glitch) as the port occassionally latches. How can > I best protect the pin against signals going below Vss-0.6V > > According to 20.11 of the Mid-range Manual > > "Since the analogue pins are connected to a digital output, > they have reverse biased doides to Vdd and Vss. The > analogue input therefore must be between Vdd and Vss. If > the input voltage deviates from this range by more than 0.6V > in either direction, one of the diodes is forward biased and > latch-up may occur" -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body