Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Is this circuit right for a simple switch to enable duplicate data?

Status
Not open for further replies.

mik3ca

Member
I'm making a PCB and my real estate is limited.

I am using an AT89C2051 microcontroller, and it only has one serial transmit output.

What I need is a way to set whether the output from the serial transmit pin is sent to only one common-anode device or to two common-anode devices simultaneously. To make things simple, let's make the LED's with resistors in series as the devices in question.

So far, the R2 and LED1 in series where its connected is OK since that's the one device that always shows the data transmitted from the microcontroller.

Because I'm using the standard UART data format, I'd like a pin on the micro (Pin P3.4 in this example) to decide whether LED2 should stay logic high (light off), or LED2's response should match LED1's response.

I'm not sure if I hooked up the transistor the right way for this functionality or if I should use PNP instead?

I added a resistor (let's say 10K) to the NPN base because I needed something strong enough to make the NPN base as logic high if the micro doesn't set the pin as logic low.

I attached the circuit.

circuit.png
 
Not clear.
You have data on P3.4 and you want it to go to device A all the time and to device B some of the time?
 
Looks fine to me except you need a series base resistor, or else whenever P3.1 is LO and P3.4 is HI, P3.4 will be trying to counter-drive P3.1 through a 0.7V diode via the base-emitter. Assuming that you always want the data to go to LED1 and only some of the time to LED2, dependent on the state of P3.4.

For clarity, I think the term you are looking for when you talk about the 10K resistor is "pull-up".
 
Last edited:
Why not drive one LED with 3.1, the other with 3.4, and change the output driving logic in software? After all, the decision already is being made in software; this would be a modification of the output conditions, not the main code.

ak
 
Why not drive one LED with 3.1, the other with 3.4, and change the output driving logic in software? After all, the decision already is being made in software; this would be a modification of the output conditions, not the main code.

ak

I'm already doing tons of software as it is and it with timing of other parts i'd like to avoid the software solution.

You have data on P3.4 and you want it to go to device A all the time and to device B some of the time?

No, Data is on the TXD line that gets sent out to LED1. P3.4 serves as a switch and it determines whether the data is also sent to LED2 or not.

P3.4 is HI
In the 8051, the outputs are either high impedance or ground, never a logic high. That's why I included a pull-up to that pin so I can define high.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top