Two microcontrollers, one common output

microcontroller

I have the next situation:

I've got two microcontrollers that should drive 4 motors. It's either microcontroller1 or microcontroller2 that is driving the motors.And 4 motors means that each microcontroller has 4 outputs. So I'm searching for a system that could choose(depending on a extern variable) which microcontroller is driving the motors.

So basically it's something like a selective switch, but with 8 inputs (comming from microcontroller1 and microcontroller2, and 4 outputs that go to the motors)

Thanks in advance

Best Answer

This is typical application for a digital multiplexer. In this case 8:4 multiplexer. For example the 74HC257 quad 2:1 MUX can do this.

Important thing is to keep its power on while either of the MCUs is on because input of inactive CMOS circuit is essentialy shorted to ground (via the protection diode to VCC).