1
00:00:00,640 --> 00:00:01,810
Hello, welcome back.

2
00:00:02,200 --> 00:00:08,170
And this we are going to test out the drivers that we've assembled, but before we do that, I'm going

3
00:00:08,170 --> 00:00:17,340
to add a simple driver to our XDA that Cifas actually this driver has got nothing to do with XDA, but

4
00:00:17,380 --> 00:00:20,100
it's it's the same peripheral.

5
00:00:20,530 --> 00:00:23,170
It's a driver for PC 13 inputs.

6
00:00:23,170 --> 00:00:30,400
But in this configuration here will let us configure PC 13 as an input but in interruptive mode.

7
00:00:30,610 --> 00:00:34,330
And we'll interrupt mode in places that we need not check.

8
00:00:34,330 --> 00:00:37,990
The state of the pin, whether it's been pressed or not, will be towed.

9
00:00:38,740 --> 00:00:44,920
But I'm going to create a simpler driver, which would require us to pull the the state of the pin.

10
00:00:45,250 --> 00:00:48,190
So to do that, this one, I'm simply going to say void.

11
00:00:50,140 --> 00:00:51,130
This is an easy one.

12
00:00:51,130 --> 00:00:59,860
We say GPU in it and all we have to do is we have to enable clock access to GPU Pottsy, because we're

13
00:00:59,860 --> 00:01:08,500
dealing with PC 13 and because in the mode register to set up into inputs, you need to set the two

14
00:01:08,500 --> 00:01:09,550
bits of that be.

15
00:01:12,340 --> 00:01:19,540
You need to set it to bits of that pin to to 090, and because the default value is zero and zero in

16
00:01:19,540 --> 00:01:25,410
the mode register, I need not go and explicitly set it to zero zero over here.

17
00:01:25,450 --> 00:01:28,260
What we did is explicitly set it to zero and zero.

18
00:01:28,690 --> 00:01:31,900
We can do the same thing here or we can skip, but.

19
00:01:34,600 --> 00:01:36,680
I'll just keep and show you that it would still work.

20
00:01:36,700 --> 00:01:38,060
I think they'll be a good lesson.

21
00:01:38,440 --> 00:01:44,860
OK, so this over here, we just need to enable clock access and by default, the penis and input mode.

22
00:01:44,860 --> 00:01:46,140
So we're not touching anything.

23
00:01:46,540 --> 00:01:48,550
Now we're going to read the Penn State.

24
00:01:48,880 --> 00:01:54,640
So we have this function that we created is going to return you into eight underscore T and the name

25
00:01:54,640 --> 00:01:58,200
of the function is going to be read digital senseor.

26
00:01:59,380 --> 00:02:06,730
So we say read digital on the school senseor like this and it takes no arguments open and close like

27
00:02:06,730 --> 00:02:07,000
this.

28
00:02:07,480 --> 00:02:10,780
OK, so what we have to do is go to the.

29
00:02:12,330 --> 00:02:21,240
Port inputs, data register and locates the bits that corresponds to the the particular pin we are looking

30
00:02:21,240 --> 00:02:21,510
for.

31
00:02:22,080 --> 00:02:24,030
So let's go and see this.

32
00:02:25,030 --> 00:02:26,320
It's worth showing.

33
00:02:29,540 --> 00:02:33,500
I'm over here in our reference manual GPU.

34
00:02:34,760 --> 00:02:41,000
Registe this I'm going to scroll down to IDR, which stands for Input's Data Register.

35
00:02:42,300 --> 00:02:43,950
She'll be down here somewhere.

36
00:02:47,380 --> 00:02:55,720
We have input data register here and over here when we configure the opinions as input, the state is

37
00:02:55,720 --> 00:03:00,180
kept here such that I'd ask you is four point zero.

38
00:03:00,700 --> 00:03:07,630
So if our button was connected to a PIN zero, we can check IDR zero for where the button is pressed

39
00:03:07,630 --> 00:03:08,070
or not.

40
00:03:08,260 --> 00:03:10,930
In our case, we're dealing with 13.

41
00:03:10,940 --> 00:03:12,940
So IDR 13 here.

42
00:03:13,880 --> 00:03:21,170
And it tells us these bits are read-only and can be accessed in a word mode only, meaning we can access

43
00:03:21,230 --> 00:03:24,020
these bits in a 32 bit mode only.

44
00:03:24,990 --> 00:03:32,490
They contain the input value of corresponding iReports, so we want to check the status of this 13.

45
00:03:32,760 --> 00:03:39,840
So what we can do is we can run, we can write on an operator and compare it to the bits 13.

