|
Prev: how to open include file in system generator
Next: AVR Assembler (Mega8) - Test if a value has changed more thana given amount
From: Tomás Ó hÉilidhe on 6 May 2008 23:52 Let's say I have a microcontroller pin that will have one of three states: 5 V, 0 V or high impedence. Let's say I have a PMOS and an NMOS, and I connect their gates together. I connect the microcontoller pin to the gates. Now, when my pin is high, the NMOS will turn on. When the pin is low, the PMOS will turn on. What will happen though when I set the pin to high impedence? I'm hoping that neither transistor will be on, but I'm concerned that maybe there might be some sort of voltage on the microcontroller pin (it might be behind a large resistance, but it's still a voltage) that will switch one of them on. In my current design, I'm using bi-polar transistors, and it works great. I'm thinking of switching to MOSFET's though because they let current flow in both directions. The MOSFET's will be used to turn on LED's.
From: robertwessel2 on 7 May 2008 00:14 On May 6, 10:52 pm, Tomás Ó hÉilidhe <t...(a)lavabit.com> wrote: > Let's say I have a microcontroller pin that will have one of three > states: 5 V, 0 V or high impedence. > > Let's say I have a PMOS and an NMOS, and I connect their gates > together. I connect the microcontoller pin to the gates. > > Now, when my pin is high, the NMOS will turn on. When the pin is low, > the PMOS will turn on. > > What will happen though when I set the pin to high impedence? I'm > hoping that neither transistor will be on, but I'm concerned that > maybe there might be some sort of voltage on the microcontroller pin > (it might be behind a large resistance, but it's still a voltage) that > will switch one of them on. That won't work. There will be some voltage leaking from the high impedance device, and exactly what that is, and how much current there is, will dictate exactly what the two drive transistors are going to do. What are you trying to do? Build a high output tristate device? Are you trying to drive a multi-color LED or something?
From: Tomás Ó hÉilidhe on 7 May 2008 00:31 On May 7, 5:14 am, "robertwess...(a)yahoo.com" <robertwess...(a)yahoo.com> wrote: > That won't work. There will be some voltage leaking from the high > impedance device, and exactly what that is, and how much current there > is, will dictate exactly what the two drive transistors are going to > do. With the PIC microcontroller, if you put a volt meter across a high impedence pin, I think you measure about 3 V. Of course, it's behind a massive resistance, but I think that 3 V might be enough to turn on an NMOS transistor. > What are you trying to do? Build a high output tristate device? Are > you trying to drive a multi-color LED or something? I have a bi-colour LED that has 3 pins. Within the LED package there are two LED's, and they have a common cathode. Their anodes are separate. When my microcontroller pin is high, I want it to be green. When low, red. When high impedence, off. To do this, I want to use a p-type and a n-type transistor that have a common gate/base. When the microcontroller pin is high, the n-type transistor will be turned on and it will put five volts onto the red anode. When the microcontroller pin is low, the p-type transistor will be turned on and it will put five volts onto the green anode. I might end up doing it with bi-polars instead of mosfets...
From: robertwessel2 on 7 May 2008 01:07 On May 6, 11:31 pm, Tomás Ó hÉilidhe <t...(a)lavabit.com> wrote: > On May 7, 5:14 am, "robertwess...(a)yahoo.com" <robertwess...(a)yahoo.com> > wrote: > > > That won't work. There will be some voltage leaking from the high > > impedance device, and exactly what that is, and how much current there > > is, will dictate exactly what the two drive transistors are going to > > do. > > With the PIC microcontroller, if you put a volt meter across a high > impedence pin, I think you measure about 3 V. Of course, it's behind a > massive resistance, but I think that 3 V might be enough to turn on an > NMOS transistor. > > > What are you trying to do? Build a high output tristate device? Are > > you trying to drive a multi-color LED or something? > > I have a bi-colour LED that has 3 pins. Within the LED package there > are two LED's, and they have a common cathode. Their anodes are > separate. > > When my microcontroller pin is high, I want it to be green. When low, > red. When high impedence, off. > > To do this, I want to use a p-type and a n-type transistor that have a > common gate/base. When the microcontroller pin is high, the n-type > transistor will be turned on and it will put five volts onto the red > anode. When the microcontroller pin is low, the p-type transistor will > be turned on and it will put five volts onto the green anode. Add a pulldown to the input of the nFET and a pullup to the input of the pFET, and a couple of diodes to prevent wrong way current flow. You will get leakage current around that. so if you have a tight power budget that may be a problem. OTOH, since you're basically using current as a control signal, there's more than a bit to be said for using current mode devices to drive the LEDs. Or just use two pins.
From: robertwessel2 on 7 May 2008 01:14
On May 6, 11:31 pm, Tomás Ó hÉilidhe <t...(a)lavabit.com> wrote: > I have a bi-colour LED that has 3 pins. Within the LED package there > are two LED's, and they have a common cathode. Their anodes are > separate. Oh, and that's a *tri* colored LED (two LED's in a package, three pins). A *bi* color LED has two LEDs in one package connected in parallel, but in opposite directions, and so has only two pins. In the later case you can only get one of the two LEDs to light at a time (the current flowing forwards or backwards through the device). In the former you get three colors, since you can drive both LEDs at the same time to get a third color (IOW it's red if you power one LED, green if you power the other, or yellow if you turn on both). If you're using bi-color LEDs, here are a few circuits (with different tradeoffs) for driving them off a single pin device (although you'll have to add more current handling ability if I'm understanding your application). http://www.edn.com/contents/images/101305di.pdf |