3
\$\begingroup\$

I'm fairly new to digital circuits, so please be patient.

I'm designing a circuit intended to sense the direction of a model train. The intent is to use 4 reed switches (SW1 to SW4) to feed 4 SR NAND latches. SW1 and SW4 are used to reset the latches.

The logic I used is:

When the train is going from left to right, SW1 will reset the QLR and QRL latches. Then, SW2 gets activated, and QLR is set to high. When the train hits SW3, QRL remains in its current state (0) and LR latch is set to 1. Finally, when SW4 is activated QLR is reset.

The problem I'm having is that, when SW3 is activated, the LR latch does not get the logical 0 out of the inverter.

The moment I connect the Q output of the QLR latch to the inverter (7404) my QRL gets set to high.

enter image description here

Any help reviewing fundamental issues with my design will be highly appreciated

\$\endgroup\$
5
  • \$\begingroup\$ The inverter is unnecessary. Use /Q instead. As you seem to be driving the LEDs without resistors, Q may not be reaching the correct logic levels. \$\endgroup\$ Sep 17 '20 at 12:13
  • \$\begingroup\$ Thank you for your comment Brian, i'm actually using 220k resistors for the LEDs. As to inverters, I'm using a 74279 so had to add them to invert the output. \$\endgroup\$
    – jjcasflo
    Sep 17 '20 at 13:05
  • \$\begingroup\$ Another issue is that you leave various inputs undefined (floating) when the switches are open. With bipolar TTL logic they tend to drift high but for reliability, always use a pullup (4k7 or 10k) or a pulldown (< 1k). \$\endgroup\$ Sep 17 '20 at 13:13
  • \$\begingroup\$ Thanks Brian! I will get to work on the inputs \$\endgroup\$
    – jjcasflo
    Sep 17 '20 at 13:37
  • \$\begingroup\$ Realistically this would be an MCU software task today, as such is both electrically simpler and able to implement a much more sophisticated algorithm that can resist various false output issues in a simplistic one. \$\endgroup\$ Sep 18 '20 at 1:37
1
\$\begingroup\$

The comment from Brian Drummond led me to add OR gates at the Set inputs of each latch in order to have all the inputs defined when the switches are open.

I redesigned my circuit and it works. Redesigned Circuit

Thanks Brian

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.