46
00:03:41,100 --> 00:03:42,750
OK, so.

47
00:03:46,650 --> 00:03:54,780
In this register industry, chuba to register, if we set everything to zero and we set only bits 13

48
00:03:54,780 --> 00:04:02,160
to one, if we convert zero zero zero zero zero zero one zero zero zero zero zero into hexadecimal,

49
00:04:02,160 --> 00:04:07,730
no, what we will get is zero six two zero zero zero three zeros after the two.

50
00:04:08,640 --> 00:04:10,230
All you can, you know.

51
00:04:11,910 --> 00:04:13,470
Three zeros after the two.

52
00:04:14,730 --> 00:04:15,850
Let's use hexadecimal.

53
00:04:15,870 --> 00:04:17,010
It will be shorter.

54
00:04:17,490 --> 00:04:18,740
Let me show you what I mean.

55
00:04:18,960 --> 00:04:21,870
Just pardon me this time I'm all over the place.

56
00:04:22,110 --> 00:04:27,870
So what we're going to do is this time elaborate because it's a short function over here.

57
00:04:27,880 --> 00:04:34,560
We're going to see if you see and input data register.

58
00:04:35,160 --> 00:04:38,180
So this is the entire register that we've just seen.

59
00:04:38,400 --> 00:04:42,630
We're going to take that and perform an end operation with zero X.

60
00:04:44,960 --> 00:04:51,770
Two zero zero zero and what does this mean, OK, if I take this hexadecimal value?

61
00:04:52,700 --> 00:04:54,950
And I it to binary.

62
00:04:57,050 --> 00:04:58,110
I'll show you what we get.

63
00:04:58,130 --> 00:05:03,470
But before I show you this value here that we see, we see it's got one, two, three, four digits

64
00:05:03,680 --> 00:05:10,220
is the same as one, two, three, four in a zero in front of a number can be deleted and is the same.

65
00:05:10,220 --> 00:05:15,620
So we can keep one zero here, keep to keep three or keep four or just have it like this is the same.

66
00:05:16,070 --> 00:05:20,030
If we expand this to binary, what we get is this.

67
00:05:21,650 --> 00:05:29,180
So this two here in binary becomes zero one, it becomes zero zero one zero like this, and the other

68
00:05:29,180 --> 00:05:31,220
zero become four zeros.

69
00:05:31,220 --> 00:05:32,240
One, two, three, four.

70
00:05:32,240 --> 00:05:35,030
And then one, two, three, four, one, two, three, four.

71
00:05:35,300 --> 00:05:39,260
So if we count this, we have we count from zero.

72
00:05:39,290 --> 00:05:42,220
So over here, we end it.

73
00:05:42,380 --> 00:05:50,230
We have zero, one, two, three, then four, five, six, seven, eight, nine, 10, 11, 12.

74
00:05:50,450 --> 00:05:51,740
This is 13.

75
00:05:53,020 --> 00:05:56,110
So we are comparing a bit to 13.

76
00:05:57,280 --> 00:06:04,090
This constant bit 13 and a bit 13 in our ADR register, we are performing an end operation.

77
00:06:04,360 --> 00:06:09,830
If our bits 13 and Idriz Sets is going to return, true, otherwise is going to return false.

78
00:06:10,150 --> 00:06:11,180
So that's what we're dealing with.

79
00:06:11,590 --> 00:06:12,100
OK.

80
00:06:16,190 --> 00:06:21,680
Let's see, so we are seen, we take this and then we perform our end operation and then we see.

81
00:06:24,430 --> 00:06:26,020
Return one for true.

82
00:06:28,660 --> 00:06:30,180
Else return false.

83
00:06:32,560 --> 00:06:33,850
10 zero like this.

84
00:06:34,120 --> 00:06:34,750
OK.

85
00:06:38,620 --> 00:06:39,070
Right.

86
00:06:39,100 --> 00:06:41,610
So we're going to expose these functions as well.

87
00:06:45,780 --> 00:06:46,380
DoubleClick.

88
00:06:47,650 --> 00:06:51,850
And I'm going to come to the includes order, open openness and.

89
00:06:53,280 --> 00:06:59,340
Drop this over here, put a semicolon and go back there, double click.

90
00:07:00,210 --> 00:07:06,930
Contrary to copy, includes foda to get the dots each fall and drop this over here.

91
00:07:07,660 --> 00:07:14,120
OK, we're looking good control to save over here and come back here, control to save us.

92
00:07:14,130 --> 00:07:18,480
Well, now I'm going to go to the main road, see fall and test them out one by one.

93
00:07:22,930 --> 00:07:25,360
So I'll come over here and I'll have.

