1
00:00:03,000 --> 00:00:10,320
So now that we know how much coal operations work let's continue with our code and the steps above here

2
00:00:10,680 --> 00:00:12,660
as we know we have here.

3
00:00:12,660 --> 00:00:19,770
Step two says we should set direction register to either input output but before we do that there is

4
00:00:19,770 --> 00:00:24,350
one more instruction needed to activate the clock.

5
00:00:24,420 --> 00:00:30,930
As it stands now we have not written any value to the RCC keeping a bow which is the clock register.

6
00:00:32,490 --> 00:00:38,910
We have merely manipulated values in there but we've not committed the values to the register to do

7
00:00:38,910 --> 00:00:39,290
this.

8
00:00:39,300 --> 00:00:48,290
We have to use the S T R code and the SDR it stands for store.

9
00:00:48,300 --> 00:00:52,070
We do this by invoking s t r.

10
00:00:52,080 --> 00:01:02,230
We do this like this SDR source register which is r 0 and then destination register which is r 1.

11
00:01:02,250 --> 00:01:12,150
So like this we fully committed the new manipulations into the S into the RCC keep a register and we

12
00:01:12,150 --> 00:01:16,790
can move on to Stage 2 which is to set the direction register.

13
00:01:17,250 --> 00:01:22,040
So let's recap what we did to activate that clock.

14
00:01:22,800 --> 00:01:30,660
So what we did was we wanted to change a value in the system control rc qc copy or register in order

15
00:01:30,660 --> 00:01:31,480
to do that.

16
00:01:31,530 --> 00:01:39,240
We stored its current value in a register and then manipulated that current value as toward what it

17
00:01:39,240 --> 00:01:43,470
back into the same RACQ CPI you register.

18
00:01:44,140 --> 00:01:48,000
So we're going to do the same thing for our other registers.

19
00:01:48,000 --> 00:01:50,890
We have to go through three other registers.

20
00:01:51,060 --> 00:01:59,920
And the next one is the direction register and we call it just like we did we load the first used to

21
00:02:00,440 --> 00:02:09,010
old the R up code and we use our line and then this one would give it a symbolic name.

22
00:02:09,120 --> 00:02:16,790
I put FDA R R on the school R like this.

23
00:02:16,830 --> 00:02:22,270
So now we're point into this register.

24
00:02:22,690 --> 00:02:27,760
We can write the fund you directly to this register and I'll explain why that is.

25
00:02:27,760 --> 00:02:37,230
We can use to move up Coke Zero and then zero to two right to this register.

26
00:02:37,360 --> 00:02:41,550
And then finally we can store this value.

27
00:02:41,860 --> 00:02:47,800
We always have to store with our store or the work is for nothing.

28
00:02:47,860 --> 00:02:58,330
So what we did here the reason why we used to move instead of the O are I'll just post my video and

29
00:02:58,330 --> 00:03:01,360
let you think about it for a minute.

30
00:03:01,360 --> 00:03:02,020
All right.

31
00:03:02,020 --> 00:03:03,150
Have you thought about it.

32
00:03:03,160 --> 00:03:05,290
Why do you think we used to move.

33
00:03:05,950 --> 00:03:08,770
Yes I know you probably got it right.

34
00:03:08,770 --> 00:03:11,280
We used to move because we'd write in this value.

35
00:03:11,290 --> 00:03:15,860
Yes you execute it too which is an 8 bits value.

36
00:03:15,940 --> 00:03:17,910
We write in it directly to the register.

37
00:03:17,920 --> 00:03:22,590
Remember we said you can use move when the value you write in is AIDS.

38
00:03:22,610 --> 00:03:24,040
Bits are below.

39
00:03:24,040 --> 00:03:30,010
And when you go right into the lower registers the next thing we have to do for our initialization is

40
00:03:30,010 --> 00:03:33,930
to access the digital enabled register and enable the.

41
00:03:34,620 --> 00:03:43,510
The pin that we want which is the pin for P F one the red LP and we use the same method first we do

42
00:03:43,510 --> 00:03:47,620
the register we manipulated and write back to it.

43
00:03:48,340 --> 00:04:03,370
And we know we do this by via L.D. R 1 and GPA on the school for the deaf and the school R and then

44
00:04:03,400 --> 00:04:08,260
we move the father here and we move the same value

45
00:04:11,220 --> 00:04:15,560
you eggs 0 2.

46
00:04:15,770 --> 00:04:16,990
I know we treated this.

47
00:04:17,000 --> 00:04:19,170
You know why that bothers you a series too.

48
00:04:19,220 --> 00:04:20,850
This is the hexadecimal number.

49
00:04:20,850 --> 00:04:27,160
If you expand it to a binary number you would realize that it enables just p 1.

50
00:04:27,410 --> 00:04:30,620
This what happens when we expand this number to binary.

51
00:04:30,620 --> 00:04:41,030
We have 1 2 3 4 and then we have 1 2 1 0 so you can know this is 0 between 2 and 3.

52
00:04:41,350 --> 00:04:41,570
Yeah.

53
00:04:41,590 --> 00:04:48,050
And remember I told you there are so many other serious here which we can just get we can shorten and

54
00:04:48,050 --> 00:04:49,480
it works in the same way.

55
00:04:49,750 --> 00:05:01,860
So we've written to it and now we can store it like this source and then destination good now.

56
00:05:02,240 --> 00:05:05,070
Our init subroutine is complete.

57
00:05:05,110 --> 00:05:14,660
What we want is to use the Excel R code and what this does is its returns from this subroutine like

58
00:05:14,660 --> 00:05:15,580
this.

59
00:05:15,650 --> 00:05:21,590
After you run everything after it runs everything in the subroutine it has to return back here and continue

60
00:05:21,800 --> 00:05:25,020
with what we've put under this subroutine.

61
00:05:26,240 --> 00:05:27,320
So yeah.
