1
00:00:00,710 --> 00:00:01,140
Hello.

2
00:00:01,200 --> 00:00:01,710
Welcome back.

3
00:00:01,920 --> 00:00:07,190
So let's develop our you outcry over creates a bit of space over here.

4
00:00:07,230 --> 00:00:11,910
I'm going to start off with our directives area

5
00:00:17,710 --> 00:00:18,860
to you.

6
00:00:20,280 --> 00:00:24,600
And then there's the code area is read only

7
00:00:28,180 --> 00:00:28,870
we aligned

8
00:00:31,680 --> 00:00:33,000
that thumb.

9
00:00:33,580 --> 00:00:34,350
This the entry

10
00:00:38,320 --> 00:00:45,720
we're going to export our main label right.

11
00:00:46,350 --> 00:00:46,770
And

12
00:00:49,670 --> 00:00:59,250
we going to start off over here on a score on a scope made and we're going to branch to fess up routine

13
00:00:59,430 --> 00:01:01,120
as you tune it.

14
00:01:01,500 --> 00:01:02,120
Right.

15
00:01:02,130 --> 00:01:06,060
So we start off by implementing our you turn it

16
00:01:10,630 --> 00:01:13,060
you turn it like this.

17
00:01:14,260 --> 00:01:14,710
OK.

18
00:01:14,800 --> 00:01:17,830
This was rather far away.

19
00:01:18,220 --> 00:01:20,410
We just move this a bit

20
00:01:26,980 --> 00:01:27,970
right.

21
00:01:28,260 --> 00:01:29,530
Okay.

22
00:01:30,070 --> 00:01:32,940
So we going to initialize that you add.

23
00:01:33,180 --> 00:01:35,640
I'm gonna start off by pushing the link register

24
00:01:39,080 --> 00:01:41,930
save the current value of the link register as it is

25
00:01:48,710 --> 00:01:51,390
and then next I'm going to load a.

26
00:01:53,900 --> 00:01:56,180
What you got RCC.

27
00:01:56,210 --> 00:02:00,500
Register and then enable clock access to that you do load

28
00:02:04,360 --> 00:02:05,000
are won

29
00:02:07,580 --> 00:02:10,430
because this control

30
00:02:13,530 --> 00:02:22,970
are a seat to see you at the school are just the name of the register and then or take what is in this

31
00:02:22,970 --> 00:02:25,520
register and put it in our receiver like this

32
00:02:30,160 --> 00:02:32,500
and then perform an operation

33
00:02:37,420 --> 00:02:39,520
with no symbolic name.

34
00:02:39,520 --> 00:02:46,090
You are to enable or is it you are to enable

35
00:02:50,240 --> 00:02:53,870
the once that is done or right the resort report to the register.

36
00:02:58,490 --> 00:02:59,290
Right.

37
00:02:59,340 --> 00:03:09,680
Once we've done this okay once we've done this we can um we can enable the clock access to GPL you put

38
00:03:09,770 --> 00:03:10,070
a

39
00:03:19,990 --> 00:03:21,730
For those of you who are not familiar.

40
00:03:21,970 --> 00:03:23,890
Yeah I'm wondering about this.

41
00:03:23,930 --> 00:03:26,630
I just put a C code here in C language.

42
00:03:26,740 --> 00:03:37,690
This is going to be I think this control using synapses is gonna be a source control you at just control

43
00:03:37,710 --> 00:03:48,350
R C G C you UT and then all you add 0 enable this is what we type in C language to get this in bare

44
00:03:48,350 --> 00:03:50,950
metal and add it to C right.

45
00:03:50,950 --> 00:04:00,090
So the next thing we're going to do is it's going to enable clock access for our GPA you put a.

46
00:04:00,380 --> 00:04:07,650
So I'm gonna in C language is gonna be cis control our C G C GP I O A No.

47
00:04:07,700 --> 00:04:16,080
C G C GPA oh and then it becomes GPA a e n over here would perform an operation for that so I'm gonna