94
00:07:26,830 --> 00:07:30,640
You indeed underscore t I call this B10 state.

95
00:07:32,900 --> 00:07:34,820
And then I have.

96
00:07:36,120 --> 00:07:40,640
You into 30 to 40, I'll call this sense of value.

97
00:07:50,150 --> 00:07:55,670
So over here in our wall, one, what we want to do is.

98
00:07:57,230 --> 00:08:01,310
We want to enable our you so Cappiello, you enable.

99
00:08:02,270 --> 00:08:08,420
Before our wild one, sorry about that of anybody, you how about ADC?

100
00:08:09,050 --> 00:08:13,250
We want to enable our ADC, so we call ADC and it's as well.

101
00:08:17,260 --> 00:08:19,480
If anybody ADC so now.

102
00:08:20,440 --> 00:08:22,930
In here, we're going to get our button states.

103
00:08:24,040 --> 00:08:26,020
We see button states equals.

104
00:08:27,060 --> 00:08:30,480
We're going to use read digital senseor.

105
00:08:31,670 --> 00:08:33,540
Function, the function we just wrote.

106
00:08:34,130 --> 00:08:38,630
So the return value of this function is going to be stored in our B10 state.

107
00:08:39,510 --> 00:08:40,110
Variable.

108
00:08:42,560 --> 00:08:45,590
OK, and then sense of value equals.

109
00:08:47,760 --> 00:08:51,480
We're going to call our read sense of value.

110
00:08:53,120 --> 00:08:55,580
Read analog senator over here.

111
00:08:56,100 --> 00:08:56,590
OK.

112
00:09:01,890 --> 00:09:03,450
This one here like this.

113
00:09:04,220 --> 00:09:04,590
OK.

114
00:09:08,260 --> 00:09:10,390
So we can print we can print something.

115
00:09:10,510 --> 00:09:14,910
Let's see, OK, we can read it on prints, we can just view this in the watch window.

116
00:09:15,940 --> 00:09:18,790
Um, so I come over here, click over here to build.

117
00:09:22,150 --> 00:09:23,690
We have three arrows.

118
00:09:24,480 --> 00:09:26,830
Let's see where the anomaly is, OK?

119
00:09:27,280 --> 00:09:28,830
Goodness, I'm losing my mind.

120
00:09:28,840 --> 00:09:31,040
I put these here.

121
00:09:31,210 --> 00:09:34,150
This is supposed to be a variable acyclic to be able to gain.

122
00:09:36,550 --> 00:09:39,820
It's built successfully, it's ups looking good.

123
00:09:42,480 --> 00:09:46,410
OK, so once this is done, I'm going to right click over here.

124
00:09:48,280 --> 00:09:53,740
And go to debuggers, estimate that to double click.

125
00:09:54,700 --> 00:09:56,380
The name some drivers.

126
00:09:57,560 --> 00:09:59,300
And then I say, OK, over here.

127
00:10:06,380 --> 00:10:07,610
And then I'll click the switch.

128
00:10:12,100 --> 00:10:13,930
Eau Claire, what we currently have here.

129
00:10:14,810 --> 00:10:24,500
Remove all of this controversy and then and then a sense of value as well currently of not connected

130
00:10:24,500 --> 00:10:28,070
in a sense, or to my P one.

131
00:10:28,100 --> 00:10:29,930
So we don't expect anything.

132
00:10:30,290 --> 00:10:34,620
We expect the value to be random to float and then I'll connect something and then we test it.

133
00:10:34,850 --> 00:10:36,410
So let's click here to run.

134
00:10:37,230 --> 00:10:44,390
OK, so the reason our B10 status is one is because our push button on the nuclear board is active high

135
00:10:44,750 --> 00:10:46,610
meaning by default, its values.

136
00:10:46,610 --> 00:10:48,930
One when you press its sorry.

137
00:10:50,390 --> 00:10:58,550
Scratch that, the push button on our nuclear on our nuclear board is active, low, active, low means

138
00:10:59,060 --> 00:11:02,280
it becomes when you activate it, it becomes law.

139
00:11:02,780 --> 00:11:05,870
So by default, its value is high, which is one.

140
00:11:05,960 --> 00:11:07,490
So I'm going to press the button, Lissi.

141
00:11:08,090 --> 00:11:12,320
You see, as I press is one I release as I press, it goes to zero.

142
00:11:12,320 --> 00:11:15,080
I release just one of press again.

143
00:11:15,080 --> 00:11:15,830
It becomes zero.

144
00:11:15,830 --> 00:11:18,320
I release it becomes one press again.

145
00:11:18,320 --> 00:11:19,520
It becomes zero release.

