1 00:00:00,170 --> 00:00:03,990 >> This is Dr. Cynthia Furse at the University of Utah. 2 00:00:03,990 --> 00:00:08,220 Today I'd like to talk about a very brief introduction to digital circuits. 3 00:00:08,220 --> 00:00:10,290 First, we are going to talk about analog and 4 00:00:10,290 --> 00:00:13,140 digital numbers and how these numbers are used for math. 5 00:00:13,140 --> 00:00:16,379 Then we'll talk about how computers use binary numbers and 6 00:00:16,379 --> 00:00:18,150 the digital logic gates that would be inside 7 00:00:18,150 --> 00:00:21,795 the computer and then finally how to hook up these digital circuits. 8 00:00:21,795 --> 00:00:24,285 Digital is basically a fixed value. 9 00:00:24,285 --> 00:00:26,370 It can take on one or a few values. 10 00:00:26,370 --> 00:00:27,780 It's something you can count. 11 00:00:27,780 --> 00:00:30,705 Digital is like the digits on your hand. 12 00:00:30,705 --> 00:00:32,430 Analog values vary. 13 00:00:32,430 --> 00:00:34,005 They can take on any value. 14 00:00:34,005 --> 00:00:35,445 They're something you can measure, 15 00:00:35,445 --> 00:00:38,345 such as the distance between your hands. 16 00:00:38,345 --> 00:00:40,835 Let's think of a fuel gauge for instance. 17 00:00:40,835 --> 00:00:43,670 The analog gauge, the circle across the top, 18 00:00:43,670 --> 00:00:45,410 tells you how much fuel you have. 19 00:00:45,410 --> 00:00:49,130 You have a full tank or a half a tank or a little more than a half a tank of gas. 20 00:00:49,130 --> 00:00:51,500 But when you're just about ready to run out, 21 00:00:51,500 --> 00:00:54,575 the digital light turns on to tell you that you either 22 00:00:54,575 --> 00:00:58,235 don't have enough when the light is on or that you do when the light is off. 23 00:00:58,235 --> 00:01:01,955 There are two choices: You either have enough fuel or you don't. 24 00:01:01,955 --> 00:01:05,375 Analog versus digital clocks both tell us time. 25 00:01:05,375 --> 00:01:09,365 The analog clock tells us what time it is in a continuous fashion. 26 00:01:09,365 --> 00:01:12,590 For example, here it's just a little before 12:40. 27 00:01:12,590 --> 00:01:15,740 The digital clock tells us what hour and minute it is. 28 00:01:15,740 --> 00:01:18,680 That's a countable number of hours and minutes. 29 00:01:18,680 --> 00:01:23,555 One of my favorite applications of analog and digital is in audio recording. 30 00:01:23,555 --> 00:01:26,930 Dr. Tom Stockham was a professor at the University of Utah. 31 00:01:26,930 --> 00:01:30,620 He was a big fan of opera particularly, Enrico Caruso, 32 00:01:30,620 --> 00:01:33,380 and he had a number of opera recordings that were done at the turn of 33 00:01:33,380 --> 00:01:36,515 the century when the recording instruments weren't very good. 34 00:01:36,515 --> 00:01:39,350 He wanted to be able to remove the old distortion from 35 00:01:39,350 --> 00:01:43,820 these recordings so that he could hear this marvelous opera singer in better precision. 36 00:01:43,820 --> 00:01:45,710 So, he took the analog recordings, 37 00:01:45,710 --> 00:01:47,300 the tapes that you see here, 38 00:01:47,300 --> 00:01:48,875 and converted them to digital. 39 00:01:48,875 --> 00:01:52,590 He's considered the father of modern digital recording or the CD, 40 00:01:52,590 --> 00:01:55,340 and he really did that to remove the distortion. 41 00:01:55,340 --> 00:01:59,270 There are many other reasons you might watch a record things in digital as well, 42 00:01:59,270 --> 00:02:04,760 but the original application was to remove the distortion from opera recordings. 43 00:02:04,760 --> 00:02:07,670 Analog versus digital is very important in 44 00:02:07,670 --> 00:02:09,889 the types of measurement equipment we use also, 45 00:02:09,889 --> 00:02:11,960 such as the volt meter shown here. 46 00:02:11,960 --> 00:02:16,385 An analog voltmeter tells you what voltage it is in a continuous fashion. 47 00:02:16,385 --> 00:02:20,120 The digital voltmeter is what you're familiar with on the myDAQ that 48 00:02:20,120 --> 00:02:24,110 tells you the voltage to within a certain countable number of digits. 49 00:02:24,110 --> 00:02:26,090 There also are vault testers, 50 00:02:26,090 --> 00:02:29,150 such as the craftsman design shown here that tell 51 00:02:29,150 --> 00:02:33,265 you if the voltage is on or off that would be true digital. 52 00:02:33,265 --> 00:02:35,520 When we talk about voltages, 53 00:02:35,520 --> 00:02:38,150 an analog voltage can have any value, 54 00:02:38,150 --> 00:02:40,980 such as the voltage going into a light bulb from a dimmer switch. 55 00:02:40,980 --> 00:02:44,510 The light will turn on at any little tiny amount of value. 56 00:02:44,510 --> 00:02:47,270 It's basically potentiometer that 57 00:02:47,270 --> 00:02:50,360 controls the amount of voltage that's getting to the light. 58 00:02:50,360 --> 00:02:53,410 A digital voltage is a very limited set of voltages, 59 00:02:53,410 --> 00:02:55,475 more typical of your traditional switch. 60 00:02:55,475 --> 00:02:56,870 The light is either on, 61 00:02:56,870 --> 00:02:59,630 1, or it's off, 0. 62 00:02:59,630 --> 00:03:02,675 An analog voltage can have any value, 63 00:03:02,675 --> 00:03:05,075 such as this swirl that's shown here. 64 00:03:05,075 --> 00:03:07,970 A digital voltage has a limited set of values, 65 00:03:07,970 --> 00:03:12,320 a limited set of steps such as this stair step voltage shown here. 66 00:03:12,320 --> 00:03:16,295 Digital voltages are represented with binary numbers. 67 00:03:16,295 --> 00:03:18,560 The analog voltage, this dashed line, 68 00:03:18,560 --> 00:03:20,885 you can see is a continuous solid line. 69 00:03:20,885 --> 00:03:23,720 If we wanted to say that full-scale is eight and we 70 00:03:23,720 --> 00:03:26,470 wanted to divide that into eight individual sets, 71 00:03:26,470 --> 00:03:29,690 that would be one way that we could represent digital values. 72 00:03:29,690 --> 00:03:33,110 So our value is either less than one-eighth, 73 00:03:33,110 --> 00:03:35,720 it's 0, or it's one-eighth, 74 00:03:35,720 --> 00:03:38,735 two-eighths, three-eighths, four-eighths and so on. 75 00:03:38,735 --> 00:03:41,310 Here's the digital code 76 00:03:43,780 --> 00:03:49,745 that could be used to represent the digital representation of the analog value. 77 00:03:49,745 --> 00:03:53,000 We use analog to digital conversion to convert 78 00:03:53,000 --> 00:03:56,135 between the analog value and the stair step digital value, 79 00:03:56,135 --> 00:03:59,255 and we use digital to analog value to convert back. 80 00:03:59,255 --> 00:04:03,185 The error at each of these cases is called quantization error. 81 00:04:03,185 --> 00:04:06,095 Let's talk about counting with binary numbers. 82 00:04:06,095 --> 00:04:10,910 I'm going to use three bits of binary number here to represent a 0. 83 00:04:10,910 --> 00:04:12,770 If all of my lights are off, 84 00:04:12,770 --> 00:04:14,360 my value will be 0. 85 00:04:14,360 --> 00:04:15,560 If my first light is on, 86 00:04:15,560 --> 00:04:16,700 that will be a 1. 87 00:04:16,700 --> 00:04:20,135 If my second light is on and my first light is off, that's a 2. 88 00:04:20,135 --> 00:04:21,829 Here we have two lights that are on, 89 00:04:21,829 --> 00:04:23,645 that's a 3 and so on. 90 00:04:23,645 --> 00:04:25,610 The reason I have to do this is because 91 00:04:25,610 --> 00:04:29,450 the computer can only represent things that are either on or off, 92 00:04:29,450 --> 00:04:34,445 and this allows me to count from 0-7 in a binary sequence. 93 00:04:34,445 --> 00:04:39,120 We talk about bits and bytes and sure that you've heard about these in normal use. 94 00:04:39,120 --> 00:04:44,060 So, a bit is each one of these individual things with a light could be on or off. 95 00:04:44,060 --> 00:04:46,145 I've shown eight bits here. 96 00:04:46,145 --> 00:04:49,610 Eight bits total up to one byte. 97 00:04:49,610 --> 00:04:52,655 Computers represent numbers or sets of bits eight, 98 00:04:52,655 --> 00:04:54,200 16 or 32 bit, 99 00:04:54,200 --> 00:04:56,105 for example, and an exponent. 100 00:04:56,105 --> 00:04:58,130 So, if we wanted to count to 2,000, 101 00:04:58,130 --> 00:05:00,725 we would say that's 2 times 10 to the third. 102 00:05:00,725 --> 00:05:03,340 We'd represent that as 2, 103 00:05:03,340 --> 00:05:05,585 there's one light on and one light off, 104 00:05:05,585 --> 00:05:08,730 times 10 to the third. There's the 3. 105 00:05:08,830 --> 00:05:12,830 Computers represent letters with a code called ASCII. 106 00:05:12,830 --> 00:05:19,145 We use a single byte to represent A as 0100001. 107 00:05:19,145 --> 00:05:22,445 We also say this is a 4 1. 108 00:05:22,445 --> 00:05:24,695 So, A is equal to 41. 109 00:05:24,695 --> 00:05:27,395 B is 4 2. 110 00:05:27,395 --> 00:05:30,575 C is 4 3 and so on. 111 00:05:30,575 --> 00:05:34,115 Small a is still going to have the 1 on the end, 112 00:05:34,115 --> 00:05:35,435 but instead of having a 4, 113 00:05:35,435 --> 00:05:38,090 it's going to have 6 etc. 114 00:05:38,090 --> 00:05:39,755 So, just for fun, 115 00:05:39,755 --> 00:05:44,430 why don't you stop this recording and see if you can write your name in ASCII code. 116 00:05:44,920 --> 00:05:48,110 Computers represent pictures with pixels. 117 00:05:48,110 --> 00:05:50,490 You've seen this in your digital camera or your printer, 118 00:05:50,490 --> 00:05:54,410 how many dots per inch you might use for your printer or your scanner. 119 00:05:54,410 --> 00:05:58,295 The digital values could either be on and off or in this case I'm 120 00:05:58,295 --> 00:06:02,190 showing you grayscale for the letter a and then an analog value,. 121 00:06:02,190 --> 00:06:03,485 is it truly analog? 122 00:06:03,485 --> 00:06:08,360 No. It's probably actually just a higher number of pixels so you don't see the edges. 123 00:06:08,360 --> 00:06:13,270 Computer represents color as combinations of red, 124 00:06:13,270 --> 00:06:15,185 green and blue called RGB. 125 00:06:15,185 --> 00:06:16,790 You can see the red corner, 126 00:06:16,790 --> 00:06:19,100 green corner and blue corner of this curve, 127 00:06:19,100 --> 00:06:20,795 and as you add different combinations, 128 00:06:20,795 --> 00:06:24,280 you can actually get any color i the color system. 129 00:06:24,280 --> 00:06:30,300 Computer logic is going to use on and off, switches on and off. 130 00:06:30,300 --> 00:06:33,930 Computer circuits on and off representing 1 and 0, 131 00:06:33,930 --> 00:06:37,235 and these represent yes and no or true and false values. 132 00:06:37,235 --> 00:06:40,940 They're typically 5 and 0 volts. 133 00:06:40,940 --> 00:06:42,900 Let's go through an example. 134 00:06:42,900 --> 00:06:46,175 Let's suppose, we wanted to build a battery voltage sensing system, 135 00:06:46,175 --> 00:06:50,300 and a battery is considered low when its voltage is under 1.3. 136 00:06:50,300 --> 00:06:51,965 Let's say I've got two batteries. 137 00:06:51,965 --> 00:06:54,035 So, for example, I want to know, 138 00:06:54,035 --> 00:06:55,955 is this one battery charged? 139 00:06:55,955 --> 00:06:57,710 In ECE-speak, that is, 140 00:06:57,710 --> 00:07:00,650 is the battery voltage above 1.3 volts? 141 00:07:00,650 --> 00:07:04,315 So, what I'm going to do is convert this value to digital, 142 00:07:04,315 --> 00:07:06,560 a value of zero or five volts. 143 00:07:06,560 --> 00:07:09,980 We know one way to do that and that's with an op-amp circuit. 144 00:07:09,980 --> 00:07:12,740 I could put the battery into the positive terminal and 145 00:07:12,740 --> 00:07:16,205 the comparison voltage 1.3 volts into the negative terminal, 146 00:07:16,205 --> 00:07:21,420 and then if I used Vcc at five volts and zero volts here at my two rails, 147 00:07:21,420 --> 00:07:26,475 I know that my output would be a times vb minus 1.3. 148 00:07:26,475 --> 00:07:29,780 But it would whale out at either zero or five volts. 149 00:07:29,780 --> 00:07:32,860 That might be my digital 1 or my digital 0. 150 00:07:32,860 --> 00:07:34,895 If this happened to be equal to 0, 151 00:07:34,895 --> 00:07:37,155 my V0 would be 0. 152 00:07:37,155 --> 00:07:39,990 If the Vp was greater than Vn, 153 00:07:39,990 --> 00:07:41,460 my value would be 1. 154 00:07:41,460 --> 00:07:46,235 The battery is charged or if it's less then my battery would be 0, 155 00:07:46,235 --> 00:07:48,870 my battery is not charged. 156 00:07:49,040 --> 00:07:52,415 Now, let's see how that would play into logic gates. 157 00:07:52,415 --> 00:07:55,460 There are several types of circuits that are 158 00:07:55,460 --> 00:07:58,300 specifically meant to work on zero to five volts, 159 00:07:58,300 --> 00:08:01,275 and they are different types of gates. 160 00:08:01,275 --> 00:08:02,580 One type of gate here, 161 00:08:02,580 --> 00:08:05,235 for example, if I put in a 1, 162 00:08:05,235 --> 00:08:07,290 a five volt or a 0, 163 00:08:07,290 --> 00:08:09,590 a zero volt, this is what would happen. 164 00:08:09,590 --> 00:08:12,140 Let me bring in the input from 165 00:08:12,140 --> 00:08:15,485 one battery tester and the input from the other battery tester. 166 00:08:15,485 --> 00:08:17,360 If they were both 0, 167 00:08:17,360 --> 00:08:19,445 that means that both batteries are uncharged, 168 00:08:19,445 --> 00:08:21,050 I would get a 0. 169 00:08:21,050 --> 00:08:24,220 If one battery is uncharged and the other battery is charged, 170 00:08:24,220 --> 00:08:26,860 note, both batteries aren't charged, will still be a 0. 171 00:08:26,860 --> 00:08:29,720 If one battery is charged and the other battery is not, nope, 172 00:08:29,720 --> 00:08:31,055 they're still not both charged, 173 00:08:31,055 --> 00:08:32,554 but if they are both charged, 174 00:08:32,554 --> 00:08:34,475 I will get an output, a 1. 175 00:08:34,475 --> 00:08:36,140 If I measured that with a voltmeter, 176 00:08:36,140 --> 00:08:37,280 what would I see? 177 00:08:37,280 --> 00:08:40,280 I would see a five volts on the output circuit. 178 00:08:40,280 --> 00:08:41,830 This is called an AND gate. 179 00:08:41,830 --> 00:08:46,685 It tests to see if the two inputs are both 1. 180 00:08:46,685 --> 00:08:52,085 An OR gate is going to test to see if one or the other input is charged. 181 00:08:52,085 --> 00:08:53,910 So, I might be able to ask the question, 182 00:08:53,910 --> 00:08:56,345 is at least one of my batteries charged? 183 00:08:56,345 --> 00:09:00,125 So, then I would test to see is at least one of my batteries charged. 184 00:09:00,125 --> 00:09:01,965 So, here I have 0 and 0. 185 00:09:01,965 --> 00:09:04,375 No. Both batteries are uncharged in this case. 186 00:09:04,375 --> 00:09:05,815 So, I get a 0 output. 187 00:09:05,815 --> 00:09:07,900 Here, I have an uncharged and a charged. 188 00:09:07,900 --> 00:09:09,835 Yeah. One of my battery is charged. 189 00:09:09,835 --> 00:09:11,410 Here, the other battery is charged, 190 00:09:11,410 --> 00:09:14,945 and here both batteries are charged. That's an OR gate. 191 00:09:14,945 --> 00:09:16,785 Now, I could ask the question, 192 00:09:16,785 --> 00:09:19,450 does at least one of my batteries need to be charged? 193 00:09:19,450 --> 00:09:23,055 I could bring in the voltage from either of my battery testing circuits, 194 00:09:23,055 --> 00:09:25,425 and I will see if I have 0 and 0. 195 00:09:25,425 --> 00:09:26,565 They both need to be charged. 196 00:09:26,565 --> 00:09:28,105 Yeah. Need charging there. 197 00:09:28,105 --> 00:09:30,180 This one needs to be charged, this one doesn't. 198 00:09:30,180 --> 00:09:32,285 But, yes, I still need to get out my charger. 199 00:09:32,285 --> 00:09:34,000 This one's charged, that one's not, 200 00:09:34,000 --> 00:09:35,515 get out your charger again. 201 00:09:35,515 --> 00:09:36,820 Charged and charged. 202 00:09:36,820 --> 00:09:38,525 No. I don't need my charger. 203 00:09:38,525 --> 00:09:40,465 This is called a NAND gate, 204 00:09:40,465 --> 00:09:42,300 N for NOT AND. 205 00:09:42,300 --> 00:09:45,395 Here are some other circuits that you could do. 206 00:09:45,395 --> 00:09:47,810 A NOT gate just inverts your circuit. 207 00:09:47,810 --> 00:09:49,280 If it comes in as a 0, 208 00:09:49,280 --> 00:09:50,495 it'll change it to a 1. 209 00:09:50,495 --> 00:09:53,180 If it comes in a 1, it'll change it to a 0. 210 00:09:53,180 --> 00:09:54,740 Here's an exclusive or. 211 00:09:54,740 --> 00:09:58,220 You're actually going to use this in your next lab. This is how it works. 212 00:09:58,220 --> 00:10:01,265 If they are both 0, then the output is 0. 213 00:10:01,265 --> 00:10:03,590 If it is 0 and 1, the output is 1. 214 00:10:03,590 --> 00:10:05,240 1 and 0, the output is 1. 215 00:10:05,240 --> 00:10:07,295 Or 1 and 1, the output is 0. 216 00:10:07,295 --> 00:10:14,860 This circuit is telling you if there's a difference between your two testers. 217 00:10:15,770 --> 00:10:18,920 Now, let's talk about building with logic gates. 218 00:10:18,920 --> 00:10:23,825 Remember when you use the op-amp you had to be able to put a power supply voltage on it, 219 00:10:23,825 --> 00:10:25,295 you have to hear also. 220 00:10:25,295 --> 00:10:29,075 Normally Vss will be five volts and Vdd will be ground. 221 00:10:29,075 --> 00:10:30,850 You have this little chip right here, 222 00:10:30,850 --> 00:10:33,890 and let's suppose we want to hook up an AND gate where we have 223 00:10:33,890 --> 00:10:37,425 an input A and an input B and an output. 224 00:10:37,425 --> 00:10:39,300 Right here is the input A, 225 00:10:39,300 --> 00:10:41,100 the input B and the output. 226 00:10:41,100 --> 00:10:44,090 The chip, this is the part that goes on your breadboard, 227 00:10:44,090 --> 00:10:46,750 will typically have four AND gates, 228 00:10:46,750 --> 00:10:50,280 each of them with separate input and outputs as shown. 229 00:10:50,300 --> 00:10:54,005 So, that's a really fast introduction to digital circuits. 230 00:10:54,005 --> 00:10:56,960 We compared analog and digital ideas, 231 00:10:56,960 --> 00:11:00,590 as well as talked a little bit about digital numbers and their binary math, 232 00:11:00,590 --> 00:11:04,995 how computers use these numbers and these types of logic gates, NOT, 233 00:11:04,995 --> 00:11:07,845 OR, XOR, AND and NAND, 234 00:11:07,845 --> 00:11:10,835 and then just briefly how to hook them up. 235 00:11:10,835 --> 00:11:13,190 Thank you very much for joining me, 236 00:11:13,190 --> 00:11:19,140 and this video is brought to you from Tombstone Rock near Moab, Utah.