1
00:00:03,240 --> 00:00:09,900
And this lesson we are going to learn how to program the 32 bit by 64 bit time is.

2
00:00:09,910 --> 00:00:17,620
Remember we said our cortex and bought that team for one two three TVC Launchpad has 12 timers.

3
00:00:17,940 --> 00:00:28,040
Six of these timers are 16 bit by 32 bits timers and the other six are 32 bit by 64 bits timers.

4
00:00:28,530 --> 00:00:38,040
And we also said the 32 bit by 64 bit time is known as the wide timers get given the they are given

5
00:00:38,070 --> 00:00:45,210
this name to differentiate them from the first group and then the very last lesson we learnt how to

6
00:00:45,720 --> 00:00:55,560
program our sixteen bit by 32 bit time to behave in it 32 bit mode by concatenate INTO A and B of the

7
00:00:55,560 --> 00:00:56,620
timer.

8
00:00:56,790 --> 00:01:01,050
And this lesson we are going to use the wide timer to do that.

9
00:01:01,060 --> 00:01:07,580
Two bit timing programming and we are going to create a delay function and we wouldn't need to concatenate

10
00:01:07,620 --> 00:01:10,020
time or time a B.

11
00:01:10,230 --> 00:01:16,220
So I've created a new folder and created a new project and this is where I.

12
00:01:16,350 --> 00:01:17,860
I'll wait for you.

13
00:01:18,090 --> 00:01:21,040
Just post a video and create a new folder.

14
00:01:21,060 --> 00:01:22,080
Name it.

15
00:01:22,170 --> 00:01:26,660
Why to time and create a new project right.

16
00:01:26,750 --> 00:01:27,910
I suppose you're here now.

17
00:01:27,920 --> 00:01:32,590
So we set out what target option 16.

18
00:01:32,930 --> 00:01:39,780
And then at the bar guys the still areas ICD I had over here we'd reset and run.

19
00:01:39,850 --> 00:01:41,600
Check this here again.

20
00:01:41,630 --> 00:01:42,140
Okay.

21
00:01:42,140 --> 00:01:49,590
And our target is Team 4C One two three one two three.

22
00:01:49,610 --> 00:01:57,320
And the source group here we just put application when you're writing big up programs you might have

23
00:01:57,740 --> 00:02:02,160
about three or four for this you might want the application and one for that.

24
00:02:02,160 --> 00:02:08,540
Dick Dreyfus in another folder and perhaps the libraries in that third folder over here we just have

25
00:02:08,540 --> 00:02:14,940
one for that where we are storing our application and we're right click here and we come here at New

26
00:02:15,030 --> 00:02:22,450
item to group and this item is a c file and we name it main empty.

27
00:02:22,520 --> 00:02:25,710
And then we've got it right.

28
00:02:25,760 --> 00:02:31,730
So the first thing to do is to at the head of file of microcontroller like this.

29
00:02:32,480 --> 00:02:38,270
And yeah we start with our main function a main function is.

30
00:02:38,360 --> 00:02:38,910
Yeah.

31
00:02:39,080 --> 00:02:39,830
Got it.

32
00:02:40,610 --> 00:02:50,180
And like we did for the previous lesson this creates a symbolic name to to manipulate the LCD.

33
00:02:50,510 --> 00:02:53,430
And we did this with the blue just like this.

34
00:02:53,430 --> 00:02:53,600
Yeah.

35
00:02:53,610 --> 00:03:07,550
Quickly define you e when you said blues two excellent

36
00:03:12,870 --> 00:03:20,670
so let's perform the standard initialization is we stop by activating the clock source of port F and

37
00:03:20,670 --> 00:03:33,700
then we set a direction register and then the digital enabled register right.

38
00:03:34,130 --> 00:03:41,100
So now that we've done this we have to go and write to a new function using the y to timers before we

39
00:03:41,100 --> 00:03:41,620
do that.

40
00:03:41,790 --> 00:03:45,060
Let's put it while loop here.

41
00:03:45,080 --> 00:03:50,630
1 show let's call our function.

42
00:03:51,030 --> 00:03:52,880
Deputy 1.

43
00:03:53,460 --> 00:04:00,900
Like we named the previous time a function is just this function has to start with a w a there's a name

44
00:04:00,900 --> 00:04:10,830
I've given it to call the Y timer and it's taken an argument t time could just change this to SEC and

45
00:04:10,830 --> 00:04:19,420
we start by oh shit activates in the we use in time a one here.

