Is it safe to connect two output pins to a single input pin?

Hello.
I have three microcontrollers: 2 attiny85 and atmega328p.
The 2 attiny85 will serve a simple logic and output a signal of HIGH logic level for 50 milliseconds on PB1 pin.
The atmega328p is the receiver of the signal. It receives the signal on an input pin PC0. It doesn't care who sent the signal. I want it to use only one pin to receive the signal instead of dedicating a pin for each sender. It will also allow me to easily add a new sender of the signal (maybe also a button) without changing software and dedicating new pins.

The only question I have: Is if safe to design the circuit so that output pins are connected together to an input pin of another microcontroller? In what case it will cause a damage to any of the microcontrollers in the circuit?
How to design a safe circuit but still using only one receiving pin, if possible?

The schema:

If one output pin is HIGH and the other is LOW, what do you think will happen.

Hint look up open Drain.

Not acceptable

  1. output to output will damage outputs
  2. button will damage all outputs

But it can be done with a bit more hardware. You need a transistor per signal, wired in parallel, with each base driven by one output. It's called a wired OR circuit.
Or, use Larry's approach, just a bit more modern, using FETs instead of transistors. Same difference, really.

The attiny85 output MOSFETs can be used by switching between input to output.

'scuse?

Hi, @user749887
Do you have enough inputs on the 328 to have an input for each of the THREE sources and deal with them in software?
What else will the 328 have as inputs?

Tom... :smiley: :+1: :coffee: :australia:

Clearly.

When the attiny85 output is a HIGH, make that pin an input pin.

When the pin is to be a LOW, make the pin a LOW then an output pin.


Edit
Could use a diode OR gate too.

Works, could do on the '328 too, but the button is a killer. But the OP asked specifically about outputs.
Diode OR works, as long as the input thresholds are ok; back to the days of DTL, eh?

:+1:

Schottky diodes.

Hi,
This may help;

This is an OR gate, so you will not be able to see which output goes HIGH or if more than one input goes HIGH.

Tom.. :smiley: :+1: :coffee: :australia:

Or reverse the diodes and key to GND with pull-up.

And if you switch to the pullup case, you can probably use the internal pullup. Saves yet another component, so all you need is a diode per signal to be OR'd.