I want to design some circuit which is drive 4 of led-diodes with npn, pnp, diode.
In my project our cpu has used most of its ports except only 2 ports.
And we have to control 4 LED with 2 ports
I want it operates separately in 4 conditions such as (High, Low),(H,H),(H,L),(L,H),(L,L)
I assume you mean 2 pins, i think this will work but i'm not sure,
you can connect 2 leds in each pin, one with the cathode to the pin and the other with the anode to the pin
and the other sides through one resistor for each led to the positive (anode) and gnd (cathode).
Using this configuration one led will be one when the output is 0 and the other when the output is 1,
and i think that you could turn off both leds if you change the pin direction to input.
This would work with an mcu that can supply about 10ma for the leds directly (like an AVR).
I don't know what you mean by cpu so you have to check the output of your device,
can it provide (0/5v) or is it open collector/drain?
The datasheet of your device says that you can source and sink the 10mA,
there is a small voltage drop, about 2.6v output voltage with a 3v power supply.
It also says that the total output current should be less than 48mA for all outputs combined or the voltage drop increases.
The typical max pin current is 6ma to have 3v out after that you get a voltage drop.
check page 19 and 20 https://www.ti.com/lit/gpn/msp430g2231
Alex
---------- Post added at 02:11 ---------- Previous post was at 01:43 ----------
To conclude what i said above, the typical output is 6mA sink or source with a voltage drop of 0.3v (+0.3v instead of 0 and 2.7v instead of 3v) with 3v power supply.
This voltage drop will increase if the total current of all pins is above 48mA.
The graph of the output current VS output voltage shows that you can sink or source more current but with an additional voltage drop.
I assume that if you go over the 48mA limit then the voltage drops in all the pins (not just the ones pulling current) but since you are going to light only one led this shouldn't be a problem.
I don't know how much current you use in the other pins or if you have more leds.
Yes i'm trying that, you can use a push-pull npn/pnp with the emitters connected and to the 2 leds as in my previous connection but i don't know if you will be able to turn them off when you configure the pin as input.
this configuration pulls a low current from the base and maybe the chip will provide that even in input mode and the led will not turn off completely.
In this configuration the base current is limited because the load is connected to the emitter, the base resistor in not needed but maybe it will help to turn off the leds and also i don;t like to connect directly transistors to mcu.