So now that we know where our lead is connected we can go ahead and initialize our parents and start
right into our LCD.
Let's delete this one here to initialize an input output port for general use requires usually three
steps.
The first step we have to activate that clock off the port in the iris UGC.
Keep it eye or register and if we are using PD 7 we would have to unlock the pin with a particular code.
This is only required if we are using PD 7 which we are not.
So we would after that set the direction of the pin in that the eye register.
And when we set it to zero we tell the microcontroller this pin is an input.
And when we set it to one standard microcontroller is told this pin is an output.
So we would have to set it to 1 in order to tell it of microcontroller or LCD is an output which is
after that we would have to enable the pin India enabler register.
And after with initialize we would have to write to the pin through the GP 8 0 data register.
So these pages here are pages in the data sheet that we can refer to and see how to enable these things.
Don't worry you wouldn't have to go through this long process all the time.
We are dealing with a fundamentalist task while we're going through every my new step.
So as you type know what it means in later videos you wouldn't have to do this.
You just have to import a file containing all of this information.
You wouldn't have to go to the data sheet for every program.
So if you've not yet downloaded a data sheet you can copy and paste this link into your address bar
and hit enter and you would find a data sheet in there.
I have my open here and as we said Yeah it's the data sheet.
This one should look for the data sheet we set.
Page 340 gives us the information about the RC keep a register.
So a quick way of doing that is just come in here and write in 340 and we are here.
So let's see what he says.
The RC Casey keep a register provides software the capability to enable and disable GPO modules in run
mode.
Blah blah blah.
What this means is when enabled and module is provided a clock and accesses to the modules registers
are allowed to in order to be able to control the registers of a particular module.
In this case a port in order to control the registers of port f we would have to activate the clock
of port F and let's see the register here.
You remember what we said registers are 32 bits and we can think of a bit as a demarcation and at draw
we said we can think of registers as drawers and destroy has a two demarcations so you can think of
four.
Here we have 0 1 2 3 4 5.
Or do we 2 3 1.
And this makes the two.
And let's see what each bit is used for.
We have bit 6 3 to 2 1 as reserved.
This is 6 to 1.
We don't touch here we don't use yet reserved when we have 0.
Let's see not this stuff from 5.
Let's go.
According to the document we have bit 5 year bit 5 is used to control pot.
F you see what we have here.
So there's the bit we would have to enable in the register to get access to the to the registers of
pot.
F bits for it's for pot e.
We're not using this in later videos we would use different ports.
So for put f we would have to activate the clock in bit 5 if 0 GPA or put F is disabled if 1 enable
and provide a clock to keep yo pots F in run mode.
So what we want is to enable and provide a clock to it.
So we would have to set it's 5 to 1.
So over here it says the next thing we would need to do is set the direction of the pin in the D I R
register and we can find that in Page 6 6 3 window unlocking PD 7 cos we're not using PD 7.
Step 3 says we set a direction that I R so we can find out in Page 6 6 3 that's come here.
Data Sheet check 6 6 3 what we have here.
Keep an eye o direction register and what us the direction register say 0 through 7 usable and a through
thirty one reserved.
And what does it say.
It says if 0 corresponding PIN is an input if one corresponding PIN is an output like we said earlier.
So we would have to set it to 1 to say as an output.
After that we would have to set the date and register we would have to set the digital enabled register
and we can find that on page 6 8 2.
So we come back here and we come straight to 6 8 to
enter and we have keep people digital and enable unless you want this tells us just like the DJI are
the hospital eight through thirty one we served and 0 through 7 usable.
These are the digital enables and 0 implies the pin is disabled and one implies it enabled.
So we have to enable this pin to be able to use a.