1
00:00:03,930 --> 00:00:07,340
So let's take a look at logical operations.

2
00:00:08,130 --> 00:00:11,040
Firstly let's look at the all operation.

3
00:00:11,190 --> 00:00:16,520
Let's say you have two inputs and one an eye and two and an output.

4
00:00:16,650 --> 00:00:19,640
And let's say these two inputs are disabled.

5
00:00:19,650 --> 00:00:28,020
That is the 0 0 the output you get by performing all operation between these two inputs is zero.

6
00:00:28,020 --> 00:00:37,530
Now let's say one input is zero input AI and one is zero and AI N2 becomes one output you get is one

7
00:00:38,130 --> 00:00:39,630
let's say it's the other way round.

8
00:00:39,630 --> 00:00:43,710
Now Ai and one becomes one an AI and 2 goes to zero.

9
00:00:43,710 --> 00:00:52,470
The output you get is 1 unless a both inputs are 1 or enabled then the output is enabled.

10
00:00:52,470 --> 00:00:55,910
This is the operation let's go to the next one.

11
00:00:55,920 --> 00:01:00,060
The end operation and the end is quite as literal two that mean enough.

12
00:01:00,090 --> 00:01:06,690
And just like that or is literal to the meaning of or let's say you still have two inputs here and an

13
00:01:06,690 --> 00:01:10,790
output and both inputs are zero the output to zero.

14
00:01:10,950 --> 00:01:19,860
Let's say one of them is enabled inputs 2 is enabled and one is disabled the output is still disabled

15
00:01:19,920 --> 00:01:26,590
which is zero less inputs one is enabled and 2 is disabled your output is still zero.

16
00:01:26,620 --> 00:01:36,510
Disabled let's say both of them inputs 1 and input two are both enabled then your output is enabled

17
00:01:37,230 --> 00:01:39,660
or 1 let's look at the last one.

18
00:01:39,720 --> 00:01:49,230
Eat or or the exclusive or operation the exclusive operation takes 2 inputs this let's take the two

19
00:01:49,230 --> 00:01:52,280
input example again the first.

20
00:01:52,710 --> 00:01:55,530
Both inputs are zero you get zero.

21
00:01:56,250 --> 00:02:04,760
Okay now let's say one input to zero and the second input is 1 then to get 1 as an output let's say

22
00:02:04,770 --> 00:02:10,730
the first input is 1 now and a second input is 0 you still get 1 as an output.

23
00:02:10,730 --> 00:02:19,260
Now let's see input 1 and input 2 are both 1 that is enabled here your output is 0.

24
00:02:19,260 --> 00:02:26,400
That's the difference between the all and the exclusive or operation it's exclusively or here by the

25
00:02:26,490 --> 00:02:33,180
operation you could say it works with and as well while we are here let's take a look at how the clock

26
00:02:33,180 --> 00:02:41,220
register our seed Casey complete I O is initialize This is a snapshot from the data sheet and I'd like

27
00:02:41,220 --> 00:02:43,300
to remind you of what we see here.

28
00:02:43,470 --> 00:02:47,090
We can see that bit six to thirty one are reserved.

29
00:02:47,160 --> 00:02:53,550
That is they are read only bit six here to thirty one they are all here implies it's read only it's

30
00:02:53,550 --> 00:03:03,800
reserved we cannot touch it and it's 0 through 5 control put a b c d e f b 0 through 5 here this year

31
00:03:03,810 --> 00:03:13,040
controls put a puts b c d e f also I wanted to take a look at the value written up here as the reset

32
00:03:13,040 --> 00:03:15,340
to value this one here.

33
00:03:16,350 --> 00:03:19,530
It's been enlarged here for your sake it's here.

34
00:03:19,550 --> 00:03:23,730
0 0 0 0 with eight zeros after the X.

35
00:03:23,760 --> 00:03:30,420
This is essentially two bit hexadecimal number to make things easier for ourselves let's converts to

36
00:03:30,480 --> 00:03:41,310
a binary reform we do this by expanding it and I should tell you one hexadecimal digits makes for binary

37
00:03:41,310 --> 00:03:49,860
digits so it's zero here makes for other serious the OBE signifies it's a binary number just like o

38
00:03:49,940 --> 00:03:57,800
x here shows that it's a hexadecimal number the bits we're interested in is this one here bit's five

