Logic Gate Simulator

This program allows you to simulate simple circuits of logic gates on the screen. The gates and the "wires" connecting them are chosen from the toolbox of icons at the top of the page and then by clicking on the appropriate square on the grid itself.

Most of the gates are self explanatory - simply click on them, then click on the grid. The same applies to the eraser tool. This restores a grid square to a blank. However, the following items should be explained:

Switch This symbol represents a switch. When it is first placed, it is yellow as shown here, indicating that it has not been set to 1 or 0. To set a switch to 1 or 0, make sure that you haven't selected the eraser tool and click on the switch you have placed on the board again. It will change to red (1 or TRUE), then to blue (0 or FALSE) on the next click, then oscillate between the two on further clicks. Of course, if the eraser tool has been selected, the switch will simply disappear.


Eraser You should set each switch to 1 or 0 before running the circuit with the button. Any input that is not connected to a switch in the 1 or 0 condition will be assumed to be in a 0 condition. We say that the inputs "float low".


LightThis symbol represents a light bulb. If it is connected to a 1 signal, it will glow. Otherwise it will remain dark. Light bulbs aren't really necessary on this simulator as the lines change colour (red or blue) to indicate 1 or 0, but they can be used for emphasis.

Light bulbs have connections on both sides, so they can be connected on wires leading between gates and switches, i.e. you can connect other items both before and after the light bulb.

The best way to learn about using the simulator is, as you might expect, to play around with it.

Saving and Loading

    

Unfortunately, JavaScript (the language in which this simulation is written) has no file operations (that I know of! If I'm wrong, please let me know!) The only way we can implement some sort of save and load is by using a text area. For this reason, I have included a textarea below the main area.

When you click on the button, it writes all the data describing the circuit into the text area at the side and highlights all the text. You should use Copy and Paste to put the data into some text editor (such as Notepad or MS Word), which does have a save facility.

Loading is done using the same procedure in reverse. This time you load the data file into Word or Notepad (or whatever), use Copy and Paste to move the data into the text area, and then click on the button. If the data is in the correct format (and it will be if you have simply loaded in a previously saved file without altering it), then it will be loaded into the simulator.