n00b question

Hello,

I'm reading "Microcontroller Projects in C for the 8051" by Dogan Ibrahim and I have a question that I can't find the answer to in the text nor anywhere else that I've searched.

When driving an LED from a pin, he says the port is in "current source mode", and when using the pin to produce a tone with a small speaker connected to a n channel MOSFET, he says the output is in "Voltage Mode" and that the speaker will turn on when it is at Logic High (+5V).

Could anyone clue me in about what he means by these different modes and what might determine the mode?

Thanks

-Josh

Reply to
jam4ar
Loading thread data ...

I don't remember enough about the 8051 to know if these are genuinely different modes for the chip, or if he's just analyzing them differently (suspect the latter - though I'm sure there are modern 8051 derivatives with programmable drive strength).

Assuming it's a case of different analysis, what it really depends on is what he has it hooked up to. An LED is a diode, so more than a little bit above it's threshold voltage it's just going to look like a very small resistor. If you connected an LED across a decent 5v supply the current implied by that small resitance would be quite high - probably higher than the LED can handle for very long. In the case of hooking it up to the 8051 port though, the chip itself can only source so much current - in effect, the internal resistance of the 8051 is limiting the current. (I'd still be tempted to add a resistor though, or at least measure it and be sure the current isn't exceeding the data sheet limit for the 8051 or the LED - but in practice I'll often briefly probe logic signals with a bare LED).

With the MOSFET you have the opposite situation. A MOSFET is an insulated gate switching device that is voltage sensitive. Due to the insulation, the resistance seen by the output pin is very high - megaohms (unless your gate oxide has been zapped by static discharge). Since the load resistance is high, the 8051 will supply an unloaded voltage, probably quite close to 5v assuming it's implement in CMOS technology. So it's more or less a voltage source. (BTW, CMOS logic is just using smaller versions of the same MOSFET devices in n- and p- varieties)

Trying to remember, but I think one 8051 version does have a kind of "funky" mode of driving signals - like it drives them very hard briefly to overcome trace inductance & load capacitance and then backs off to a lower current hold mode?

Reply to
cs_posting

I've still been searching and I can't find anything. Like you, I suspect its an analysis of what is connected to it.. but I lack the knowledge to really understand the difference enough to tell what is going on.

I don't think I explained the LED situation very well. the LED connects from Vcc to the pin (with a resistor), when the pin is high the LED is off.

I think the difference is in that in one mode the pin is sourcing the current to drive the LED, in Voltage mode, perhaps what is important is just the voltage not the amount of current.

Thanks

-Josh

Reply to
jam4ar

Well, sinking actually, because we use the terms for the fictious + to

- current (holes) instead of the real - to + current (electrons).

Yes, more or less. The LED is lit by current, the MOSFET turned on by voltage (field effect transistor - electric field).

Reply to
cs_posting

Though I am not working with 8051 forlast 2 years, I think it should be the way mentioned below. Its the way the device connected to 8051 will interact with it. I think there should be a Vcc to pin connection through LED and a current limiting resistor. Here the port pin acts as a current sink and becuase of the current, LED turns on. So if you set the port with 0, the LED will glow and vice versa. In case of MOSFET, it is basically driven by a voltage source.(I assume here you are clear with voltage and current source terminology) So whn you set the port high, it starts sourcing the current out.

Reply to
Sagar

The key to understanding is:

The output stage auf a CMOS circuit is allways a switched current source. If you set a logical 1 to an output pin and short the pin to ground you may messure a current of som mA but no voltage. If your load has a high impedancce like a MOFFET, you will see no current an a high level signal.

hth.

Hans

Reply to
Hans Müller

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.