>> This is Dr. Cynthia Furse at the University of Utah.
Today I'd like to talk about a very brief introduction to digital circuits.
First, we are going to talk about analog and
digital numbers and how these numbers are used for math.
Then we'll talk about how computers use binary numbers and
the digital logic gates that would be inside
the computer and then finally how to hook up these digital circuits.
Digital is basically a fixed value.
It can take on one or a few values.
It's something you can count.
Digital is like the digits on your hand.
Analog values vary.
They can take on any value.
They're something you can measure,
such as the distance between your hands.
Let's think of a fuel gauge for instance.
The analog gauge, the circle across the top,
tells you how much fuel you have.
You have a full tank or a half a tank or a little more than a half a tank of gas.
But when you're just about ready to run out,
the digital light turns on to tell you that you either
don't have enough when the light is on or that you do when the light is off.
There are two choices: You either have enough fuel or you don't.
Analog versus digital clocks both tell us time.
The analog clock tells us what time it is in a continuous fashion.
For example, here it's just a little before 12:40.
The digital clock tells us what hour and minute it is.
That's a countable number of hours and minutes.
One of my favorite applications of analog and digital is in audio recording.
Dr. Tom Stockham was a professor at the University of Utah.
He was a big fan of opera particularly, Enrico Caruso,
and he had a number of opera recordings that were done at the turn of
the century when the recording instruments weren't very good.
He wanted to be able to remove the old distortion from
these recordings so that he could hear this marvelous opera singer in better precision.
So, he took the analog recordings,
the tapes that you see here,
and converted them to digital.
He's considered the father of modern digital recording or the CD,
and he really did that to remove the distortion.
There are many other reasons you might watch a record things in digital as well,
but the original application was to remove the distortion from opera recordings.
Analog versus digital is very important in
the types of measurement equipment we use also,
such as the volt meter shown here.
An analog voltmeter tells you what voltage it is in a continuous fashion.
The digital voltmeter is what you're familiar with on the myDAQ that
tells you the voltage to within a certain countable number of digits.
There also are vault testers,
such as the craftsman design shown here that tell
you if the voltage is on or off that would be true digital.
When we talk about voltages,
an analog voltage can have any value,
such as the voltage going into a light bulb from a dimmer switch.
The light will turn on at any little tiny amount of value.
It's basically potentiometer that
controls the amount of voltage that's getting to the light.
A digital voltage is a very limited set of voltages,
more typical of your traditional switch.
The light is either on,
1, or it's off, 0.
An analog voltage can have any value,
such as this swirl that's shown here.
A digital voltage has a limited set of values,
a limited set of steps such as this stair step voltage shown here.
Digital voltages are represented with binary numbers.
The analog voltage, this dashed line,
you can see is a continuous solid line.
If we wanted to say that full-scale is eight and we
wanted to divide that into eight individual sets,
that would be one way that we could represent digital values.
So our value is either less than one-eighth,
it's 0, or it's one-eighth,
two-eighths, three-eighths, four-eighths and so on.
Here's the digital code
that could be used to represent the digital representation of the analog value.
We use analog to digital conversion to convert
between the analog value and the stair step digital value,
and we use digital to analog value to convert back.
The error at each of these cases is called quantization error.
Let's talk about counting with binary numbers.
I'm going to use three bits of binary number here to represent a 0.
If all of my lights are off,
my value will be 0.
If my first light is on,
that will be a 1.
If my second light is on and my first light is off, that's a 2.
Here we have two lights that are on,
that's a 3 and so on.
The reason I have to do this is because
the computer can only represent things that are either on or off,
and this allows me to count from 0-7 in a binary sequence.
We talk about bits and bytes and sure that you've heard about these in normal use.
So, a bit is each one of these individual things with a light could be on or off.
I've shown eight bits here.
Eight bits total up to one byte.
Computers represent numbers or sets of bits eight,
16 or 32 bit,
for example, and an exponent.
So, if we wanted to count to 2,000,
we would say that's 2 times 10 to the third.
We'd represent that as 2,
there's one light on and one light off,
times 10 to the third. There's the 3.
Computers represent letters with a code called ASCII.
We use a single byte to represent A as 0100001.
We also say this is a 4 1.
So, A is equal to 41.
B is 4 2.
C is 4 3 and so on.
Small a is still going to have the 1 on the end,
but instead of having a 4,
it's going to have 6 etc.
So, just for fun,
why don't you stop this recording and see if you can write your name in ASCII code.
Computers represent pictures with pixels.
You've seen this in your digital camera or your printer,
how many dots per inch you might use for your printer or your scanner.
The digital values could either be on and off or in this case I'm
showing you grayscale for the letter a and then an analog value,.
is it truly analog?
No. It's probably actually just a higher number of pixels so you don't see the edges.
Computer represents color as combinations of red,
green and blue called RGB.
You can see the red corner,
green corner and blue corner of this curve,
and as you add different combinations,
you can actually get any color i the color system.
Computer logic is going to use on and off, switches on and off.
Computer circuits on and off representing 1 and 0,
and these represent yes and no or true and false values.
They're typically 5 and 0 volts.
Let's go through an example.
Let's suppose, we wanted to build a battery voltage sensing system,
and a battery is considered low when its voltage is under 1.3.
Let's say I've got two batteries.
So, for example, I want to know,
is this one battery charged?
In ECE-speak, that is,
is the battery voltage above 1.3 volts?
So, what I'm going to do is convert this value to digital,
a value of zero or five volts.
We know one way to do that and that's with an op-amp circuit.
I could put the battery into the positive terminal and
the comparison voltage 1.3 volts into the negative terminal,
and then if I used Vcc at five volts and zero volts here at my two rails,
I know that my output would be a times vb minus 1.3.
But it would whale out at either zero or five volts.
That might be my digital 1 or my digital 0.
If this happened to be equal to 0,
my V0 would be 0.
If the Vp was greater than Vn,
my value would be 1.
The battery is charged or if it's less then my battery would be 0,
my battery is not charged.
Now, let's see how that would play into logic gates.
There are several types of circuits that are
specifically meant to work on zero to five volts,
and they are different types of gates.
One type of gate here,
for example, if I put in a 1,
a five volt or a 0,
a zero volt, this is what would happen.
Let me bring in the input from
one battery tester and the input from the other battery tester.
If they were both 0,
that means that both batteries are uncharged,
I would get a 0.
If one battery is uncharged and the other battery is charged,
note, both batteries aren't charged, will still be a 0.
If one battery is charged and the other battery is not, nope,
they're still not both charged,
but if they are both charged,
I will get an output, a 1.
If I measured that with a voltmeter,
what would I see?
I would see a five volts on the output circuit.
This is called an AND gate.
It tests to see if the two inputs are both 1.
An OR gate is going to test to see if one or the other input is charged.
So, I might be able to ask the question,
is at least one of my batteries charged?
So, then I would test to see is at least one of my batteries charged.
So, here I have 0 and 0.
No. Both batteries are uncharged in this case.
So, I get a 0 output.
Here, I have an uncharged and a charged.
Yeah. One of my battery is charged.
Here, the other battery is charged,
and here both batteries are charged. That's an OR gate.
Now, I could ask the question,
does at least one of my batteries need to be charged?
I could bring in the voltage from either of my battery testing circuits,
and I will see if I have 0 and 0.
They both need to be charged.
Yeah. Need charging there.
This one needs to be charged, this one doesn't.
But, yes, I still need to get out my charger.
This one's charged, that one's not,
get out your charger again.
Charged and charged.
No. I don't need my charger.
This is called a NAND gate,
N for NOT AND.
Here are some other circuits that you could do.
A NOT gate just inverts your circuit.
If it comes in as a 0,
it'll change it to a 1.
If it comes in a 1, it'll change it to a 0.
Here's an exclusive or.
You're actually going to use this in your next lab. This is how it works.
If they are both 0, then the output is 0.
If it is 0 and 1, the output is 1.
1 and 0, the output is 1.
Or 1 and 1, the output is 0.
This circuit is telling you if there's a difference between your two testers.
Now, let's talk about building with logic gates.
Remember when you use the op-amp you had to be able to put a power supply voltage on it,
you have to hear also.
Normally Vss will be five volts and Vdd will be ground.
You have this little chip right here,
and let's suppose we want to hook up an AND gate where we have
an input A and an input B and an output.
Right here is the input A,
the input B and the output.
The chip, this is the part that goes on your breadboard,
will typically have four AND gates,
each of them with separate input and outputs as shown.
So, that's a really fast introduction to digital circuits.
We compared analog and digital ideas,
as well as talked a little bit about digital numbers and their binary math,
how computers use these numbers and these types of logic gates, NOT,
OR, XOR, AND and NAND,
and then just briefly how to hook them up.
Thank you very much for joining me,
and this video is brought to you from Tombstone Rock near Moab, Utah.