48
00:04:16,090 --> 00:04:28,840
do a load and assembly we do load this control our CTC GPA you go ah we take what is in there and put

49
00:04:28,840 --> 00:04:30,460
it into register our 0

50
00:04:34,610 --> 00:04:46,490
and we perform an operation with with our GPA you a enable and we start a registered back we store the

51
00:04:46,490 --> 00:04:50,780
um the resorts back into the register like this.

52
00:04:50,780 --> 00:04:51,690
Okay.

53
00:04:51,710 --> 00:05:00,040
So this will enable clock access which EPR puts a the next then we Queen to do is we Queen to set a

54
00:05:00,070 --> 00:05:08,950
set or you pays for alternate function but before we do that we can digitally enable are where you are

55
00:05:08,960 --> 00:05:15,920
to PS P is you're in Pier 1 and we're going to digitally enabled them to come over here and

56
00:05:19,390 --> 00:05:31,130
I'm gonna do it see language 0 2 GPL you a digital enable register and I'm simply going to

57
00:05:34,070 --> 00:05:43,720
0 to sort of write this This will correspond to the bit that uh this corresponds to the bid for GPL

58
00:05:43,720 --> 00:05:55,000
you pin a and uh GPL you open one in GPL you pin zero right to so do this um in an assembly load are

59
00:05:55,120 --> 00:06:07,630
one we have copy I do a d n on this call R and then we take the content put it into our 0 like this

60
00:06:08,740 --> 00:06:20,470
we perform an operation of our 0 and 0 x 0 3 0 3.

61
00:06:20,800 --> 00:06:33,510
Remember this is the same as this or this or this is 0 before the digits doesn't matter right.

62
00:06:33,610 --> 00:06:44,440
So after we do this we write the results back store our as you are 1 like this okay.

63
00:06:44,590 --> 00:06:48,700
So once that is done we can figure that you are we go to the port control register

64
00:06:51,820 --> 00:06:58,900
and then we first cleared a port control field for P E 1 and P issue and then we write new values to

65
00:06:58,900 --> 00:07:00,280
that field.

66
00:07:00,280 --> 00:07:00,840
Okay.

67
00:07:00,910 --> 00:07:01,830
So I'm going to

68
00:07:04,980 --> 00:07:07,660
this let's see.

69
00:07:08,310 --> 00:07:09,400
And see language.

70
00:07:09,540 --> 00:07:13,620
We do it GPL U A P C T RL.

71
00:07:13,710 --> 00:07:21,440
This the port control register P.S. Well it is and then what we're going to do to clear a bit.

72
00:07:21,450 --> 00:07:22,410
We do.

73
00:07:23,310 --> 00:07:26,300
Um no sound because.

74
00:07:26,350 --> 00:07:34,080
And then to Tuesday over here and then we're going to use this hexadecimal number to clear the bit for

75
00:07:36,750 --> 00:07:45,590
for what you call it for P is you and Pier 1 right.

76
00:07:50,880 --> 00:08:01,490
Okay so I'm going to going to implement this and once we've cleared a bit we would need to sort of we'll

77
00:08:01,500 --> 00:08:06,860
need to we need to write new bits to it.

78
00:08:07,300 --> 00:08:13,830
We need to configure the P issue to p a one as you at in the port control register.

79
00:08:15,190 --> 00:08:31,810
So I'm going to load the register lowered our 1 e course GPA to a P C T L on the score register and

80
00:08:31,810 --> 00:08:35,680
then we're gonna take its content and put it into our 0

81
00:08:39,350 --> 00:08:49,690
and then we going to clear a bit using a b c instruction then we started resort back into our 0 we cleared

82
00:08:49,690 --> 00:08:51,460
a bit of what is in our 0

83
00:08:55,740 --> 00:09:01,490
cleared these using this hexadecimal number and then the resources put back into our issue we could

