I setup a mosfet to switch power to a pin on a PIC. The circuit works only
for low R.
Vcc ---> R ----> Drain + link to pic
Source ---> GND
Parallel port --> Gate
Gate voltage is about 3.5-4.5V.
Everything works fine with R about 2k but with 4.7k or higher it does not.
Vcc is 5V.
Why would this be the case? Surely 4.7k or even 10k isn't all that high in
this case? The pic(link to pic attached to the drain) is a schmitt triggered
input. So it shouldn't be drawing all that much current?
I'm not sure how to interpret the datasheet but it has a section for timing
conditions and a schematic for "load conditions" with a pullup of 464 ohms
and bypass cap of 50pf.
I imagine that if the capacitance of a pin is about 50pf, and lets say I
double it to 100pf, then a resistance of R = 4k gives me a 400ns rise time
and 1k is obviously 100ns. Surely both are reasonable?
Here I'm neglecting the speed of the parallel port but I imagine its
independent of what R is?
So what I'm really interested in is what is going on? What am I not taking
into account that is causing timing issues? I imagine it might be the
capacitance but I'm not sure. I just can't see why I would need to supply so
much current to something let a mosfet gate which is what I imagine the
input pins are. (I realize that for high speed switching it requires more
current but its a schmitt trigger so I should be able to run it as slow as I
want?)
Thanks,
Jon
> I setup a mosfet to switch power to a pin on a PIC. The circuit works
> only for low R.
[quoted text clipped - 7 lines]
> Everything works fine with R about 2k but with 4.7k or higher it does
> not. Vcc is 5V.
Then it sounds like a rise-time issue to me. I assume that you are using a
pullup to 5V and driving the line low actively from your parallel port, and
that this is not the power supply to the PIC itself as it may need a couple
of mA to start up.
> Why would this be the case? Surely 4.7k or even 10k isn't all that
> high in this case? The pic(link to pic attached to the drain) is a
> schmitt triggered input. So it shouldn't be drawing all that much
> current?
It's not that. When you turn off the MOSFET to allow the line to pull high
it's taking too long to climb its way back up to Vcc. 10k is kind of a weak
pullup for trying to acheive high speed communications with wires of any
substantial length.
> I'm not sure how to interpret the datasheet but it has a section for
> timing conditions and a schematic for "load conditions" with a pullup
> of 464 ohms and bypass cap of 50pf.
See, that's a really "stiff" pull-up. It will climb to Vcc much faster.
> I imagine that if the capacitance of a pin is about 50pf, and lets
> say I double it to 100pf, then a resistance of R = 4k gives me a
> 400ns rise time and 1k is obviously 100ns. Surely both are reasonable?
You don't have to convince anyone here, you have to follow what the
datasheet says. If the datasheet says that a 400nS rise time is ok, then
fine. I'm guessing that it probably doesn't though. 400nS is pretty slow
by any standard.
> Here I'm neglecting the speed of the parallel port but I imagine its
> independent of what R is?
[quoted text clipped - 6 lines]
> switching it requires more current but its a schmitt trigger so I
> should be able to run it as slow as I want?)
If you'd like, tell me what PIC and what Microchip documents you are using
and I will try to help you figure out the timing limitations. I'm not
saying I can necessarly solve your problems, but I'm willing to help you.
Slow rise times can result in all kinds of freakish behavior on clocked CMOS
parts. I learned this with a shift register that would reset whenever I
tried to clock a zero bit into it. PIC pins can be Schmidt trigger in some
modes and not in others. Does the document specify that the pin is a
Schmidt trigger input when you have the device in programming mode?
> I setup a mosfet to switch power to a pin on a PIC. The circuit works only
> for low R.
[quoted text clipped - 33 lines]
> Thanks,
> Jon
Did you select a specifically "logic level" type MOSFET?
Jon Slaughter - 30 Oct 2007 23:40 GMT
>> I setup a mosfet to switch power to a pin on a PIC. The circuit works
>> only for low R.
[quoted text clipped - 35 lines]
>
> Did you select a specifically "logic level" type MOSFET?
?
Its 2N7000. Shouldn't any general purpose small signal mosfet work?
It seems that the resistors are the key to getting it to work(in the sense
that it doesn't work if R is to large).
I can't understand why the resistance has to be so low in this case ;/ I can
get the circuit to do its job but its taking about 30mA max(on average its
probably only about 5mA I suppose) and that seems like way to much(To
program a pic using mosfets) ;/
Jamie - 31 Oct 2007 00:41 GMT
>>>I setup a mosfet to switch power to a pin on a PIC. The circuit works
>>>only for low R.
[quoted text clipped - 47 lines]
> probably only about 5mA I suppose) and that seems like way to much(To
> program a pic using mosfets) ;/
if memory serves. that number turns on fully at 2.5 or around there.
we use those at work in switching circuits and 2.5 volts is the bias
voltage that gets the gate to turn it on which then drives a bipolar
that operates a incandescent lamp.

Signature
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
ian field - 31 Oct 2007 17:33 GMT
>>>>I setup a mosfet to switch power to a pin on a PIC. The circuit works
>>>>only for low R.
[quoted text clipped - 52 lines]
> voltage that gets the gate to turn it on which then drives a bipolar that
> operates a incandescent lamp.
The last parallel port card I took apart had standard TTL devices to drive
the printer inputs, IIRC the TTL "dead zone" is between 1.8 & 2.4V so it
looks like the guaranteed VoLow maximum value is perilously close to the
2N7000 VgTh or at least enough gate voltage to keep the MOSFET partially
conducting - until you use a lower resistance and brute force to pull Vd
upwards.
A "logic level" MOSFET would be ideal, or a schottky-barrier diode in series
with the gate drive might drop enough gate voltage to ensure the MOSFET
turns fully off (a gate pulldown resistor would be needed to actually
develop Vf across the diode).
For the application as described, a MOSFET probably doesn't offer any
worthwhile advantage over a low cost NPN transistor with a base resistor.
w_tom - 31 Oct 2007 00:53 GMT
> I can't understand why the resistance has to be so low in this case ;/ I can
> get the circuit to do its job but its taking about 30mA max(on average its
> probably only about 5mA I suppose) ...
Assuming the circuit is as described, then a 2N7000 gate is blown so
that gate current flows into the Drain-Source channel.
> I setup a mosfet to switch power to a pin on a PIC. The circuit works only
> for low R.
[quoted text clipped - 33 lines]
> Thanks,
> Jon
The gate voltage you have specified looks suspect, what kind of
fet did you select ?

Signature
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5