1
00:00:00,680 --> 00:00:01,850
Hello, welcome back.

2
00:00:01,880 --> 00:00:10,190
So let's continue, I've just come over here and create a new file, right click menu item at DOT five

3
00:00:10,400 --> 00:00:15,230
and that's going to cost to EFORE artist tbsp then.

4
00:00:16,140 --> 00:00:19,350
It's created and then I've got to add it to my project.

5
00:00:20,810 --> 00:00:28,580
A double click here and then I select all files and then I can find it, it's over here, I double click

6
00:00:28,580 --> 00:00:29,100
to add.

7
00:00:29,750 --> 00:00:32,360
So yes, no, it's part of our project.

8
00:00:33,450 --> 00:00:43,440
So we start by using the if and statement to prevent multiple additions or multiple definition, so

9
00:00:44,100 --> 00:00:46,940
I do this and then.

10
00:00:47,940 --> 00:00:48,720
And if.

11
00:00:51,060 --> 00:00:51,600
Right.

12
00:00:52,650 --> 00:00:56,000
Remember I said we've got a mojos, one of them is the time.

13
00:00:56,360 --> 00:01:03,000
Let's start with I'm going to start by creating handlers for the time as we're going to use time as

14
00:01:03,000 --> 00:01:04,810
two, three, four and five.

15
00:01:05,100 --> 00:01:10,870
I'm just going to keep them here and we're going to have an API to initialize the timer.

16
00:01:11,190 --> 00:01:12,920
Another API to start.

17
00:01:12,930 --> 00:01:21,170
A timer would interrupt and then we're going to have another API to perform the two steps in one show.

18
00:01:21,180 --> 00:01:24,910
I'm just going to bring the APIs to initialize the timer first.

19
00:01:24,930 --> 00:01:26,100
It's as simple as this.

20
00:01:26,100 --> 00:01:27,440
It takes no argument.

21
00:01:27,450 --> 00:01:30,150
It returns no parameter as well.

22
00:01:31,840 --> 00:01:40,150
Like this and then this, which I used to initialize the time, is then we need some APIs to initialize

23
00:01:40,150 --> 00:01:41,850
and start the interrupt.

24
00:01:42,640 --> 00:01:44,170
We shall see how they're implemented.

25
00:01:44,200 --> 00:01:48,820
I know they might look a bit strange at this moment, but don't worry.

26
00:01:49,480 --> 00:01:56,740
So instead of just writing out all the APIs for all modules, how about we do this and then we deal

27
00:01:56,740 --> 00:02:03,710
with the implementation of the time and then we come back to Canada module, then we deal with its implementation.

28
00:02:03,760 --> 00:02:06,500
So I'm going to create the implementation file as well.

29
00:02:06,610 --> 00:02:09,460
I'll come over here at New Item.

30
00:02:10,650 --> 00:02:19,620
I don't see far then I'm going to add the name artist, PZP and the other over here, what I want is

31
00:02:19,620 --> 00:02:23,630
to include the DOT HFA we just created over here.

32
00:02:23,850 --> 00:02:25,080
So I'm going to say include.

33
00:02:29,440 --> 00:02:31,030
Today like this.

34
00:02:32,280 --> 00:02:35,000
I think the age is problematic.

35
00:02:35,540 --> 00:02:43,370
OK, so it cannot identify this is because we've not ordered the estimated 32 hardware obstruction there,

36
00:02:43,400 --> 00:02:45,980
which is provided by Steve Microelectronics.

37
00:02:46,580 --> 00:02:52,070
So to do that, I'm just going to come here, come back here and come to devise.

38
00:02:53,850 --> 00:03:00,840
And come to KUB Hall and I'm just going to include the time out with with just initialise the timer.

39
00:03:02,900 --> 00:03:10,940
And what I'm going to do is I'm going to resolve resolve and then I'm going to select one of these and

40
00:03:10,940 --> 00:03:12,850
the one I'm going to select is the classic.

41
00:03:13,430 --> 00:03:17,630
So come over here and select classic here like this and it's all disappeared.

42
00:03:17,670 --> 00:03:18,860
Meaning it's OK now.

43
00:03:19,100 --> 00:03:20,290
And I click OK.

44
00:03:21,170 --> 00:03:23,030
And then once that is done, I can just.

45
00:03:23,030 --> 00:03:23,330
Right.

46
00:03:23,330 --> 00:03:26,510
Click over here and then see this one here.

47
00:03:28,000 --> 00:03:29,380
And I would include.

48
00:03:31,710 --> 00:03:37,620
And you can see this has disappeared now, if I wish to go everywhere, shall deal with that later.

49
00:03:39,520 --> 00:03:46,500
So let's take a look at the implementation of the timeline module, less populated initialization function

50
00:03:46,510 --> 00:03:51,280
we just spoke about or just break off for initialization such once.

51
00:03:53,740 --> 00:04:00,250
And as you can see, we've got the time in it here, and what we're doing is we initialism this time

52
00:04:00,550 --> 00:04:02,350
to work in milliseconds unit.

53
00:04:03,260 --> 00:04:10,190
And because our clock frequency is 16 megahertz, we use a scale of sixteen thousand and then we use

54
00:04:10,190 --> 00:04:15,770
a period of one, meaning the units is one millisecond or a millisecond.

55
00:04:17,870 --> 00:04:25,460
And they see this one as millisecond as well, but we shall change these parameters later with our experiment,

56
00:04:25,460 --> 00:04:25,930
right.

57
00:04:26,630 --> 00:04:32,830
And also we shall build a function that would help us change the system frequency to 80 megahertz.

58
00:04:33,050 --> 00:04:36,510
And once that is done, we have to come here and update it as well.

