Presentation is loading. Please wait.

Presentation is loading. Please wait.

9.2 Digital Logic, DIO and DAC why digital logic?

Similar presentations


Presentation on theme: "9.2 Digital Logic, DIO and DAC why digital logic?"— Presentation transcript:

1 9.2 Digital Logic, DIO and DAC why digital logic?
truth tables for digital logic P NOT P AND P OR P XOR P NAND P NOR examples of logic circuits digital input and output (DIO) digital-to-analog conversion (DAC) 9.2 : 1/11

2 Why Digital Logic? High-voltage instruments are often interlocked to protect the user. Each access point is connected to a switch that has a binary output (0 closed, 1 open). The high voltage is shut down if any access point is opened. This is accomplished with OR logic. shut_off? = sw1 OR sw2 OR sw3 OR sw4 Before a spectrum is recorded it might be necessary for the user to click on a scan button, the monochromator be set to the starting wavelength, and the sample chamber door be shut. record? = scan AND startl AND door_shut These types of logic decisions can be made in hardware or software. The hardware option simplifies the computer program and reduces the number of bits of logic information that need to be input to the computer. 9.2 : 2/11

3 Logic Gates and Truth Tables (1)
For electronics a 1 is taken as true and a 0 as false. The most common logic family is transistor-transistor logic (TTL) where +5 V = 1 and 0 V = 0. NOT gate: Q = NOT A also written as A Q 0 1 1 0 AND gate: Q = A AND B also written as AB A B Q 0 0 0 0 1 0 1 0 0 1 1 1 9.2 : 3/11

4 Logic Gates and Truth Tables (2)
OR gate: Q = A OR B also written as A+B A B Q 0 0 0 0 1 1 1 0 1 1 1 1 XOR gate: Q = A XOR B also written as AB 1 1 0 note that OR and XOR differ when both inputs are 1 9.2 : 4/11

5 Logic Gates and Truth Tables (3)
NAND gate: Q = A NAND B also written as A B Q 0 0 1 0 1 1 1 0 1 1 1 0 NOR gate: Q = A NOR B also written as 0 1 0 1 0 0 9.2 : 5/11

6 Example Logic Circuit (1)
use OR, NAND and AND logic to create XOR logic A B (OR) (NAND) ()AND() 9.2 : 6/11

7 Example Logic Circuit (2)
use XOR, AND and OR logic to create an adder with carry from the right and carry to the left: A + B + Cin = S + Cout the required truth table is given below (rotated 90) Cin A B S Cout to see this circuit in action see: 9.2 : 7/11

8 Digital Input & Output (DIO)
binary output generated by external digital logic often needs to be communicated to a computer program similarly, a logic calculation performed by software often needs to be communicated to an external circuit the number of bits available for DIO depends upon the specific hardware with multiples of 8 being common for output the computer sets the bits and the register holds the values until they are read by the external circuit for input the external circuit sets the bits and the register holds the values until they are read by the computer program 9.2 : 8/11

9 DIO Continued besides the DIO registers, control bits (flags) are necessary For example, an "input ready" bit tells the computer that a new value is ready for reading. After the computer reads the DIO it might set an "input read" bit that tells the external circuit that it can provide updated information. This is called handshaking. A external circuit can "watch" an "output ready" control bit. With this approach the logic output will not be read until the computer has updated the DIO. if the experiment has voltages that might inadvertently damage the DIO circuitry (or worse get into the computer), the outputs can be optically isolated using light emitting diode/photodiode combinations when the external circuit uses high voltage or the instrument is in a corrosive environment, fiber optics couplers can transfer the digital logic information 9.2 : 9/11

10 Digital-to-Analog Conversion
Often a digital value generated by a program needs to be converted into an external voltage. An example might be the generation of a voltage ramp in electrochemistry. In the DAC shown below individual bits control a transistor switch that provides current to the op-amp. The resistor ladder makes the current associated with each bit to be exactly 1/2 that of the bit to the left. The current from all bits is summed. The op-amp behaves as a current-to-voltage converter. 9.2 : 10/11

11 DAC Performance when all the binary combinations are output in order, the DAC output resembles a staircase commercial DACs have from 4 to 18 bits (16 to 262,144 steps) common output ranges might be 0 to 10 V or -5 to +5 V some DACs have software controlled voltage ranges most DACs can output new voltages every millisecond permitting the generation of arbitrarily-shaped waveforms 9.2 : 11/11


Download ppt "9.2 Digital Logic, DIO and DAC why digital logic?"

Similar presentations


Ads by Google