You may be familiar with computers as devices that store a collection of programs like files or graphics.
Right now in this lecture, we will shift our perspectives to something different here.
We will look at computers as billions of two state switches.
Consider this as light switches.
These are the.
This means off and on right.
We will look at computers as billions of two state switches managed by the control unit.
Control unit.
In this case, let's say it's you that controls this right now.
In the previous lecture, we explored how computers communicate with the outside World using the input
and output systems.
Now we will investigate how computers encode.
And store data in memory.
And we will write a C programs to reinforce these concepts in next lecture.
Everything your computer does from streaming a video, uh, to compiling a code like this, relies on
a billions of two state switches working together to make some sensible data, right?
Each unique configuration of switches represents a specific state.
Describing this state in a plain language will be tedious.
So instead we use the numeric representations instead of writing like on or off.
But you will see on or off representations of one and zero.
In some examples, basically, uh, on here is one and off here is zero.
It's like a light bulb.
So this is a light bulb.
Sorry for my drawing skills here.
So light bulb does not have a light.
So this is off.
And if the light bulb is on then it shines right.
So this is basically on right.
This has the same, uh, logic.
And at the core of every computer, there are billions of microscopic switches called tran Resistors.
Now, each transistor can exist in one of two states, on or off.
Right.
Which on means electrical current is flowing off means it's not.
And these two states represents the most basic form of information.
The ones or zeros.
This is why computers use the binary system.
Now we call it the binary.
And now.
How we write binary is to make it more understandable.
For example
1101.
Now this is a binary number.
Each activity you perform on a computer, whether it's a playing a song, writing a document, or browsing
a website, this boils down to manipulating combinations of ones and zeros, right?
Now what is a bit you may ask?
Now a bit.
A bit is the smallest unit of data in a computer.
Now the word bit comes from binary.
Digit.
It be and bit the word from binary.
The bit comes from binary digit a bit as I explained, can be one which is on or zero which is off.
However, a single bit is too small to represent useful information.
So computers group bits together to make some sensible information that makes sense, right?
So eight bits.
Equals one byte.
Right.
Now a byte is big enough to store one character.
Oops, sorry.
Yeah, a byte is big enough to store one character.
Can you see the screen?
Yeah.
That's perfect.
So we can store.
Characters inside eight bits, which is one byte.
So what?
What can we store?
For example, a.
We can store single A, single B Or like single.
See the question mark.
Right.
And the pattern of eight bits in Ascii representation.
Of the letter A.
How can we do that is a.
Here is 0100
half byte and 0001.
So we will.
It's always advisable to write bits and bytes in a for format.
And yeah that's basically it.
Uh this is a in a binary representation in Ascii.
Representation here.
So why computers use binary at all?
Now, binary is ideal for electronics because it is simple and stable.
Now there is a three main reasons here.
The first is.
Electrical efficiency.
Two voltage levels like zero volts.
And five volts.
Are easier to distinguish than ten different levels.
Right.
or so, 0.5V.
Yeah.
This is another form of information which you will learn later.
But yeah, that's basically it is efficient.
Or it could be like 0V or 3V or 1.3V, which I, I strongly believe that if you have got into your Bios
settings.
There's a choice that you can make.
Um, the options on the 1.3V or three volts.
And yeah, that's basically the most efficient as computers get right now.
And it has error resistance.
So binary signals are less likely to be corrupted.
It is either zero volts or some volts, like 3V or 5V.
Right.
And it is simple.
So circuits built for two state logic are more reliable and easier to design.
Now, as humans you know that we use decimal.
Decimal.
Yes.
So if you don't know what decimal is, decimal is the basically base ten.
Base ten, which we use like ten.
Right.
Or 296 or 300 90 or 1005.
Right.
This is our number system that humans use.
But binary which is base two, is perfectly suited for hardware, so all modern digital computers use
binary under the hood.
And there's another nice thing we have which represented large binary numbers in hexadecimal notation.
And as you have seen so far, binaries, binary numbers can get very long very quickly.
Right.
So for example zero or.
110101101010
and 0111.
Now this might look much but compared this is basically means two war two characters in Ascii here.
Now this is hard to read and prone to mistakes.
And that's where hexadecimal helps the hexadecimal, which is let's say the hexadecimal.
Hexa decimal.
Or hex.
Is a base 16.
16 number systems, so it uses digits from zero.
I will also take notice.
So from 0 to 9 and letters from A to F.
Or uppercase A to f.
So uppercase and lowercase doesn't matter here.
So you can write both ways.
It is either uppercase or lowercase.
In computer language, it doesn't matter at all, and one hex digit can represents four binary digits.
So here.
This is basically.
A one hex.
So as I said one hex character can represent four binary digits.
In this case it is four hex right.
In this case it is four hex.
So each one is one hex hexadecimal one hexadecimal.
One hexadecimal and one hexadecimal.
So why use hex at all?
Hex has you have seen so far, is easier to read, has a shorter representation, and it is common in
debugging and programming, as you will see in next lectures.
So basically this binary here 1101 we'll use different color means be in Ascii.
And for example 0110 is.
Six.
And 1010 is a.
A.
Or yeah we can write uppercase.
And yeah we have 10111 is seven.
By the way, don't miss.
Don't make mistakes here.
These are all hex.
Hex.
This is not a word here.
This is a hexadecimal representation, right?
And this is a number.
This is a hexadecimal representation.
Don't make a mistake here.
This is hex two and this is hex two.
So if you see £0.07 in debugger, what does this mean?
Seven b means translates to 70111.
And B is 1101.
Yeah that's not so hard right.
And also for example b6 here translates into b P is 1101 and 0110.
Or for example, six seven translates into.
What?
Six seven translates into.
Yeah zero one, one zero and seven here 0111.
So these are not words.
I will remind you, these are just the hexadecimal representation of bits here.
And you can use the tools like calculator applications or online converters to help while learning this.