WEBVTT

00:00.360 --> 00:10.800
You may be familiar with computers as devices that store a collection of programs like files or graphics.

00:11.720 --> 00:18.840
Right now in this lecture, we will shift our perspectives to something different here.

00:19.360 --> 00:25.920
We will look at computers as billions of two state switches.

00:29.360 --> 00:31.560
Consider this as light switches.

00:32.280 --> 00:33.200
These are the.

00:33.800 --> 00:38.240
This means off and on right.

00:40.560 --> 00:49.320
We will look at computers as billions of two state switches managed by the control unit.

00:49.400 --> 00:50.160
Control unit.

00:50.160 --> 00:56.440
In this case, let's say it's you that controls this right now.

00:56.440 --> 01:03.300
In the previous lecture, we explored how computers communicate with the outside World using the input

01:03.740 --> 01:05.740
and output systems.

01:05.940 --> 01:10.060
Now we will investigate how computers encode.

01:15.340 --> 01:17.900
And store data in memory.

01:17.900 --> 01:25.140
And we will write a C programs to reinforce these concepts in next lecture.

01:27.180 --> 01:36.940
Everything your computer does from streaming a video, uh, to compiling a code like this, relies on

01:36.940 --> 01:47.020
a billions of two state switches working together to make some sensible data, right?

01:47.220 --> 01:51.220
Each unique configuration of switches represents a specific state.

01:51.740 --> 01:54.820
Describing this state in a plain language will be tedious.

01:54.980 --> 02:04.800
So instead we use the numeric representations instead of writing like on or off.

02:05.080 --> 02:10.120
But you will see on or off representations of one and zero.

02:11.480 --> 02:19.080
In some examples, basically, uh, on here is one and off here is zero.

02:19.240 --> 02:21.600
It's like a light bulb.

02:21.760 --> 02:24.080
So this is a light bulb.

02:24.800 --> 02:27.160
Sorry for my drawing skills here.

02:27.160 --> 02:30.000
So light bulb does not have a light.

02:30.000 --> 02:32.520
So this is off.

02:34.240 --> 02:40.200
And if the light bulb is on then it shines right.

02:42.520 --> 02:45.720
So this is basically on right.

02:46.440 --> 02:50.040
This has the same, uh, logic.

02:55.120 --> 03:04.300
And at the core of every computer, there are billions of microscopic switches called tran Resistors.

03:08.500 --> 03:16.980
Now, each transistor can exist in one of two states, on or off.

03:17.220 --> 03:17.780
Right.

03:19.300 --> 03:26.940
Which on means electrical current is flowing off means it's not.

03:30.060 --> 03:35.460
And these two states represents the most basic form of information.

03:35.820 --> 03:39.220
The ones or zeros.

03:39.820 --> 03:43.260
This is why computers use the binary system.

03:43.300 --> 03:45.540
Now we call it the binary.

03:51.100 --> 03:51.740
And now.

03:57.420 --> 04:01.620
How we write binary is to make it more understandable.

04:03.220 --> 04:04.240
For example

04:05.680 --> 04:08.240
1101.

04:09.080 --> 04:10.440
Now this is a binary number.

04:11.880 --> 04:19.360
Each activity you perform on a computer, whether it's a playing a song, writing a document, or browsing

04:19.360 --> 04:27.400
a website, this boils down to manipulating combinations of ones and zeros, right?

04:28.320 --> 04:30.840
Now what is a bit you may ask?

04:30.960 --> 04:32.040
Now a bit.

04:32.480 --> 04:36.920
A bit is the smallest unit of data in a computer.

04:36.960 --> 04:42.440
Now the word bit comes from binary.

04:49.560 --> 04:50.200
Digit.

04:53.560 --> 05:00.440
It be and bit the word from binary.

05:01.000 --> 05:12.050
The bit comes from binary digit a bit as I explained, can be one which is on or zero which is off.

05:12.210 --> 05:16.610
However, a single bit is too small to represent useful information.

05:16.850 --> 05:24.250
So computers group bits together to make some sensible information that makes sense, right?

05:25.890 --> 05:27.370
So eight bits.

05:29.610 --> 05:32.130
Equals one byte.