59
00:04:37,220 --> 00:04:42,620
But, yeah, this is a if you require more explanation or if you want to build your own time, a drivers,

60
00:04:43,340 --> 00:04:45,630
you can send me a message and I'll take you through that.

61
00:04:46,070 --> 00:04:47,270
So that's the nightfall.

62
00:04:47,270 --> 00:04:48,950
But this not the only thing we need.

63
00:04:48,960 --> 00:04:55,790
We also need the MSP in it and the need for the mouthpiece towers for the microcontroller support package.

64
00:04:56,390 --> 00:04:57,490
We need that as well.

65
00:04:57,800 --> 00:05:01,630
That's required by the system, 32 hardware obstruction there.

66
00:05:02,180 --> 00:05:03,860
So I'm going to grab those as well.

67
00:05:04,380 --> 00:05:11,510
I mean, we could we could actually take the content of the MSB in its function and put it inside the

68
00:05:11,720 --> 00:05:15,600
standard in its function, but that would just make things clutter together.

69
00:05:15,920 --> 00:05:17,020
So this is it.

70
00:05:17,030 --> 00:05:19,640
This just enables the timer to interrupt request.

71
00:05:20,820 --> 00:05:26,190
And we can come over here to change, to interrupt priorities and the priorities.

72
00:05:27,230 --> 00:05:33,320
And this one is used to initialize the timer so we can call this function in case we wanted to initialize

73
00:05:33,320 --> 00:05:33,950
the timer.

74
00:05:35,000 --> 00:05:41,320
So this the D in it, then we have the timer to start this one here.

75
00:05:41,780 --> 00:05:47,480
It's a combination of the pace start interrupt function and the timer to in its function.

76
00:05:47,930 --> 00:05:55,580
And we can call this one function to initialize the timer and then start interrupt rather than start

77
00:05:55,970 --> 00:05:56,790
initialize.

78
00:05:57,470 --> 00:06:00,260
So I'm just going to bring that over here as well.

79
00:06:01,790 --> 00:06:03,720
If there's anything you do not understand.

80
00:06:04,940 --> 00:06:07,240
Don't forget to leave a question or send me a message.

81
00:06:07,940 --> 00:06:11,660
I don't want it to feel like I'm just dropping code on top of your head.

82
00:06:11,990 --> 00:06:17,330
So really, there's a lot to cover in developing and building real time applications.

83
00:06:17,330 --> 00:06:22,160
And to spend time building peripheral modules is a different course.

84
00:06:22,190 --> 00:06:23,770
That's why I'm taking this approach.

85
00:06:23,780 --> 00:06:30,800
But if you disagree or if you need more explanation for any of what I'm doing here, don't hesitate

86
00:06:30,800 --> 00:06:33,860
to send me a message or to leave a question below.

87
00:06:33,920 --> 00:06:35,780
Yeah, right.

88
00:06:35,780 --> 00:06:36,340
Moving on.

89
00:06:36,830 --> 00:06:39,560
So then we've got we've got a C.

90
00:06:40,070 --> 00:06:43,240
Yes, we've got all the time our initialization stuff done.

91
00:06:43,970 --> 00:06:46,940
So what I'm going to do next is bring in the interrupt hunt.

92
00:06:46,940 --> 00:06:53,090
Less of the time is and I'm going to keep the interrupt handlers in the support package file and then

93
00:06:53,090 --> 00:06:58,670
we can copy and paste that interrupt handler into our application file, which is going to be something

94
00:06:58,670 --> 00:07:04,910
like may not see when we start writing the applications, but I'll bring the interrupt handlers here.

95
00:07:05,330 --> 00:07:08,660
And what I'm going to do also is to create some local variables.

96
00:07:09,230 --> 00:07:13,130
I'm going to call them count two, three, four, five.

97
00:07:13,610 --> 00:07:19,820
And later on, when we test in the module, we're going to see whether indeed these counties increment

98
00:07:19,820 --> 00:07:24,370
according to the the period or the frequency we've set for each timer.

99
00:07:24,860 --> 00:07:27,080
So I'm going to bring the local variables here like this.

100
00:07:28,550 --> 00:07:32,720
And I'm going to bring the interrupt handlers all at once again.

101
00:07:34,790 --> 00:07:40,340
You can download a complete board support package at the end of this video, so I don't need you to

102
00:07:40,340 --> 00:07:44,330
be, you know, type in that, I know that's unrealistic.

103
00:07:44,730 --> 00:07:48,950
So we're going to add another function to help us create millisecond delays.

104
00:07:49,310 --> 00:07:50,990
And that's a very simple function.

105
00:07:52,280 --> 00:07:53,180
It's like this.

106
00:07:54,050 --> 00:07:59,210
And this shall complete the the the implementation of the time of my.

107
00:08:00,290 --> 00:08:06,040
So next, we will take a look at the ATC modules and we initialize in just one ATC pen.

108
00:08:06,380 --> 00:08:09,200
And with this, we shall connect our potential meter.

109
00:08:09,920 --> 00:08:16,850
And later on we'll see whether we can connect a different kind of sensor to plot the graph on the LCD

110
00:08:16,850 --> 00:08:17,300
screen.

111
00:08:18,260 --> 00:08:18,670
Hello.

112
00:08:18,680 --> 00:08:19,400
Welcome back.

113
00:08:19,430 --> 00:08:20,740
So let's continue.

114
00:08:21,350 --> 00:08:28,550
I've just come over here and create a new file, right click add new item at each file and there's going

115
00:08:28,550 --> 00:08:31,700
to cost Stamford's to efore Artus tbsp.

116
00:08:32,300 --> 00:08:36,920
Then it's created and then I've got to add it to my project.