39
00:03:57,870 --> 00:04:06,240
remember we're counting from 0 0 1 2 3 4 5 so you might see bits number 6 but it spits 5 and we can

40
00:04:06,240 --> 00:04:07,210
find a here.

41
00:04:07,290 --> 00:04:16,110
This is a so we have to change this bit in in order to enable pot f if we were to enable say puts a

42
00:04:16,110 --> 00:04:24,210
we would have to change the first bit here but we enable plain F so this the one we have to change now

43
00:04:24,270 --> 00:04:34,170
let's see how to enable put f all we have to do is change the serial of bits 5 to 1 remember 0 is disable

44
00:04:34,310 --> 00:04:43,410
1 is enable because we have a b c d e f we change this to 1 and then put F S enabled.

45
00:04:43,440 --> 00:04:46,290
Now we have it by a reform but guess what.

46
00:04:46,290 --> 00:04:53,700
We could in use in hexadecimal forms for our addresses so we have to convert this value to hexadecimal

47
00:04:54,690 --> 00:05:00,440
and what we get is 0 x 0 0 0 0 0 2 0.

48
00:05:00,540 --> 00:05:04,130
Now you might be wondering where did it to come from.

49
00:05:04,380 --> 00:05:11,130
Remember we said h h hexadecimal no cases for binary numbers.

50
00:05:11,130 --> 00:05:15,390
That is a decimal digit uses for binary digits.

51
00:05:15,800 --> 00:05:26,690
Yes so if we take a look at the binary numbers 0 0 1 0 it translates to a hexadecimal number two.

52
00:05:26,700 --> 00:05:29,040
That is how come we have this here.

53
00:05:29,160 --> 00:05:34,190
Now let's take a look at how the R operator is used to enable pot.

54
00:05:34,260 --> 00:05:37,230
F this is the code from your vision.

55
00:05:37,340 --> 00:05:41,860
All I see row are serial numbers serial x 2 0.

56
00:05:42,030 --> 00:05:49,460
And what this means is that resets the value because resets value all 0 x to zero.

57
00:05:49,470 --> 00:05:56,460
Remember we used index address and to put their reset the value of the RC GC GPI or register into our

58
00:05:56,460 --> 00:05:57,420
0.

59
00:05:57,450 --> 00:06:04,740
So now our 0 contains the reset value which is 0 6 0 0 0 8 0.

60
00:06:04,770 --> 00:06:14,250
After the X basically another thing is 0 x 0 0 0 0 2 0 is equal to zero x 2 0.

61
00:06:14,250 --> 00:06:21,960
You can always remove the zeros preceding or in front of other integers as long as there is no other

62
00:06:22,020 --> 00:06:23,940
integer after the 0.

63
00:06:24,360 --> 00:06:34,810
So now let us perform the operation first let's convert put the reset value and 0 x 2 0 into buying

64
00:06:34,810 --> 00:06:35,490
a reform.

65
00:06:35,790 --> 00:06:45,420
And this what we get for the Reset value we get 32 zeros and we have this for these 0 x 2 0 0 zeros

66
00:06:45,510 --> 00:06:47,510
except bits 5 which is 1.

67
00:06:47,520 --> 00:06:50,550
This is the binary form of 0 x 2 0.

68
00:06:50,700 --> 00:06:56,350
So as you can guess when we perform operation error within is still 0.

69
00:06:56,400 --> 00:07:06,810
Except that same bits 5 cores input 1 or input to one of them has to be high for the output to be high.

70
00:07:06,810 --> 00:07:16,140
So if you have input 1 0 here and input 2 1 here then the output is 1 and when we convert this back

71
00:07:16,560 --> 00:07:21,160
to hexadecimal we come up with serial x 2 0.

72
00:07:21,180 --> 00:07:28,860
Now I know you might be asking yourself why couldn't we just load the numbers zero x to zero into the

73
00:07:29,200 --> 00:07:31,830
RC GC GPI or register.

74
00:07:31,830 --> 00:07:39,550
The thing is if we load asset value directly into a register we risk tampering with other bits.

75
00:07:39,570 --> 00:07:47,430
The reason why the outputs here is the same as the second input 0 x 2 0 is because the first set of

76
00:07:47,520 --> 00:07:49,440
inputs were 0 0.

77
00:07:49,470 --> 00:07:57,330
We were lucky enough to get 0 for this first set of inputs but we want to be lucky all the time using

