1
00:00:00,660 --> 00:00:01,690
Hello, welcome back.

2
00:00:01,830 --> 00:00:04,270
In this lesson, we go into crisis.

3
00:00:04,440 --> 00:00:13,080
We're going to create a simple you out driver to help us to be able to send information from our microcontroller

4
00:00:13,080 --> 00:00:20,280
to our computer so that we can view the properties of our neural network as we develop it.

5
00:00:20,920 --> 00:00:25,170
So I'm going to create a new project by coming to project new project.

6
00:00:27,210 --> 00:00:30,840
And I have a folder here I'm going to call this.

7
00:00:33,680 --> 00:00:36,150
I call this simple, you watch.

8
00:00:39,510 --> 00:00:47,010
And my board, my and my board is the SDM fetch to EFORE won one seat.

9
00:00:48,090 --> 00:00:49,830
I have the new clipboard of this.

10
00:00:49,950 --> 00:00:55,860
I'll click OK over here and the Simms's also like to call on the device.

11
00:00:55,860 --> 00:00:56,910
Isolette, start up.

12
00:00:57,090 --> 00:01:00,300
I'll say OK here and target here.

13
00:01:00,300 --> 00:01:04,110
I'm going to give the name of my board SDM 32 F4.

14
00:01:06,070 --> 00:01:10,930
I'll drop down here, so this group here, I'm going to call this Eppy.

15
00:01:13,550 --> 00:01:21,170
Right, and I'm going to create two files or you [REMOVED] three files here at item iSelect, see, I call

16
00:01:21,170 --> 00:01:23,890
this mean this is going to be our main file.

17
00:01:24,260 --> 00:01:25,370
Oh, I don't know the file.

18
00:01:25,520 --> 00:01:25,910
Right.

19
00:01:25,910 --> 00:01:27,740
Click right.

20
00:01:27,740 --> 00:01:32,300
Click on up over here at item C again.

21
00:01:32,300 --> 00:01:41,690
I'm going to call this you out and then I'm going to add the interface file, which is the far right

22
00:01:41,690 --> 00:01:45,770
click add item over here.

23
00:01:45,960 --> 00:01:49,100
I call it you got like this.

24
00:01:50,990 --> 00:01:55,620
Why do we have this memory for you, interest in Iraq?

25
00:01:58,440 --> 00:02:03,920
Right, so, um, we would have to create the other driver, a very simple one.

26
00:02:04,020 --> 00:02:13,100
Those of you who have seen other causes of mine, like the the bare metal programming courses for developing

27
00:02:13,100 --> 00:02:18,770
drivers, you already know how to do this before the rest of you who are new to my courses.

28
00:02:19,040 --> 00:02:22,350
I'm going to take you through the steps of initialise in the.

29
00:02:24,260 --> 00:02:24,920
So the U.

30
00:02:24,920 --> 00:02:33,590
R stands for Universal Asynchronous Receiver transmitter and we can use it to transfer messages or data

31
00:02:33,770 --> 00:02:38,630
between two devices and the two devices can be a microcontroller and a computer.

32
00:02:39,380 --> 00:02:46,100
So in order to find out how to initialize any petrol at all of the microcontroller, we need to visit

33
00:02:46,100 --> 00:02:49,720
the datasheet or the reference manual of the microcontroller.

34
00:02:50,000 --> 00:02:56,720
And if you are using cardioversion, you can find it over here on the books or just come over here books

35
00:02:57,800 --> 00:03:03,560
and I'll select the the reference manual by double click.

36
00:03:03,560 --> 00:03:04,130
And this.

37
00:03:08,000 --> 00:03:12,680
And there's the reference manual of the microcontroller, and what I'm looking for is the block diagram

38
00:03:12,680 --> 00:03:16,610
showing me the Depass connection of my microcontroller.

39
00:03:20,500 --> 00:03:21,140
Let's see.

40
00:03:21,250 --> 00:03:27,300
OK, we find a block diagram in the data sheet so we can come back here and double click on datasheet

41
00:03:27,880 --> 00:03:29,430
and this is datasheet.

42
00:03:30,220 --> 00:03:31,900
OK, so this is what we're looking for.

43
00:03:32,920 --> 00:03:38,840
And we're looking for this because we want to know how to initialize the clock to the Ewart's module.

