Decision+Making,+Counting+and+Memory

toc = 1.7 Logic Gates =

You will need to be able to identify the following logic gates. Construct truth tables for a **NOT** gate and the following 2-input logic gates: And you must be able to know how to draw logic diagrams using logic gates in combination to solve problems.
 * **AND**
 * **OR**
 * **NAND**
 * **NOR**
 * **XOR**

= Introduction = Looking firstly at analogue and digital systems, for example the clocks below; the traditional mechanical or wind-up clock. It works with cogs and wheels behind the clock face turning continuously, as do the minute and hour hand of the clock. The time displayed is continuous. The digital clock is completely different, it displays the time precisely, when the numbers or digits are changing. But between the changing of one digit to the changing of the next, we do not know the time precisely, the time displayed is non-continuous. A **system** is a combination of elements that work together so that a specific outcome is achieved. Systems are used, applied and developed in all areas of human activity. Especially important are environmental, engineering, energy, manufacturing and information systems. Examples of technological systems are a television, a sewing machine, a bicycle, a conveyor belt, and an electronic alarm. All technological systems have specific inputs, processes and outputs that are controlled manually or automatically. Management and programming of systems are important in technology. Each system contains separate elements that are connected in a specific way so the system will work. In some systems; for example a door lock, the elements or components are within the one system. In others; for example a car, the elements are a series of subsystems and might, as in the thermostat control of a heating system, contain feedback components. Whether a system is appropriate depends on the technical, economic, environmental and social and cultural consequences of its application/s as well as on how well it meets human needs. Students have to consider these factors on both a local and global level and estimate their future impact on societies and environments. Decision making in digital electronics is a bit like playing 'twenty questions', where you are only allowed to answer **yes** or **no.** These yes or no states (answers) are the result of conditions being met. For example: has the switch been presses? Has the saucepan of water boiled? Is it dark enough for the street lights to come on**?** Is the moisture content of the soil in the flower pot too low? Provided you know which switch to press, or the temperature the water has to reach in order to boil, or how it looks when it is boiling, or the level of light, or the amount of moisture needed then you can answer these questions with yes or no. Digital circuits which handle this type of information **yes** and **no**, can also be used to handle other types of information which only have two states. For example: High - Low, Left - Right, True - False, On - Off.
 * Electronic systems**, like these clocks, can work in a continuous or non-continuous manner. Those that work in a continuous way are called **analog** systems, and those that work in a non-continuous way are called **digital** systems.

Digital electronics are based on fast electronic switching circuits. They are either **on** or **off**, their output voltage is either **high (1)** or **low (0)**. Humans need to see or hear analog sound from electronic products such as a CD player or a MP3. And this is done in digital electronics by simulating the analog signal.

In fact digital circuits can be used to handle any kind of information, provided it can be written in **binary** code. Digital systems such as computers handle information and perform calculations using a numbering system called **binary** which consists of just two digits **0** and **1**. Below is a 4-digit binary table: Some circuits will only require one condition to be met, but many will require two or more, for example: automatic sliding doors like those found at department stores and airports, the circuit would need to be designed so that decisions being made could answer the following questions: Is someone in front of the door? Are the doors open? Are the doors closed? Is someone walking through the door? The way in which electronic systems recognize these yes and no answers is to use circuit conditions which are either on or off. Circuits which work on the principle of on or off are known as **digital systems**. It is important to remember that digital systems requires that a simple yes or no answer to the determine their state or condition, and that there is no in between state of half-on or half-off.

= Tasks = There are a variety of circuits that when their inputs are connected to a power supply they make simple logical decision **on** or **off**. These are known as **logic circuits**. Look at the following electrical circuit, two switches are connected in series, and the the output motor will only start when both switch A and B are closed. We can represent all possible situations and their end results in a **truth table**. In such a table "**0**" is used to show there is no output or input, and a "**1**" to show that there is an output or input. A truth table is a table that describes the behavior of a logic gate. It lists the value of the output for every possible combination of the inputs and can be used to simplify the use of logic gates in an electronic circuit. This circuit is an example of an **AND** gate circuit, and represented by the symbol below because they make drawing circuits easier and take up less spacethan drawing individual components. They are commonly used as a safety device in electrical machinery such as washing machines and microwave ovens.
 * Use the examples below and write the questions you would ask in order to be able to answer either yes or no, think about "20 Questions" ||
 * [[image:greenhouse.png align="center"]] ||  || [[image:fire.png align="center"]] ||   || [[image:caralarm.png align="center"]] ||
 * How would you control the conditions required to control a green house? ||  || In the event of a fire in a block of flats, how would you ensure that nobody uses the lifts, once the alarm has been raised? ||   || Car security alarm systems, how are they activated and controlled so they do not accidentally go off? ||



The systems approach to the above circuit is represented in the systems diagram below: Electronic logic gates are components whose main use is in multi-input devices to decide when certain events have happened. They can also be used to make other circuits such as monostable, bistable and astables. Logic gates have two or more inputs and one output and the function of a logic gate is described by its truth table. In the circuit below the two switches are connected in parallel, one or the other, or both of them, could be used to switch on a device, this is an example of a simple **OR** circuit.




 * Task**
 * Which logic gate AND or OR would be the most suitable if you were designing a combination lock in which the output opened the lock?


 * Keypoints**
 * Logic gates are not always required because simple logic functions can be performed with switches or diodes.
 * Capital letters are used to describe logic gate functions e.g. **AND, OR**
 * Inputs are known as A, B and C and the ouput is known as Q

= Solving Problems using Logic Gates = Most homes have air-conditioning systems which can maintain the temperature of the home at a steady level. Energy must be supplied if the temperature rises, and switched off when the temperature reaches the required level. A digital logic circuit can provide this type of control. truth atbles are used to chrck that the correct decisions will be made by the circuitry. In an electronic air-conditioning system the electricty only needs when the air-conditioning unit is running. The logic gate must have a "high" output (logic 1) to turn on the air-conditioning unit. The logic gate must only go "high" when:
 * 1) the output from the thermostat is "high". this happens when the sensor detects that the temperature is too high. Generally this temperature is set by a room thermostat: and
 * 2) the output from the electrical supply is "high", indicating that the electricity is on.


 * Task**
 * Which logic gate would be the most suitable to be included in the air-conditioning system?
 * What type of sensor would be useful in the thermostat?
 * How could the the thermostat trigger the switch to start the air-conditioning unit?
 * List all the possible input conditions of a three-input gate?
 * Write the truth table for a three input OR gate.
 * Write the truth table for a three-input AND gate.


 * http://www.doctronics.co.uk/4011.htm**
 * [|http://www.eas.asu.edu/~holbert/wise/wiseinvest.html]**