78
00:07:57,330 --> 00:07:59,520
the or operation a show star.

79
00:07:59,550 --> 00:08:02,920
We change only the bit we want to change.

80
00:08:03,060 --> 00:08:07,710
So now let's take a look at how to access the RCC GP.

81
00:08:07,720 --> 00:08:15,060
I go register and rename it to the system control our CTC GP or register.

82
00:08:15,080 --> 00:08:23,460
This is the same snapshot from the data sheet but now what we are interested in is up here the base

83
00:08:23,550 --> 00:08:29,770
upgrades and the offset to get the address of the RC GC GP or register.

84
00:08:29,890 --> 00:08:33,990
We will have to at the base and the offset.

85
00:08:34,100 --> 00:08:37,120
Let's copy the base and the offset and bring it down here.

86
00:08:37,120 --> 00:08:41,150
This what we interested in the base and the offset mis copied down here.

87
00:08:41,560 --> 00:08:43,410
This the value of the base.

88
00:08:43,600 --> 00:08:48,540
It's written broadly here and the value of the offset offset sorry.

89
00:08:48,640 --> 00:08:49,610
What we are them.

90
00:08:49,630 --> 00:08:50,790
We get this number.

91
00:08:50,870 --> 00:08:51,460
So.

92
00:08:51,560 --> 00:09:01,720
So the only way to access our GC keep p i o register is through this 32 bit hexadecimal number.

93
00:09:01,750 --> 00:09:10,590
In reality this number here which is the address contains two resets value which is 0 x 0 0 you know

94
00:09:10,660 --> 00:09:12,290
eight zeros after the X.

95
00:09:12,380 --> 00:09:19,780
So because it's going to be quite tedious to always remember addresses and gas 32 bits number form we

96
00:09:19,780 --> 00:09:27,220
can assign a name to the number so that anytime we want to access the address we invoke the name instead

97
00:09:27,310 --> 00:09:33,850
of the number and the way we do this is by using the e q u directive.

98
00:09:33,850 --> 00:09:40,000
Remember we said the e q is used to give a symbolic name to the constant.

99
00:09:40,000 --> 00:09:47,240
This is an excellent example of it would given the symbolic name as white as s.t. l underscore our C

100
00:09:47,430 --> 00:09:55,490
CTP underscore are to the constant 0 x 4 0 0 F E 6 0 8.

101
00:09:55,510 --> 00:10:02,890
The reason why we are given that this long name with underscores and not something a bit more easy to

102
00:10:02,890 --> 00:10:11,440
remember such as the word clock is that this is the symbolic name given to this register in header files

103
00:10:11,440 --> 00:10:19,450
from Texas Instrument and libraries from third party sources in order to maintain consistency.

104
00:10:19,450 --> 00:10:28,020
We must all endeavour to adhere to these sort of names and I have some good news for you.

105
00:10:28,060 --> 00:10:37,270
You don't have to calculate the upgrades and give symbolic names to addresses or even calculate to perform

106
00:10:37,330 --> 00:10:40,540
all operations accurately all the time.

107
00:10:40,540 --> 00:10:44,020
You don't have to go through all this process all the time.

108
00:10:44,020 --> 00:10:50,500
There are risks ahead of file provided by Texas Instruments which has already calculated the addresses

109
00:10:50,740 --> 00:10:55,400
for all the registers we need and given symbolic names to them.

110
00:10:55,630 --> 00:11:00,150
All we have to do is add this file to our project.

111
00:11:00,370 --> 00:11:07,150
As for locating the right bids and then convert in between binary and hexadecimal to be able to perform

112
00:11:07,450 --> 00:11:14,680
logical operations accurately I will teach you something known as the shift operation in the next chapter

113
00:11:15,280 --> 00:11:21,000
and this will make the enabling and disabling of bits much easier.

114
00:11:21,010 --> 00:11:26,980
Remember you don't have to understand everything in this section but if you want to be a cool text and

115
00:11:26,980 --> 00:11:29,900
guru please endeavor to understand it.

116
00:11:29,920 --> 00:11:37,510
Or you can watch this video you can watch this section about three times to make sure you really understand

117
00:11:37,510 --> 00:11:37,640
it.

118
00:11:38,120 --> 00:11:40,800
So we have our symbolic name here.