44
00:03:39,580 --> 00:03:51,040
So in the in the past, I'll see in about 20 years ago, microcontrollers had block access enabled on

45
00:03:51,040 --> 00:03:54,400
all peripherals by default and by all peripherals.

46
00:03:54,400 --> 00:04:04,450
I mean the pedobear module that you are module the let's say ATC all had clock access enabled by default.

47
00:04:04,900 --> 00:04:10,570
And if we have block access enabled by default, it makes the microcontroller consume more power.

48
00:04:11,020 --> 00:04:17,950
So although we might not be using a particular Peiffer or module because clock is enabled to the module,

49
00:04:18,430 --> 00:04:26,040
some power is consumed because of this, something known as the clock gating mechanism was invented.

50
00:04:26,470 --> 00:04:35,200
And what a clock counting mechanism does is that it allows us to just shut the clock off for every peripheral

51
00:04:35,680 --> 00:04:42,610
and we enable clock access only to the peripherals that we want to use only to the peripherals that

52
00:04:42,610 --> 00:04:43,150
we need.

53
00:04:43,600 --> 00:04:48,590
So in this case, the only peripheral we need is the peripheral or the other module.

54
00:04:49,090 --> 00:04:51,940
So we going to enable clock access to the UAT.

55
00:04:52,390 --> 00:04:56,230
So we have to find the bus that it is connected to.

56
00:04:56,920 --> 00:05:00,190
So I'm over here in this block diagram and I'm going to zoom in a bit.

57
00:05:05,080 --> 00:05:13,330
Right, so let's see, so GPI is connected to this bus, you can use this area to see GPS is connected

58
00:05:13,330 --> 00:05:16,290
to AHP one bus, right.

59
00:05:16,510 --> 00:05:18,400
And you'll be connected here.

60
00:05:18,400 --> 00:05:23,630
So if we want to enable the port, we would have to enable them through this bus.

61
00:05:24,160 --> 00:05:30,260
So what we're looking for is you are we going to use you at two as you can see it over here?

62
00:05:30,280 --> 00:05:41,050
It's called you sat here because we can use this module known as use that for both Synchronoss and asynchronous,

63
00:05:41,650 --> 00:05:44,170
uh, receiver transmitter transfer.

64
00:05:44,470 --> 00:05:50,130
So Usategui stands for Universal Synchronoss, asynchronous receiver transmitter.

65
00:05:50,470 --> 00:05:52,150
But we are looking for just that.

66
00:05:52,150 --> 00:05:58,480
You add without the S and it's the same in the same module can be configured for both Synchronoss and

67
00:05:58,480 --> 00:05:59,170
asynchronous.

68
00:05:59,170 --> 00:06:00,020
So you need not worry.

69
00:06:00,370 --> 00:06:01,510
So that's what we're looking for.

70
00:06:02,570 --> 00:06:11,220
And as we can see over here, it is connected to the APB, one bus app, one bus.

71
00:06:11,680 --> 00:06:12,090
Right.

72
00:06:12,100 --> 00:06:15,040
So we need to enable clock access to app one.

73
00:06:16,270 --> 00:06:21,730
We need to go through the app one register set and then enable use that clock.

74
00:06:22,040 --> 00:06:22,690
That is one.

75
00:06:23,140 --> 00:06:28,840
One other thing is our you start or you add is connected to a standard Jhpiego pin.

76
00:06:29,770 --> 00:06:31,870
And this also requires explanation.

77
00:06:32,740 --> 00:06:39,370
So for those of you who are new to microcontrollers, often we have copies.

78
00:06:40,000 --> 00:06:45,130
Those are the to see the basic peripherals that you need.

79
00:06:46,180 --> 00:06:50,020
The Galopin allows for input and output.

80
00:06:50,020 --> 00:06:55,050
In fact, the word GPA stands for general purpose input output.

81
00:06:56,080 --> 00:06:56,540
Right.

82
00:06:56,560 --> 00:07:03,340
We have copies and S.P.I opens and Spyro stands for.

83
00:07:06,410 --> 00:07:08,850
Special purpose, input output.

84
00:07:09,530 --> 00:07:17,780
So we've got general-purpose input output and special purpose input output, the GPU, PIN and spin

