So now that we know how much coal operations work let's continue with our code and the steps above here
as we know we have here.
Step two says we should set direction register to either input output but before we do that there is
one more instruction needed to activate the clock.
As it stands now we have not written any value to the RCC keeping a bow which is the clock register.
We have merely manipulated values in there but we've not committed the values to the register to do
this.
We have to use the S T R code and the SDR it stands for store.
We do this by invoking s t r.
We do this like this SDR source register which is r 0 and then destination register which is r 1.
So like this we fully committed the new manipulations into the S into the RCC keep a register and we
can move on to Stage 2 which is to set the direction register.
So let's recap what we did to activate that clock.
So what we did was we wanted to change a value in the system control rc qc copy or register in order
to do that.
We stored its current value in a register and then manipulated that current value as toward what it
back into the same RACQ CPI you register.
So we're going to do the same thing for our other registers.
We have to go through three other registers.
And the next one is the direction register and we call it just like we did we load the first used to
old the R up code and we use our line and then this one would give it a symbolic name.
I put FDA R R on the school R like this.
So now we're point into this register.
We can write the fund you directly to this register and I'll explain why that is.
We can use to move up Coke Zero and then zero to two right to this register.
And then finally we can store this value.
We always have to store with our store or the work is for nothing.
So what we did here the reason why we used to move instead of the O are I'll just post my video and
let you think about it for a minute.
All right.
Have you thought about it.
Why do you think we used to move.
Yes I know you probably got it right.
We used to move because we'd write in this value.
Yes you execute it too which is an 8 bits value.
We write in it directly to the register.
Remember we said you can use move when the value you write in is AIDS.
Bits are below.
And when you go right into the lower registers the next thing we have to do for our initialization is
to access the digital enabled register and enable the.
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
the register we manipulated and write back to it.
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
we move the father here and we move the same value
you eggs 0 2.
I know we treated this.
You know why that bothers you a series too.
This is the hexadecimal number.
If you expand it to a binary number you would realize that it enables just p 1.
This what happens when we expand this number to binary.
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.
Yeah.
And remember I told you there are so many other serious here which we can just get we can shorten and
it works in the same way.
So we've written to it and now we can store it like this source and then destination good now.
Our init subroutine is complete.
What we want is to use the Excel R code and what this does is its returns from this subroutine like
this.
After you run everything after it runs everything in the subroutine it has to return back here and continue
with what we've put under this subroutine.
So yeah.