84
00:09:01,490 --> 00:09:05,910
use to appearance here if we want but I'm using our shoe.

85
00:09:05,950 --> 00:09:08,600
If I use just this is the same as this.

86
00:09:08,720 --> 00:09:15,410
So you need not worry so once that is done we're going to configure this uh the same bits we'll use

87
00:09:15,490 --> 00:09:19,090
and the results after clearing it's going to be put here.

88
00:09:19,190 --> 00:09:26,630
It's gonna point to our series so I'll see Iris you and and then I'm gonna configure

89
00:09:29,860 --> 00:09:35,530
P is your MP you want us you ut is the same I've seen Iris you Iris through the third opera and it's

90
00:09:35,680 --> 00:09:42,310
the destination in the case where you don't audit fed or print the second or print becomes the second

91
00:09:42,370 --> 00:09:45,320
or print as well as the destination.

92
00:09:45,490 --> 00:09:46,090
Right.

93
00:09:46,120 --> 00:09:56,860
So this this would do this for us did we deal with the alternate function register we've not dealt with

94
00:09:56,860 --> 00:10:02,590
that so I'm going to enable the alternate function register

95
00:10:06,570 --> 00:10:16,840
I'm gonna put that up here I'll see GPL you a alternate function select the what we want to do over

96
00:10:16,840 --> 00:10:27,250
here is set s p a zero and p a 1 to the ordinary functions so pass this here like this to do this in

97
00:10:27,250 --> 00:10:41,110
assembly 0 to load R 1 GPL you a lot and a function select register take the content and put it into

98
00:10:41,170 --> 00:10:41,890
Iris 0

99
00:10:45,840 --> 00:10:50,340
and then perform an operation

100
00:10:55,650 --> 00:10:59,390
with this and then store it back

101
00:11:02,980 --> 00:11:05,850
like this okay.

102
00:11:06,340 --> 00:11:06,750
Right.

103
00:11:06,760 --> 00:11:12,780
So once we're done with it we can start configuring the new art to configure the U.

104
00:11:12,790 --> 00:11:22,670
We start off by disabling it so we simply going to disable to you at we can just write to zero today

105
00:11:22,670 --> 00:11:26,460
you control register sort of everything in the register set to zero.

106
00:11:26,600 --> 00:11:33,620
We can just set a particular bit to enable disable it in the register to zero if we want to set a particular

107
00:11:33,680 --> 00:11:46,070
bits to zero we have to use the M B C instruction so let's do the start off by doing load our one with

108
00:11:46,070 --> 00:11:57,380
a you add control register you at zero c t o on the score R and then we're gonna take the content of

109
00:11:57,380 --> 00:12:06,920
the register and put it into our 0 and then we're gonna clear it by doing b c store the result in our

110
00:12:06,920 --> 00:12:17,400
zero take our 0 and then apply you to control enable which we've created a symbolic name for this one

111
00:12:17,400 --> 00:12:17,970
over here.

112
00:12:24,480 --> 00:12:25,040
Right.

113
00:12:25,090 --> 00:12:27,450
And then we store the results.

114
00:12:32,860 --> 00:12:35,030
Our 0 1 like this

115
00:12:38,010 --> 00:12:38,530
next.

116
00:12:38,600 --> 00:12:45,710
We configured the bot rate we're going to access the 2 bulk rate to registers the 1 for the integer

117
00:12:45,710 --> 00:12:47,810
part and the fractional part.

118
00:12:48,080 --> 00:12:52,700
So I'm gonna say load our 1

119
00:12:55,830 --> 00:13:02,980
portray to register in the name we gave it was it should be up here somewhere.

120
00:13:03,010 --> 00:13:03,760
Let's get a name

121
00:13:07,180 --> 00:13:14,860
there's the first one you at I P R T R This is the integer portraits register

122
00:13:18,070 --> 00:13:29,740
we load this first and then and then um and then we compute the bulk rate so to to the broke rate we