146
00:11:19,520 --> 00:11:20,210
It becomes one.

147
00:11:20,600 --> 00:11:20,990
So.

148
00:11:22,390 --> 00:11:25,530
Our or Aitkin is.

149
00:11:26,550 --> 00:11:33,360
Pier one, I'm going to connect a jumper wire from Pier one to ground to see if I can get it.

150
00:11:34,570 --> 00:11:37,090
Uh, my microcontroller disconnected.

151
00:11:40,360 --> 00:11:46,600
OK, so my microcontroller disconnected because I was trying to add a jumper wire in the OK, let's

152
00:11:46,600 --> 00:11:47,740
go back to Dybbuk.

153
00:11:47,830 --> 00:11:49,030
You click over here.

154
00:11:53,410 --> 00:11:55,600
It's opening a click to switch.

155
00:11:58,250 --> 00:11:58,780
OK.

156
00:12:02,270 --> 00:12:03,440
A click to run to code.

157
00:12:04,270 --> 00:12:12,230
OK, so currently I have an ADC connected to my PC, one of Connecter, the middle of the ADC to be

158
00:12:12,250 --> 00:12:19,630
one, the rightmost leg to the three point three votes and the leftmost leg.

159
00:12:21,310 --> 00:12:22,270
To my.

160
00:12:24,210 --> 00:12:30,380
OK, so currently I have a potential meter, just bear with me, this lesson is not going as planned.

161
00:12:30,750 --> 00:12:35,160
I have a potential meter connector to my P.A. one not on easy.

162
00:12:35,550 --> 00:12:36,950
I wonder why I said that.

163
00:12:37,350 --> 00:12:40,110
So there is a potential meter connector to peer one.

164
00:12:40,230 --> 00:12:46,260
And as you know, a potential meter has three legs, the middle leg, the left leg and the right leg.

165
00:12:46,530 --> 00:12:49,290
The middle leg is connected to a one.

166
00:12:49,590 --> 00:12:52,260
The left leg is connected to G and D.

167
00:12:52,560 --> 00:12:55,450
The right leg is connected to the three point three votes.

168
00:12:55,950 --> 00:12:59,940
And as I move the potential meter, you would see that the value would change.

169
00:13:00,180 --> 00:13:03,990
Currently the value is zero because I've moved it to the opposite end.

170
00:13:04,380 --> 00:13:05,400
That will give me zero.

171
00:13:05,400 --> 00:13:07,590
I'm going to move it to the other opposite end.

172
00:13:07,980 --> 00:13:08,580
Let's see.

173
00:13:13,320 --> 00:13:19,380
Just a moment, OK, so I've moved it to the opposite end and I can see the sense of value has changed.

174
00:13:19,800 --> 00:13:21,560
OK, you can try this with a jumper.

175
00:13:21,720 --> 00:13:27,600
Yes, well, you can just put a jumper wire into Pier one and then connect at the other end of the jumper

176
00:13:27,600 --> 00:13:29,490
wire to ground zero.

177
00:13:30,000 --> 00:13:33,710
And then you can pull it out of ground and connect it to three point three votes.

178
00:13:33,720 --> 00:13:35,550
It should read four thousand.

179
00:13:36,420 --> 00:13:41,730
And something which is the maximum ATC volume, four thousand and ninety five is the maximum, but it

180
00:13:41,730 --> 00:13:45,510
should be read in something around that it doesn't have to be precisely that.

181
00:13:45,930 --> 00:13:51,360
But this would be an indication that your analog sensor configuration is working.

182
00:13:51,840 --> 00:13:52,590
So this is it.

183
00:13:53,370 --> 00:13:58,560
So as you can see over here, yes, it's reading almost the maximum ATC value because my potential meter

184
00:13:58,560 --> 00:13:59,790
is pushed to the other end.

185
00:13:59,790 --> 00:14:07,950
If I'm to rotate it to the opposite end, is going to give us a value like zero one or two, which indicates

186
00:14:07,950 --> 00:14:10,380
that it's an extremely, extremely low value.

187
00:14:10,840 --> 00:14:13,050
OK, so I'm sure you've got this.

188
00:14:13,110 --> 00:14:15,330
I know this lesson had a bit of hiccups.

189
00:14:15,690 --> 00:14:20,610
If there is something you didn't understand, kindly leave it in the questions in this area and I'll

190
00:14:20,610 --> 00:14:22,190
be glad to follow up on it.

191
00:14:22,530 --> 00:14:23,080
So this it.

192
00:14:23,200 --> 00:14:24,960
I'll see you in the next lesson of a nice day.