46
00:04:19,450 --> 00:04:28,960
So we activate the clock full time the one y time of one and it's the RC Casey w timer to this to here

47
00:04:29,320 --> 00:04:40,300
indicate 0 0 2 because it's time one we use in white time a zero is the time one module and like we

48
00:04:40,300 --> 00:04:46,510
did for the first group of timers the rules are the same over here as well before you make any changes

49
00:04:46,510 --> 00:04:50,320
you have to disable the timer from the control register

50
00:04:52,990 --> 00:04:58,670
then you can use the configuration register to tell the timer the operation mode.

51
00:04:58,720 --> 00:05:06,520
In this case we are operating in 32 bit mode and remember 32 bit mode for this for the wait time is

52
00:05:06,520 --> 00:05:14,170
the default mode if we want to operate in the 64 bit mode we would have to change this year to 0 but

53
00:05:14,200 --> 00:05:20,110
I'll leave that for you as homework because you saw us do it for the first group of time as to the next

54
00:05:20,110 --> 00:05:28,080
thing is to to set the T A NMR register right.

55
00:05:28,480 --> 00:05:36,640
It's as simple as this we want to let's just change this I mean instead of doing the one shot example

56
00:05:36,640 --> 00:05:43,410
and then the periodic example let's just run a periodic example I know and I trust you can do the one

57
00:05:43,440 --> 00:05:45,700
shot mode on your own.

58
00:05:45,970 --> 00:05:48,510
So we just changed this to a periodic mode like this.

59
00:05:48,610 --> 00:05:58,090
The next step is to set the timer into while load register and we know 60 million gives us one second

60
00:05:59,320 --> 00:06:02,260
because I run frequency sixteen megahertz

61
00:06:07,650 --> 00:06:10,020
this we just saw the interrupt.

62
00:06:10,020 --> 00:06:20,610
Claire register and then we said configuration register we activate the timer display by setting it

63
00:06:20,610 --> 00:06:21,120
to 1.

64
00:06:21,120 --> 00:06:21,800
Like this.

65
00:06:22,350 --> 00:06:30,940
So as you can see it's just the same as the first group of time that we we dealt with the other differences.

66
00:06:30,960 --> 00:06:34,800
Over here we've got W. before the word timer.

67
00:06:34,890 --> 00:06:44,320
We've got WD starting with it and our like we did with create the for loop to enable us to have the

68
00:06:44,540 --> 00:06:51,060
acumen save us the number of seconds we want to delay start by creating the local variable here.

69
00:06:51,080 --> 00:06:55,280
We just create a local variable before it's ready to call it into I.

70
00:06:55,360 --> 00:07:03,470
And then I just come here no place to loop like this and I can get what's changed sic.

71
00:07:03,490 --> 00:07:15,760
So we use this and everything looks good or we have to do next we have to do next is just tested out

72
00:07:15,850 --> 00:07:17,320
like we did.

73
00:07:17,520 --> 00:07:18,580
We can move ahead

74
00:07:31,590 --> 00:07:32,870
really chuck a.

75
00:07:39,830 --> 00:07:45,190
And then we can use our newly created function.

76
00:07:45,320 --> 00:07:58,510
I'll just put a prototype up here like this and I can call the time a one time a one touch it one day

77
00:08:06,030 --> 00:08:11,910
I could delay or just delay ten seconds.

78
00:08:11,990 --> 00:08:12,490
Okay.

79
00:08:14,690 --> 00:08:15,470
It looks good.

80
00:08:15,840 --> 00:08:23,780
Let's compile and see zero errors as download on top board.

81
00:08:23,810 --> 00:08:26,170
Yes it's working.

82
00:08:26,390 --> 00:08:26,700
Yeah.

83
00:08:27,080 --> 00:08:30,260
So this is a it's very straightforward very simple.

84
00:08:30,290 --> 00:08:34,340
So you can see you have twelve timers at your disposal.

85
00:08:34,340 --> 00:08:42,080
You can do whatever you want with them and you can create perfectly accurate delays in the next in the

86
00:08:42,080 --> 00:08:48,970
next lessons we're going to learn how to count events using a timer and how to mesh shot deep Karen's

87
00:08:49,120 --> 00:08:52,520
the time between the parents of two events.

88
00:08:52,520 --> 00:08:54,490
So see you in the next lesson.

89
00:08:54,530 --> 00:08:54,740
Yeah.