05:35.410 --> 05:35.810
Right.

05:36.170 --> 05:40.250
Now a byte is big enough to store one character.

05:40.290 --> 05:41.250
Oops, sorry.

05:41.690 --> 05:45.450
Yeah, a byte is big enough to store one character.

05:46.250 --> 05:47.730
Can you see the screen?

05:47.770 --> 05:48.090
Yeah.

05:48.130 --> 05:49.010
That's perfect.

05:50.170 --> 05:51.730
So we can store.

05:54.050 --> 05:57.690
Characters inside eight bits, which is one byte.

05:58.530 --> 05:59.010
So what?

05:59.330 --> 06:00.410
What can we store?

06:00.450 --> 06:01.610
For example, a.

06:01.890 --> 06:06.990
We can store single A, single B Or like single.

06:07.030 --> 06:10.510
See the question mark.

06:10.870 --> 06:11.270
Right.

06:16.310 --> 06:20.910
And the pattern of eight bits in Ascii representation.

06:26.110 --> 06:27.190
Of the letter A.

06:28.750 --> 06:32.390
How can we do that is a.

06:32.430 --> 06:38.190
Here is 0100

06:39.310 --> 06:46.070
half byte and 0001.

06:46.630 --> 06:47.350
So we will.

06:48.710 --> 06:58.270
It's always advisable to write bits and bytes in a for format.

06:59.870 --> 07:01.910
And yeah that's basically it.

07:02.270 --> 07:08.690
Uh this is a in a binary representation in Ascii.

07:12.210 --> 07:13.250
Representation here.

07:14.170 --> 07:16.530
So why computers use binary at all?

07:19.650 --> 07:24.650
Now, binary is ideal for electronics because it is simple and stable.

07:25.730 --> 07:28.010
Now there is a three main reasons here.

07:28.210 --> 07:30.170
The first is.

07:35.530 --> 07:37.050
Electrical efficiency.

07:45.850 --> 07:49.130
Two voltage levels like zero volts.

07:55.250 --> 07:56.650
And five volts.

08:03.010 --> 08:06.170
Are easier to distinguish than ten different levels.

08:06.170 --> 08:06.690
Right.

08:06.910 --> 08:10.270
or so, 0.5V.

08:10.310 --> 08:10.550
Yeah.

08:10.550 --> 08:16.670
This is another form of information which you will learn later.

08:17.270 --> 08:19.590
But yeah, that's basically it is efficient.

08:19.830 --> 08:32.070
Or it could be like 0V or 3V or 1.3V, which I, I strongly believe that if you have got into your Bios

08:32.070 --> 08:32.750
settings.

08:35.590 --> 08:38.830
There's a choice that you can make.

08:39.070 --> 08:44.950
Um, the options on the 1.3V or three volts.

08:46.150 --> 08:52.070
And yeah, that's basically the most efficient as computers get right now.

08:53.590 --> 08:55.790
And it has error resistance.

09:07.970 --> 09:11.650
So binary signals are less likely to be corrupted.

09:11.650 --> 09:16.810
It is either zero volts or some volts, like 3V or 5V.

09:16.850 --> 09:17.290
Right.

09:17.970 --> 09:18.930
And it is simple.

09:23.530 --> 09:28.930
So circuits built for two state logic are more reliable and easier to design.

09:29.290 --> 09:33.090
Now, as humans you know that we use decimal.

09:34.170 --> 09:34.930
Decimal.

09:35.650 --> 09:36.170
Yes.

09:41.610 --> 09:46.890
So if you don't know what decimal is, decimal is the basically base ten.

09:49.090 --> 09:52.410
Base ten, which we use like ten.

09:52.450 --> 09:52.970
Right.

09:53.010 --> 10:01.930
Or 296 or 300 90 or 1005.

10:01.970 --> 10:02.530
Right.

10:02.570 --> 10:06.090
This is our number system that humans use.

10:06.610 --> 10:18.510
But binary which is base two, is perfectly suited for hardware, so all modern digital computers use

10:18.510 --> 10:20.150
binary under the hood.

10:22.750 --> 10:32.630
And there's another nice thing we have which represented large binary numbers in hexadecimal notation.