85
00:07:19,640 --> 00:07:21,450
are physically the same.

86
00:07:22,430 --> 00:07:29,480
And what I mean by this is that we would have to configure through software to decide whether a particular

87
00:07:29,480 --> 00:07:35,210
PIN should act as a standard GPU, which is.

88
00:07:35,450 --> 00:07:41,630
Yeah, general purpose, input output, or we want it to be SPU special purpose, input output.

89
00:07:42,680 --> 00:07:50,810
So for instance, if you want to configure an ADC module, you would have to select the pin that your

90
00:07:50,810 --> 00:07:52,100
sensor is connected to.

91
00:07:52,310 --> 00:07:57,830
You've got to set that up in a special purpose being the special purpose setting.

92
00:07:57,830 --> 00:08:01,110
We often call this as alternate function mode.

93
00:08:01,760 --> 00:08:07,160
So if you check the datasheet or the reference manual of any microcontroller, you would see that there's

94
00:08:07,160 --> 00:08:11,470
a part that talks about how to configure the pin as an alternate function pin.

95
00:08:11,480 --> 00:08:14,050
This means configuring it for special purpose.

96
00:08:14,570 --> 00:08:23,600
So our you at our receiver line and transmitter line are internally connected to some Gilpin's and we've

97
00:08:23,600 --> 00:08:27,260
got to configure these KPIs for special purpose.

98
00:08:28,250 --> 00:08:33,020
And these are the P, A two and a three.

99
00:08:33,440 --> 00:08:37,910
So put it over here, put a pin to import a PIN three.

100
00:08:38,480 --> 00:08:40,340
We would need to configure them as well.

101
00:08:40,350 --> 00:08:47,030
And like I said, those of you who are already familiar with working with a UAT and initialize in peripherals,

102
00:08:47,030 --> 00:08:48,800
you probably know all of this already.

103
00:08:48,800 --> 00:08:54,970
So you can skip this lesson if you want and just download the resources and continue from there.

104
00:08:56,960 --> 00:08:57,150
So.

105
00:08:57,240 --> 00:08:57,650
Right.

106
00:08:58,100 --> 00:09:06,770
We would need to we need to configure Jhpiego A because our our experience connected to a three and

107
00:09:06,770 --> 00:09:09,200
then our T experience connected to you.

108
00:09:09,650 --> 00:09:12,040
And we need to configure you Satya as well.

109
00:09:12,530 --> 00:09:16,880
And this is because you said it's a special purpose function, so.

110
00:09:17,000 --> 00:09:17,390
Yeah.

111
00:09:18,230 --> 00:09:21,170
So that's some of the information we need.

112
00:09:21,170 --> 00:09:29,180
We can get started with this, going to minimize this and we can start off in a way where we can start

113
00:09:29,180 --> 00:09:30,680
off over here in our use of.

114
00:09:36,490 --> 00:09:41,370
I don't know why I have this, we can start off in the USA Today HFA.

115
00:09:49,920 --> 00:09:52,770
And I can start off by saying, if not defined, defined.

116
00:10:05,140 --> 00:10:08,230
I've always called you out on a school age.

117
00:10:21,530 --> 00:10:24,410
And then we end if here like this and if.

118
00:10:29,480 --> 00:10:37,700
Right, and we we're going to have a number of functions, we going to create a function to initialize

119
00:10:37,700 --> 00:10:39,150
the user to module.

120
00:10:39,170 --> 00:10:46,280
So I'm just going to say void use to underscore in it over here like this.

121
00:10:53,890 --> 00:11:03,760
And this void, void function, and we're going to have another function to help us, actually, we're

122
00:11:03,760 --> 00:11:05,410
not going to expose the other functions.

123
00:11:05,410 --> 00:11:11,770
We're going to have just this function and we're going to use print F from the C standard library to

124
00:11:11,770 --> 00:11:15,010
send our information to.

125
00:11:15,010 --> 00:11:15,880
Let's keep just this.

126
00:11:15,880 --> 00:11:19,900
We can go to the USOC file and include the rage.

127
00:11:25,410 --> 00:11:32,190
Right, so we can include our interface file here in our Dossey file or just say, include

128
00:11:35,040 --> 00:11:38,610
you out today like this.

