ATMega328 and 7400 chips

The (short) scenario:
I'm working through developing a project that will end up using RS-485 and Modbus RTU. So far I have been developing the master and two slaves (one at a time) using just TTL. Master and Slave 1 works. Master and Slave 2 works. Now I need to combine them, but would like to do so without introducing the RS-485 boards yet.

The problem:
Master Tx to Slave 1 and 2 Rx I can just split. Slave 1 and 2 Tx to Master Rx needs to be ORed together so as to not connect two outputs together.

I don't have any 74xx32 OR gate chips, but I do have some 7400 NAND gates which are easy enough to turn into an OR gate. I tried that and it wasn't working. The chips are old, so I used a breadboard to test each chip. I have a few suspect ones and some that test good. But no luck and getting communications established (unfortunately I do not have a oscilloscope).

But...I accidentally combine the two Slave TX and the Master Rx pins and it started working.

So, the question to the group is: what gives? Why when combing the pins does it work. That indicates to me that only one slave is talking when it should. I can't think of what effect adding the OR gate could have. Is it the 7400 chips? Are the 7400s not compatible with the ATMega328? (wrong Vil/Vih and Vol/Voh values)

Opinions and suggestions welcome.

Show us a good schematic of your circuit.

Show us a good image of your wiring.

That wasn't the question.

Schematic is:

Master RX:

  1. Search on NAND OR gate, plenty of references.
  2. Pin 9 of each UNO slave to input of NAND OR gate, out of OR Gate to MEGA pin 19.

Master TX:
Mega Pin 18 to UNO slaves pin 8.

That's the schematic.

Remember this works direct and works with they are tied together (2 outputs to 1 input). So add the OR gate and splat!

I'm sure there will now be more irrelevant questions.

TTL serial is active low. So if you used an OR gate, you'd get a high (idle line) if either of the inputs was idle, and gibberish if both were sending data.

You can or them with a pair of diodes (diode from RX of master to each slave TX) - you might also need a pullup resistor on the master RX; I don't think the AVR's enable the pullup on the UART RX pin) or an AND gate, but you'll get gibberish if both transmit at the same time.

That's the schematic.

No

You can use TTL with UNOs

I'm sure there will now be more irrelevant questions.

Perhaps there are others that can help.

If they outputs are tied together to the input it works. That indicates to me they are not both trying to talk at once.

I also tried a diode or gate (web says pull down at OR gate output). No joy there too.

There are no other connections other than what I listed. That's all of the folks. NAND chip turn into an OR gate as found on the web and the 2 pin 9 inputs and the pin 19 output.

OK. One schematic attached.

or-nand.png

adwsystems:
If they outputs are tied together to the input it works. That indicates to me they are not both trying to talk at once.

I also tried a diode or gate (web says pull down at OR gate output). No joy there too.

You wired the diode ORing wrong, then, post schematic. Did you put a pullup to Vcc on on the RX line? Did you put the diodes the right way around? band should go towards the RX lines (since it's active low).

An OR gate will not work. You need an AND gate, because a TTL serial line is HIGH, not LOW when is is not transmitting. If you OR together two lines, one of which is transmitting and the other of which is not, the output will be constantly HIGH because the idle line is HIGH - HIGH OR'ed with a signal is HIGH - no signal out.

adwsystems:
There are no other connections other than what I listed. That's all of the folks. NAND chip turn into an OR gate as found on the web and the 2 pin 9 inputs and the pin 19 output.

Universal Logic Gate NAND - Logic Gate - dyclassroom | Have fun learning :-) (all the way to the bottom)

OK. One schematic attached.

And your link doesn’t work.

You should realize by now what a questioners responsibility is when they ask a question.
But then again I guess not.

One more name to add to the list.

larryd:
You should realize by now what a questioners responsibility is when they ask a question.
But then again I guess not.

And the responder should answer the question before moving on or realize a fundamental fatal flaw (DRAzzy +1) and step back.

The universal NAND Gate (all the way at the bottom) Same link. Works for me.

Link to Diode OR Gate

The Diode OR gate worked with one slave attached, but not two. Verifies to me diodes were installed correctly (a very likely problem)

I'm looking at the logic tables to reverse the polarity now, (Since the logic is active low which I did not know).

adwsystems:
I'm looking at the logic tables to reverse the polarity now, (Since the logic is active low which I did not know).

It can't be this easy. NAND Gate instead of OR gate?

(I miss having access to a scope :frowning: )

AND gate - you want the output to be LOW when either of the inputs are LOW, right?

DrAzzy:
AND gate - you want the output to be LOW when either of the inputs are LOW, right?

I see it now. Thank you. I didn't know the Serial TL was idle high/active low, which shocked me and then through me.

Working now.

adwsystems:
I see it now. Thank you. I didn't know the Serial TL was idle high/active low, which shocked me and then through me.

Working now.

Good that you got things working!

With all seriousness, you can see your circuit and you have a good relationship with the wiring , we cannot see a thing.

Writing a bunch of words for a schematic is quite difficult in making something visual.

Attaching a proper schematic shows others exactly what's happening.

larryd:
Attaching a proper schematic shows others exactly what's happening.

In almost all cases I agree. This would be the exception. Did you see the schematic attached above? Was it really of any help? I know you don't believe me, but that really is all there is to the system...for now.

Build programs and hardware in blocks and layers. That way I have a proven working fall back point. That's how I know exactly what was and was not working above. Little did I know that serial TTL was active low logic. Surprise on me.

Little did I know that serial TTL was active low logic. Surprise on me.

RS232 serial is -V for 1 and +V for 0, TTL is as you have discovered reversed, HIGH for 1 LOW for 0.
Never did liked this.

(FYI, RS232 DCD, CTS, DSR are +V for 1 and -V for 0 :o )
Should be
(FYI, RS232 DCD, CTS, DSR are +V for asserted and -V for not asserted :o )

Master RX:

  1. Search on NAND OR gate, plenty of references.
  2. Pin 9 of each UNO slave to input of NAND OR gate, out of OR Gate to MEGA pin 19.
    Master TX:
    Mega Pin 18 to UNO slaves pin 8.

The above is difficult to visualize, it's best to supply a drawing.

Anyway, it’s good things are working now.

larryd:
RS232 serial is -V for 1 and +V for 0, TTL is as you have discovered reversed, HIGH for 1 LOW for 0.
Never did liked this.

Definitely not disagreeing.

Funny thing. In all my years of working with RS-232 (which was almost a full time thing between 15 and 20 years ago). I never noticed that.

larryd:
(FYI, RS232 DCD, CTS, DSR are +V for 1 and -V for 0 :o )

Seriously!

Seriously!

Yes

RS-232 logic and voltage levels
Data circuits Control circuits Voltage
0 (space) Asserted +3 to +15 V
1 (mark) Deasserted −15 to −3 V
For TTL, asserted is 0V

I believe you. (and the seriously pertained to the CTS et al. being inverted as compared to data) I never noticed or realized the data was inverted. My hindsight is a bit dumbfounded at the moment (perhaps that's a senior moment).

Funny thing. In all my years of working with RS-232 (which was almost a full time thing between 15 and 20 years ago). I never noticed that.

Seriously, the fact that RS-232 is NEGATIVE LOGIC (-v for "1") is RS-232 101.
It is so basic, it is almost always mentioned within 15 minutes of the start of any lecture on RS-232.
To admit that you never noticed that is to admit that you didn't do your due dilligence. There could be
a thousand reasons why, but realistically, if you didn't have to troubleshoot it you probably didn't have
a reason to know because if it works, then what more do you need to know ?
Just sayiin', that is pretty basic.