123
00:13:29,740 --> 00:13:38,750
have to divide our clock frequency by 16 multiplied by the board rate we want to use remember popular

124
00:13:38,780 --> 00:13:41,380
but rates that we often use include

125
00:13:46,040 --> 00:13:53,520
popular board rates include nine thousand six hundred one one five two hundred etc..

126
00:13:53,810 --> 00:14:02,960
So to compute the value to put into the box rate in which I register the formula is to take our clock

127
00:14:02,960 --> 00:14:11,900
frequency the frequency of my MCU is sixteen figureheads mean 16 million or take this 16 million and

128
00:14:11,900 --> 00:14:18,740
then I would divide by sixteen multiplied by the portrait I want to use let's say I want a board rate

129
00:14:18,740 --> 00:14:27,650
of one thousand and fifteen one thousand fifteen and two hundred sorry one hundred and fifteen thousand

130
00:14:27,650 --> 00:14:34,490
two hundred let's say I want to board rate of one hundred fifteen thousand two hundred I'm going to

131
00:14:34,490 --> 00:14:42,800
compute this I'm going to do sixteen million divided by sixteen times one hundred and fifteen two hundred

132
00:14:42,830 --> 00:14:49,170
if I want this out put this here if I want a portrait of nine thousand six hundred multiply this system

133
00:14:49,190 --> 00:14:51,090
by this if my frequency is different.

134
00:14:51,090 --> 00:14:56,390
Leslie I'm running at fifty megaHertz I'll have to change the sixteen to fifty two how fifty million.

135
00:14:56,600 --> 00:14:59,980
But I'm run the sixteen megahertz This is a constant.

136
00:15:00,110 --> 00:15:04,560
So these are the two variables right.

137
00:15:05,030 --> 00:15:16,750
And when I compute this one you perform this calculation you get eight point six eight 0.

138
00:15:17,750 --> 00:15:19,410
So this is going to be the answer.

139
00:15:19,490 --> 00:15:21,790
This is the integer the integer between is 8.

140
00:15:21,800 --> 00:15:27,020
So we've got to take this 8 and put it into the integer both to register.

141
00:15:27,020 --> 00:15:27,440
Right.

142
00:15:28,580 --> 00:15:38,120
So what I'm going to do is move this to the to the register so I'm going to do I'm simply going to use

143
00:15:38,120 --> 00:15:54,610
the M the move instruction to achieve this oh do move move are zero the number eight and then I'll star

144
00:15:54,610 --> 00:16:02,310
it into the integer portraits register by doing so what is an ask you are 1 like this.

145
00:16:02,360 --> 00:16:08,000
Okay so now we've sorted out we've put just this eight How about a fraction politics it's not complete

146
00:16:08,480 --> 00:16:15,410
we're going to store a fraction part in the fraction register so I'm going to load that

147
00:16:18,570 --> 00:16:23,240
I'm going to do load R one equals

148
00:16:26,210 --> 00:16:34,070
you 0 F R D fraction board rate is F B T.

149
00:16:34,320 --> 00:16:45,320
Yeah on a school R and to compare it to the fraction part we'll use a different formula we take the

150
00:16:45,320 --> 00:16:52,790
French we take the this part here plus fractional number we multiply by sixty four and then zero point

151
00:16:52,790 --> 00:16:53,540
five.

152
00:16:53,690 --> 00:16:57,320
So we took what is left here that is gonna be

153
00:17:07,490 --> 00:17:16,410
this is going to be zero point six it's u of five multiplied by sixty four multiplied by zero point

154
00:17:16,410 --> 00:17:25,380
five and the answer we'll get to be forty four point zero five two.

155
00:17:25,710 --> 00:17:32,160
So this time we just take this as well we don't care about this last bit is fine so we're going to move

156
00:17:32,250 --> 00:17:34,770
forty four into register our zero

157
00:17:42,500 --> 00:17:43,990
and then we're going to store it.

158
00:17:55,340 --> 00:17:55,750
Right.

159
00:17:56,400 --> 00:18:02,290
So once this is done we have to set our um our wetlands.

160
00:18:02,300 --> 00:18:03,070
They pay to land.

161
00:18:03,070 --> 00:18:07,060
We want to use and we do it is by access the line control register.

162
00:18:07,990 --> 00:18:13,760
So I do know these are our one.

163
00:18:14,340 --> 00:18:26,790
I want a course you zero LC RH on a score are for register and then I'm going to do Delta.

164
00:18:26,810 --> 00:18:35,860
Ah I wish you would take the content and put into our receiver like this and then once we have that

165
00:18:37,930 --> 00:18:42,310
we're going to we're going to disable.

166
00:18:42,520 --> 00:18:45,040
We're going to clear all fields.

167
00:18:45,490 --> 00:18:53,410
Now we can do B C over here b c are as you are as you f f

168
00:18:56,610 --> 00:19:02,990
and once we've done that now we can set the with as well as enable.

169
00:19:03,000 --> 00:19:05,700
So I'm going to do at our zero end.

170
00:19:05,760 --> 00:19:11,110
Are you sorry and our zero hours zero

171
00:19:14,320 --> 00:19:20,590
and I'm going to get the symbolic name we've created here.

172
00:19:21,150 --> 00:19:21,810
I'll get this

173
00:19:25,740 --> 00:19:28,210
and then I'll include FIFO and naval as well.

174
00:19:28,400 --> 00:19:30,110
I'll get Fi for a.

175
00:19:30,570 --> 00:19:33,480
This one here.

176
00:19:33,480 --> 00:19:36,930
Bring it over here like this.

177
00:19:36,950 --> 00:19:43,470
Once that is done we can still use the stone instruction as the are r zero

178
00:19:47,520 --> 00:19:48,290
R 1.

179
00:19:49,780 --> 00:19:50,650
Okay.

180
00:19:50,650 --> 00:19:58,500
So finally all we have to do is enable it to you at because we disabled it when we start it.

181
00:19:58,750 --> 00:20:00,760
So we accessed the control register.

182
00:20:01,000 --> 00:20:10,460
Oh these are our one you at zero CTA L on the score.

183
00:20:12,400 --> 00:20:15,530
And then we move the content into register.

184
00:20:15,550 --> 00:20:17,320
Iris you were like this.

185
00:20:24,870 --> 00:20:26,110
And then with the form 1.

186
00:20:26,150 --> 00:20:26,940
Operation

187
00:20:30,130 --> 00:20:41,010
we created a symbolic name called U UT c t o u s e n.

188
00:20:41,670 --> 00:20:42,300
Right.

189
00:20:42,330 --> 00:20:45,570
And then we can store our 0

190
00:20:49,460 --> 00:20:49,920
r 1.

191
00:20:50,370 --> 00:20:50,740
OK.

192
00:20:50,750 --> 00:20:57,580
So because we pushed the link register when we started we've got a pop it gonna pop.

193
00:21:00,410 --> 00:21:01,350
LA um.

194
00:21:01,370 --> 00:21:01,750
Got it.

195
00:21:02,790 --> 00:21:03,660
I'm going to

196
00:21:08,860 --> 00:21:11,030
I'm gonna pop the LR here.

197
00:21:11,380 --> 00:21:12,740
Let's see.

198
00:21:12,880 --> 00:21:13,080
Yeah.

199
00:21:19,830 --> 00:21:22,950
Okay so this is going to be uh.

200
00:21:24,210 --> 00:21:27,500
There's gonna be a uh you out initialization subroutine.

201
00:21:28,200 --> 00:21:36,730
So the next thing we've got to do is create other subroutines for um for reading and write and data.

202
00:21:36,780 --> 00:21:37,210
Okay.

203
00:21:37,230 --> 00:21:38,940
So let's do that in the next lesson.