129
00:11:43,330 --> 00:11:50,110
So once that is done, we can implement this function that we have written the head for

130
00:11:52,780 --> 00:12:01,480
open and close, we said we've got to enable clock for you at.

131
00:12:05,310 --> 00:12:12,450
And it is connected from our reference manual, we said it's connected to APB, one bus, so we need

132
00:12:12,450 --> 00:12:17,280
to go to the datasheet and see what an APB one.

133
00:12:17,280 --> 00:12:18,360
Can we locate our.

134
00:12:18,360 --> 00:12:19,150
You ought to.

135
00:12:21,000 --> 00:12:22,290
So I'm going to go back.

136
00:12:22,290 --> 00:12:24,210
I kept the files here.

137
00:12:25,950 --> 00:12:32,490
I'm going to go back to our reference, my no document and I'm going to search APB one.

138
00:12:40,460 --> 00:12:52,520
Can press control F and then you can simply type one, APB one, and we're looking for the APB one and

139
00:12:52,520 --> 00:12:53,450
they will register.

140
00:12:56,530 --> 00:13:03,130
So I'll click this and let's see, we have our RACC, HP.

141
00:13:12,250 --> 00:13:18,430
Let's see, so for those of you who already know how to do this, like I said, you can skip this.

142
00:13:18,440 --> 00:13:24,910
But for those of you who want to see how such a driver can be initialised, you can just stick with

143
00:13:24,910 --> 00:13:25,480
me here.

144
00:13:26,380 --> 00:13:28,330
So this is the app one here.

145
00:13:29,410 --> 00:13:33,060
And we are dealing with the app One Enabler Register.

146
00:13:33,760 --> 00:13:36,980
And as you can see, this is a 32 bit register.

147
00:13:37,000 --> 00:13:38,080
It starts from zero.

148
00:13:38,080 --> 00:13:42,730
It ends up 31 and bits zero belongs to time.

149
00:13:42,730 --> 00:13:43,390
A two bit.

150
00:13:43,390 --> 00:13:48,310
One belongs to time, a three bits two blocks to time before and so on and so forth.

151
00:13:49,150 --> 00:13:56,260
Um, let's see what we have and you can find this out by actually reading more.

152
00:13:57,070 --> 00:14:02,770
So over here, what it means is if this bit is set to one, then we want to enable time or two.

153
00:14:03,010 --> 00:14:06,190
If it's set to zero, then we want to disable time or two.

154
00:14:06,460 --> 00:14:08,210
And the information is provided here.

155
00:14:08,800 --> 00:14:10,420
So let's see over here.

156
00:14:10,420 --> 00:14:13,750
It says it's given the bit numbers here.

157
00:14:13,750 --> 00:14:15,110
I'm looking for pit number zero.

158
00:14:15,130 --> 00:14:22,140
So it says over here, but number zero, set and cleared by software zero means time to clock disabled.

159
00:14:22,150 --> 00:14:24,070
One means time or two clock enabled.

160
00:14:24,880 --> 00:14:30,760
And our you at two is connected to pit number 17.

161
00:14:31,330 --> 00:14:35,470
As you can see, zero means you start to clock disabled.

162
00:14:35,470 --> 00:14:39,640
One means you start to clock enabled.

163
00:14:39,940 --> 00:14:45,140
So we want to pass the number one at bit seventeen here to this register.

164
00:14:45,550 --> 00:14:49,770
This is what would allow us to enable clock access to our users to.

165
00:14:50,230 --> 00:14:51,580
So that's what we're going to do now.

166
00:14:53,020 --> 00:15:04,330
So come over here and I'll see RACC app one enable register, the one we just saw.

167
00:15:07,910 --> 00:15:16,910
And I'm going to pass hexadecimal code here also is your X two and then four zeros, one, two, three,

168
00:15:16,910 --> 00:15:17,200
four.

169
00:15:17,210 --> 00:15:24,890
And this corresponds to certain bit number bit number 17 to set in each one.

170
00:15:24,890 --> 00:15:28,590
Remember, we start counting from zero, right?

171
00:15:33,130 --> 00:15:38,640
And the reason we have in this is because we've not included the header file for our microcontroller,

