From what I've read of MicroChip's data sheets, I'd have to agree with Olin about using a 5Mohm resistor to a digital PIC input. Take a look at AN521, where MicroChip explains why a high ohm resistor is not only economical, but also that its most likely failure mode (blown open) is actually better than using an in series cap or even a transformer. A failure can also easily be compensated for by using two or more resistors in series (one dead shorts, the other is still there). For example, if you use two 2.5Mohm resistors in series, and one were to fail by dead shorting for some reason (unlikely according to MC), the other 2.5Mohm resistor would still keep the injected current going into the port to only 0.000082 amps (or 82uA) at "205" volt peaks, which is still well within the 500uA specs of the internal clamping diodes of the PIC. Even with a 1000 volt spike, at 2.5Mohms, there would only be a 400uA current surge at the port, which is still within spec's. And MC tends to understate there maximum "guaranteed" specs (i.e.: their on chip EEPROM is "guaranteed" at 1,000,000 writes, but they've been tested to last upwards of 10,000,000+ write cycles). Actually, I'm currently having to use another resistor from B0 to ground any ways (another 5Mohm), so I'm cutting that voltage in half, to 85 to 100 volt peaks. Good point though about most resistors only being rated at 100 volts, although I've been using 1/2 & 1/4 watt carbon film resistors in high voltage (120VAC) analog triac circuits for some time now, and have never seen one fail (unless the circuit wasn't designed right to begin with). Sorry Roman, I checked with the tech guys at ST, and there absolutely can NOT be any caps between the bridge and the VB409 (PLEASE, NO MORE STUFF ABOUT PUTTING A CAP IN BETWEEN THERE GUYS ;-). That device is pretty safe any ways, as it has several failsafe modes inherently built into its design (thermal, current, and voltage shut down modes, to name a few). It can be enhanced a bit more than the way I have it setup currently, by using a small inductor in the circuit, but I haven't looked into that as of yet. Remember, I'm still in the prototype phase, and the end circuit will probably be much safer than what I'm currently doing. Besides that, the only "direct" physical contact a user would have with the unit, will be through plastic capped tactile buttons housed in a plastic case (I suspect that they'd have a fairly high impedance). However, instead of futzing around with resistors, or a zener setup like Roman mentioned, I was thinking that I could use some sort of Opto circuit/chip to relay the zero crossing event to B0 instead. This would probably give me a better chance of getting it UL/CSA approved if/when I decide to do that (5000V+ isolation trumps most anything). I'm sure that any type of direct connection setup would probably scare the PooPoo out of UL & CSA too ;-). Any ideas on how to do it that way? What part(s) to use? Anyone? Thanks again for everyone's input on this. -----Original Message----- From: Olin Lathrop To: PICLIST@MITVMA.MIT.EDU Date: Saturday, February 10, 2001 10:21 AM Subject: Re: [PIC]: Input clamp current (was Schmitt Trigger (RB0) interrupt problem) >> Voltage on any pin with respect to VSS >> (except VDD, MCLR. and RA4) >> -0.3V to (VDD + 0.3V) >> >> Input clamp current, >> IIK (VI < 0 or VI >VDD) >> +/- 20mA >> >> Now to me, these two specs seem to contradict each other. >> >> From the latter, for example I would think that a 15V signal thru a 100K >> resistor could safely be connected to the PIC, since the clamp current of >> the protection diode would only be (15V-5V)/10K = 0.01ma, which is orders >of >> magnitude below the 20mA specified. >> >> But of course, this connection would then drive the pin to one diode drop >> above Vdd, which exceeds the voltage spec. >> >> What gives? Why specify a nonzero maximum clamp current when the voltage >> spec implies that you can never apply an input that forward biases the >> clamp (ie protection) diode? > >Hmm. Good point. I think maybe they are trying to say that if you connect >a PIC pin to a voltage source with 0 impedence, don't go more than 300mV >outside the supply range (probably because the can be SURE that the diodes >won't conduct and therefore exceed current). However, if you are going to >connect a current source, all is well as long as it is limited to +-20mA. > >In other words, it is really a current spec, and the voltage spec is a >guaranteed limit within which the current won't be exceeded. > >If this is indeed true (maybe it isn't), then I don't see the problem with >connecting a PIC pin to 170V via 5Mohm. That's only 34uA. The voltage at >the other end of the resistor is irrelevant (as long as the resistor can >handle it) because that voltage never shows up at the PIC. > >I don't see Roman's point about not wanting to rely on the protection >diodes, as long as the relevant parameters are specified and guaranteed by >Microchip. > > >***************************************************************** >Olin Lathrop, embedded systems consultant in Devens Massachusetts >(978) 772-3129, olin@embedinc.com, http://www.embedinc.com > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu