A Practical Way to Design Logical Circuits

by f5AFfMhv in Circuits > Electronics

76 Views, 0 Favorites, 0 Comments

A Practical Way to Design Logical Circuits

simulation.gif

This will be a tutorial how to design a logical circuits using readily available software.

First we need to decide what task our circuit needs to accomplish. I decided on generating Morse code SOS signal.

Supplies

Computer with working internet connection.

Timing Diagram

waveform.png

Morse code has following rules for signaling:

  • dot is 1 time unit
  • dash is 3 time units
  • the space between symbols of the same letter is 1 time unit
  • the space between words is 7 time units.

Following these rules SOS signal timing diagram will look like in the picture.

Diagram is made with wavedrom online tool. You can import wavedrom_waveform.json file for your modifications.

Truth Table

truth_table.PNG

From timing diagram we see that 34 independent logical states are needed. This introduces a problem as we could reduce logical circuit complexity by using 32 states instead as it will require 5 inputs for our truth table (2^5=32).

I decided to violate last Morse code signaling rule and use 5 time units for spacing between words instead of 7.

We can think of our truth table inputs A, B, C, D, E as 5bit binary number, which starts from 00000 and is increased by one on each step until it reaches 11111.

OUT value is taken from the timing diagram on each clock cycle, it represents our SOS signal.

Designing Logical Circuit

generated_circuit.png
simplified_circuit.png
simulation.gif

I'm using software called Logisim to generate circuits. It can take a truth table as input. You can also import provided circuit XML files into Logisim. The generated circuit is not perfect and can be improved manually by removing duplicate components and adjusting the number of inputs for logic gates. This process results in a simplified circuit. Additionally, I have added input signals for circuit simulation.

For creating new circuit follow these steps:

  1. File > New.
  2. Project > Add Circuit (or you can use main circuit, which is created by default).
  3. Window > Combinational Analysis.
  4. Write input names in second box and add them one by one.
  5. Select Outputs tab and add one (or more) output.
  6. Select Table tab and by clicking on each output, you can change its state.
  7. Click Build Circuit. If circuit diagram doesn't appear, there might be some issues in the table.

Clock Signal Generator

555_schematic.png

Probably one of the most well known IC is 555 timer. It can accomplish many different things, one of them is generating square wave. We can utilize it for our SOS circuit. I used 555 Astable Circuit Calculator for choosing circuit component values.

General rules are:

  • Choose R2 value much higher than R1 for 50% duty cycle.
  • C9 sets clock frequency. 330nF capacitor will generate 2Hz signal.
  • To increase frequency, decrease C9 value.


Generating Input Signals

falstad.png

For generating our 5-bit input signal we'll need binary counter. A binary counter works by sequentially counting in binary, incrementing its value by one with each clock pulse.

Full circuit simulation with 555 clock generator, binary counter and logical circuit was done using Falstad. If link doesn't work, you can import attached file.

Wrap Up

pcb_top.png

That is basically it for this tutorial. If you want to see physical implementation of this circuit, you can find it on GitHub.