172
00:15:38,650 --> 00:15:43,650
so I'll come over here and I'll do right click include ASTM.

173
00:15:43,660 --> 00:15:45,750
That's two for storage.

174
00:15:46,630 --> 00:15:48,430
When I come here, you should disappear.

175
00:15:49,780 --> 00:15:50,200
Right.

176
00:15:51,400 --> 00:15:53,380
And then I'll comment here.

177
00:15:56,760 --> 00:15:58,620
There's also a enable clock.

178
00:16:04,920 --> 00:16:08,900
For you sought to, right?

179
00:16:09,900 --> 00:16:18,870
So once we've done this, we need to enable the clock for port because our T, X and our X lines are

180
00:16:18,870 --> 00:16:22,580
connected to two and three, respectively.

181
00:16:23,130 --> 00:16:25,500
So I'm going to come back to RACC.

182
00:16:26,130 --> 00:16:33,910
And in the block diagram, we realize that port, it was connected to the HP, Busse, HP one back.

183
00:16:33,930 --> 00:16:43,830
So I'm going to see HP, one enabler register and I'm going to I'm going to pass one here, zero x one

184
00:16:44,700 --> 00:16:51,120
like this, because the first bit in the register corresponds to Port A and a better way of doing it

185
00:16:51,120 --> 00:16:52,890
is put in this vertical line here.

186
00:16:53,190 --> 00:16:55,440
And this is what is known as friendly programming.

187
00:16:55,680 --> 00:16:59,780
When we put a vertical line, it only changes the bits that we want to change.

188
00:17:00,060 --> 00:17:07,800
So when we include this only bit 17 is changed and when we include it includes only bits, one is changed,

189
00:17:07,800 --> 00:17:14,010
meaning if the register had a different value, everything else is going to remain the same in the register.

190
00:17:14,040 --> 00:17:20,880
Apart from the bits that we want to change, this is known as friendly programming as opposed to this.

191
00:17:20,880 --> 00:17:26,010
When we do this, meaning we clean everything in the register and we write a new value and this new

192
00:17:26,010 --> 00:17:29,700
value is going to be zero zero zero zero zero zero zero zero zero zero zero one.

193
00:17:30,090 --> 00:17:33,600
It's going to be thirty one zeros and then one.

194
00:17:33,600 --> 00:17:35,380
Yeah, something of that nature.

195
00:17:35,850 --> 00:17:36,330
Right.

196
00:17:36,540 --> 00:17:43,380
But because we want everything else to remain the same, apart from just bits, one, we put this vertical

197
00:17:43,380 --> 00:17:44,610
line here like this.

198
00:17:45,680 --> 00:17:47,930
If you do not understand this, you can send me a message.

199
00:17:48,330 --> 00:17:50,730
So once we've done this, we've got to set GPL.

200
00:17:50,760 --> 00:17:55,920
You put a pin to PIN three as alternate function.

201
00:17:55,920 --> 00:18:02,040
PS and we do this by accessing a register known as the AFAS and you can find this in the data sheet

202
00:18:02,760 --> 00:18:04,200
to run the course quicker.

203
00:18:04,210 --> 00:18:05,820
I'm not going to go back to the data sheet.

204
00:18:05,820 --> 00:18:14,250
I'm just going to bring this here and this over here configures two and three of you 246 and IREX Ordinaire

205
00:18:14,250 --> 00:18:15,060
function seven.

206
00:18:16,080 --> 00:18:18,960
Once we've done this, we've got to set the mood.

207
00:18:19,380 --> 00:18:24,180
We've got to set the mood of the pin to alter the function.

208
00:18:25,140 --> 00:18:34,320
And we do this by accessing the most register and the mode register is written us mode are, as you

209
00:18:34,320 --> 00:18:35,280
can see over here.

210
00:18:36,930 --> 00:18:40,020
So these two lines would configure the mode.

211
00:18:40,740 --> 00:18:47,640
And once that is done, we can start configuring the U.S. We can't forget about rate and then we enable

212
00:18:47,640 --> 00:18:51,360
it and then we will be done with it.

213
00:18:51,510 --> 00:19:00,060
So we start off by accessing the board register and we set about eight to nine thousand six hundred.

214
00:19:00,060 --> 00:19:03,420
And all of that is included in this hexadecimal value here.