10:33.070 --> 10:41.270
And as you have seen so far, binaries, binary numbers can get very long very quickly.

10:41.270 --> 10:41.710
Right.

10:42.030 --> 10:44.790
So for example zero or.

10:48.830 --> 10:59.870
110101101010

11:00.590 --> 11:03.950
and 0111.

11:04.230 --> 11:15.210
Now this might look much but compared this is basically means two war two characters in Ascii here.

11:16.050 --> 11:19.170
Now this is hard to read and prone to mistakes.

11:19.490 --> 11:28.170
And that's where hexadecimal helps the hexadecimal, which is let's say the hexadecimal.

11:31.330 --> 11:33.250
Hexa decimal.

11:36.530 --> 11:37.490
Or hex.

11:40.530 --> 11:42.730
Is a base 16.

11:46.170 --> 11:51.490
16 number systems, so it uses digits from zero.

11:51.690 --> 11:53.130
I will also take notice.

11:53.810 --> 11:58.810
So from 0 to 9 and letters from A to F.

12:02.010 --> 12:04.650
Or uppercase A to f.

12:04.650 --> 12:07.410
So uppercase and lowercase doesn't matter here.

12:07.410 --> 12:09.130
So you can write both ways.

12:09.490 --> 12:13.030
It is either uppercase or lowercase.

12:13.750 --> 12:23.110
In computer language, it doesn't matter at all, and one hex digit can represents four binary digits.

12:23.510 --> 12:24.950
So here.

12:28.950 --> 12:30.310
This is basically.

12:32.710 --> 12:33.790
A one hex.

12:34.590 --> 12:41.470
So as I said one hex character can represent four binary digits.

12:42.430 --> 12:44.870
In this case it is four hex right.

12:46.030 --> 12:49.670
In this case it is four hex.

12:50.230 --> 12:57.430
So each one is one hex hexadecimal one hexadecimal.

13:00.430 --> 13:04.470
One hexadecimal and one hexadecimal.

13:07.870 --> 13:09.830
So why use hex at all?

13:10.480 --> 13:18.640
Hex has you have seen so far, is easier to read, has a shorter representation, and it is common in

13:18.640 --> 13:22.160
debugging and programming, as you will see in next lectures.

13:23.280 --> 13:35.440
So basically this binary here 1101 we'll use different color means be in Ascii.

13:37.960 --> 13:43.720
And for example 0110 is.

13:45.800 --> 13:46.400
Six.

13:50.680 --> 13:55.040
And 1010 is a.

13:57.720 --> 13:58.080
A.

14:02.280 --> 14:04.480
Or yeah we can write uppercase.

14:05.720 --> 14:12.940
And yeah we have 10111 is seven.

14:14.580 --> 14:16.940
By the way, don't miss.

14:16.980 --> 14:18.500
Don't make mistakes here.

14:19.020 --> 14:20.820
These are all hex.

14:24.660 --> 14:25.300
Hex.

14:25.340 --> 14:27.460
This is not a word here.

14:27.980 --> 14:30.580
This is a hexadecimal representation, right?

14:30.820 --> 14:32.300
And this is a number.

14:32.300 --> 14:34.060
This is a hexadecimal representation.

14:34.340 --> 14:36.060
Don't make a mistake here.

14:36.060 --> 14:38.900
This is hex two and this is hex two.

14:40.300 --> 14:48.900
So if you see £0.07 in debugger, what does this mean?

14:49.540 --> 14:56.380
Seven b means translates to 70111.

14:57.340 --> 15:02.100
And B is 1101.

15:02.460 --> 15:04.540
Yeah that's not so hard right.

15:05.340 --> 15:20.920
And also for example b6 here translates into b P is 1101 and 0110.

15:21.400 --> 15:26.640
Or for example, six seven translates into.

15:29.120 --> 15:29.720
What?

15:33.440 --> 15:34.960
Six seven translates into.

15:35.000 --> 15:46.440
Yeah zero one, one zero and seven here 0111.

15:49.600 --> 15:51.240
So these are not words.

15:51.920 --> 15:56.760
I will remind you, these are just the hexadecimal representation of bits here.

16:02.720 --> 16:09.920
And you can use the tools like calculator applications or online converters to help while learning this.