215
00:19:03,420 --> 00:19:05,850
We're not going to go through how that is computed.

216
00:19:06,510 --> 00:19:12,600
And once that is done, we're going to enable T, X and our X and set it for eight bits data.

217
00:19:13,620 --> 00:19:17,250
And all of that also is encapsulated in this hexadecimal.

218
00:19:17,280 --> 00:19:20,550
You can simply go to the data sheet and search for this register.

219
00:19:20,550 --> 00:19:27,240
P are the same where we went and search for this and we're able to derive that this is the number we

220
00:19:27,240 --> 00:19:28,080
need to store here.

221
00:19:28,290 --> 00:19:33,150
Everything you see here, if you want to learn more about it, you can go to the data sheet and find

222
00:19:33,420 --> 00:19:34,830
their respective registers.

223
00:19:35,610 --> 00:19:43,530
So this register control register one we set in about an hour and eight put data in it.

224
00:19:43,530 --> 00:19:49,260
And once that's done, we're going to go to control register two and set one.

225
00:19:49,260 --> 00:19:54,360
Stop it by just keeping it in its default state, which is zero zero.

226
00:19:54,370 --> 00:19:56,100
Researcher Was this down?

227
00:19:56,100 --> 00:20:03,000
We go to a controlled register three and say we want no flow control by also keeping it in its default

228
00:20:03,000 --> 00:20:03,420
state.

229
00:20:03,660 --> 00:20:08,880
So we could have actually skipped this, but it's better programming to set it.

230
00:20:08,880 --> 00:20:10,590
Even if the default state is zero.

231
00:20:10,590 --> 00:20:16,440
It's it's good to sort of explicitly state set it back to zero zero zero.

232
00:20:17,010 --> 00:20:23,520
Once we've done all of this, we can enable the the USA module by going back to control register one

233
00:20:23,640 --> 00:20:24,210
like this.

234
00:20:25,860 --> 00:20:26,340
Right.

235
00:20:27,000 --> 00:20:33,100
So once we've done this, we can write a function to help us write a character to the user.

236
00:20:33,540 --> 00:20:34,890
So I'm going to come over here.

237
00:20:36,380 --> 00:20:37,800
I'm going to say int.

238
00:20:42,080 --> 00:20:49,630
You said, too, and then you say, right, and then this function is going to take.

239
00:20:51,930 --> 00:20:55,830
And S.H. as a parameter, and this is going to be what we want to send.

240
00:20:57,670 --> 00:21:03,520
And what we have to do is we have to wait for the transfer buffer to be empty before we can send it,

241
00:21:04,210 --> 00:21:07,020
and we do this by using a while loop.

242
00:21:07,030 --> 00:21:10,870
So we say, well, not.

243
00:21:13,650 --> 00:21:24,750
Used to over here like this and we go to status status register, which is Asare, and then we do end

244
00:21:25,110 --> 00:21:35,270
through X zero zero eight zero while this wait for the transfer buffa to be empty, wants to transfer

245
00:21:35,280 --> 00:21:42,020
barflies empty, then we can send what is currently in the D.R., which is the data register by saying

246
00:21:42,030 --> 00:21:43,140
use it to.

247
00:21:46,090 --> 00:21:48,160
D-R equals

248
00:21:51,760 --> 00:21:55,360
S.H. and zero X.

249
00:21:58,840 --> 00:22:02,180
Like this, right?

250
00:22:02,680 --> 00:22:06,340
OK, so we can, in fact, return S.H. here

251
00:22:09,520 --> 00:22:10,900
just to indicate success.

252
00:22:12,850 --> 00:22:19,210
Once that's done, we can have another function here to help us read what is in the queue at the end

253
00:22:21,520 --> 00:22:24,040
user to underscore read.

254
00:22:27,640 --> 00:22:29,230
And this takes no argument.

255
00:22:32,940 --> 00:22:38,430
And we we want to read what is in the want to read what is in the data register.

256
00:22:38,460 --> 00:22:42,080
But before we do that, we have to make sure there is something in this.

257
00:22:42,100 --> 00:22:47,550
We have to wait until the character arrives and we can use a similar while loop.

258
00:22:47,910 --> 00:22:50,160
I'll copy this while loop, bring it over here.

259
00:22:50,790 --> 00:22:59,610
This time I'm going to pass excerpts or two over here and then we're simply going to return what we

260
00:22:59,610 --> 00:23:09,800
get from the data register by saying return user to D-R like this.

261
00:23:11,310 --> 00:23:11,660
Right.

262
00:23:12,630 --> 00:23:13,890
So they should help us.

263
00:23:15,600 --> 00:23:18,330
Yeah, they should help us read and write.

264
00:23:18,730 --> 00:23:25,500
The next thing we're going to do is we're going to interface the the C library.

265
00:23:25,650 --> 00:23:27,660
I'm going to add DTD.

266
00:23:27,690 --> 00:23:36,990
I ordered H I'll come to our USA dot h file and I'm going to include SDD over here so that we can use

267
00:23:36,990 --> 00:23:37,560
print F.

268
00:23:42,430 --> 00:23:50,770
Standard input output like this, and I'm going to bring a piece of a piece of code that would help

269
00:23:50,770 --> 00:24:01,240
us, that would help us to interface to the standard CIA library, and we're not going to get into this.

270
00:24:02,560 --> 00:24:09,940
So this over here would help us to interface to the library and other function is going to be called

271
00:24:09,940 --> 00:24:11,020
by the sea library.

272
00:24:17,070 --> 00:24:18,390
This last one here.

273
00:24:27,110 --> 00:24:27,470
Right.

274
00:24:27,650 --> 00:24:35,990
So by including this bit here, we should be able to use our normal print F and scanned scan functions

275
00:24:35,990 --> 00:24:37,430
that we use in C language.

276
00:24:37,760 --> 00:24:40,100
And like I said, I'm not going to get into the details of this.

277
00:24:40,640 --> 00:24:46,010
We've already diverted too much from deep lowness, little deep learning as it is.

278
00:24:47,000 --> 00:24:47,900
Um, yeah.

279
00:24:49,760 --> 00:24:52,540
So we can put a bit of test code here.

280
00:24:52,550 --> 00:24:59,900
I'm going to come down here and put a bit of test code that would allow us to test what our what you

281
00:24:59,900 --> 00:25:02,130
what configuration is work.

282
00:25:02,150 --> 00:25:09,560
And we're going to come over here and see FOID test set up.

283
00:25:13,890 --> 00:25:24,510
Open and close, and we can simply see Pranav, as you can see, if in print is appearing now, so we

284
00:25:24,510 --> 00:25:29,460
say, please, perhaps enter a number.

285
00:25:36,350 --> 00:25:41,870
And we come over here and we can use Cunniff to grab the number.

286
00:25:46,520 --> 00:25:52,760
Percentage day, and I'm going to create a variable to hold it.

287
00:25:56,710 --> 00:26:05,110
We've got to come come up here and have intend to hold it, and I'm going to create another buffer here,

288
00:26:05,110 --> 00:26:09,670
which I'll simply call SDR a size 80 like this.

289
00:26:13,590 --> 00:26:20,490
And let's see, let's see, OK, how about we go back to number entered, we can say Pranav.

290
00:26:32,650 --> 00:26:43,310
No, you entered is percentage did you line like this?

291
00:26:45,420 --> 00:26:46,910
Whichever way, right?

292
00:26:47,190 --> 00:26:48,780
And I'm going to pass it over here.

293
00:26:50,970 --> 00:26:56,640
And how about we try a string by saying, please enter a string print of.

294
00:26:59,210 --> 00:26:59,930
Please.

295
00:27:02,690 --> 00:27:04,880
Enter a character string.

296
00:27:10,280 --> 00:27:14,000
And we can grab this drink by using get as.

297
00:27:16,610 --> 00:27:27,870
And we can store it in our character store that we created up up here, and then we can print out the

298
00:27:28,010 --> 00:27:28,490
drink.

299
00:27:33,700 --> 00:27:34,510
The string.

300
00:27:37,690 --> 00:27:45,630
You it this and we can use put string to print out.

301
00:27:48,030 --> 00:27:53,170
Want to print out the content of SDR and we can put a bit of a new line over here.

302
00:27:57,570 --> 00:28:03,510
Right, let's expose this as well so that we can use this in our main function.

303
00:28:08,700 --> 00:28:15,330
And we can still use the printf function in our main F test that I want to put it all together so that

304
00:28:15,330 --> 00:28:16,420
we can test it at once.

305
00:28:16,440 --> 00:28:18,210
That's why I've created a function for it.

306
00:28:18,870 --> 00:28:19,260
Right.

307
00:28:19,560 --> 00:28:24,660
So once this is done, we can go to Maine and test this up when I come to Maine and I'm going to include

308
00:28:24,660 --> 00:28:27,300
the USA Today that we just created.

309
00:28:33,620 --> 00:28:37,590
Include you at this or are you at fault?

310
00:28:38,270 --> 00:28:51,860
And I'm going to come here and it made this void open, close, and we want to initialize the use that

311
00:28:52,520 --> 00:28:53,830
you start to in it.

312
00:28:54,170 --> 00:28:55,960
That's just the name of a function.

313
00:28:57,980 --> 00:28:58,930
It's over here.

314
00:28:59,840 --> 00:29:00,740
You've been close.

315
00:29:01,760 --> 00:29:06,090
And let's see, we don't need a while loop.

316
00:29:06,590 --> 00:29:11,180
Just put it here, over here regardless, OK?

317
00:29:11,550 --> 00:29:15,080
And we can call our function, which is set up test.

318
00:29:17,050 --> 00:29:22,900
Scored the test sets up, right, and have this.

319
00:29:23,110 --> 00:29:28,840
OK, so let's build and see if it's all fine of click to build.

320
00:29:30,940 --> 00:29:33,630
We've got no arrows and no we've got four.

321
00:29:33,670 --> 00:29:37,250
One is I'm going to come here to set up the debugger.

322
00:29:37,270 --> 00:29:39,280
I'm using the stealing debugger.

323
00:29:40,720 --> 00:29:49,690
Select Citilink over here when I click settings over here says no stealing detected.

324
00:29:50,140 --> 00:29:53,350
So I'm going to connect my microcontroller.

325
00:30:00,860 --> 00:30:02,760
I've just connected my microcontroller.

326
00:30:03,500 --> 00:30:09,620
I'm going to come back here again, debug as the debugger searches and a flash download, I'm going

327
00:30:09,620 --> 00:30:16,960
to click over here to run hook and OK, I'm going to click here to download onto the board and to download

328
00:30:16,970 --> 00:30:17,800
it successfully.

329
00:30:17,810 --> 00:30:21,140
I'm going to open our terror term now and see what we have.

330
00:30:24,160 --> 00:30:30,940
This is my territory, I'm going to click on Syria and I'm going to select from three as microelectronics

331
00:30:31,330 --> 00:30:37,560
link and then OK, and I'm going to press the reset button on my microcontroller.

332
00:30:37,720 --> 00:30:46,360
And as you can see, it says, please enter a number just like we wrote when it reset again, please

333
00:30:46,360 --> 00:30:46,680
enter.

334
00:30:46,690 --> 00:30:51,300
No, I'm going to enter 56, the number you entered.

335
00:30:51,310 --> 00:31:00,760
Fifty six, please enter character shrink will come to DL destroying you into this world, come to DL

336
00:31:00,760 --> 00:31:05,230
so it's fine and we can actually test out the print from here.

337
00:31:14,070 --> 00:31:24,780
This is a message from Main Say, right, and I'm going to click here to build.

338
00:31:27,660 --> 00:31:28,350
Or is it?

339
00:31:32,550 --> 00:31:39,870
Click here to build and I'll click here to download onto the board and we can take a look at terrorism

340
00:31:39,870 --> 00:31:40,230
again.

341
00:31:47,870 --> 00:31:54,460
OK, I'm going to select my serial port here and I'm going to press reset on the board.

342
00:31:54,710 --> 00:31:56,910
This is a message from me, right?

343
00:31:57,080 --> 00:32:01,490
So this brings us to the end of this very lesson, and I shall see you in the next lesson.

344
00:32:01,490 --> 00:32:03,300
If you have any questions, just let me know.

345
00:32:03,320 --> 00:32:09,890
Send me your questions in the Q&amp;A section or the Q&amp;A area, I should say.

346
00:32:10,220 --> 00:32:11,090
I'll see you later.
