So let's take a look at logical operations.
Firstly let's look at the all operation.
Let's say you have two inputs and one an eye and two and an output.
And let's say these two inputs are disabled.
That is the 0 0 the output you get by performing all operation between these two inputs is zero.
Now let's say one input is zero input AI and one is zero and AI N2 becomes one output you get is one
let's say it's the other way round.
Now Ai and one becomes one an AI and 2 goes to zero.
The output you get is 1 unless a both inputs are 1 or enabled then the output is enabled.
This is the operation let's go to the next one.
The end operation and the end is quite as literal two that mean enough.
And just like that or is literal to the meaning of or let's say you still have two inputs here and an
output and both inputs are zero the output to zero.
Let's say one of them is enabled inputs 2 is enabled and one is disabled the output is still disabled
which is zero less inputs one is enabled and 2 is disabled your output is still zero.
Disabled let's say both of them inputs 1 and input two are both enabled then your output is enabled
or 1 let's look at the last one.
Eat or or the exclusive or operation the exclusive operation takes 2 inputs this let's take the two
input example again the first.
Both inputs are zero you get zero.
Okay now let's say one input to zero and the second input is 1 then to get 1 as an output let's say
the first input is 1 now and a second input is 0 you still get 1 as an output.
Now let's see input 1 and input 2 are both 1 that is enabled here your output is 0.
That's the difference between the all and the exclusive or operation it's exclusively or here by the
operation you could say it works with and as well while we are here let's take a look at how the clock
register our seed Casey complete I O is initialize This is a snapshot from the data sheet and I'd like
to remind you of what we see here.
We can see that bit six to thirty one are reserved.
That is they are read only bit six here to thirty one they are all here implies it's read only it's
reserved we cannot touch it and it's 0 through 5 control put a b c d e f b 0 through 5 here this year
controls put a puts b c d e f also I wanted to take a look at the value written up here as the reset
to value this one here.
It's been enlarged here for your sake it's here.
0 0 0 0 with eight zeros after the X.
This is essentially two bit hexadecimal number to make things easier for ourselves let's converts to
a binary reform we do this by expanding it and I should tell you one hexadecimal digits makes for binary
digits so it's zero here makes for other serious the OBE signifies it's a binary number just like o
x here shows that it's a hexadecimal number the bits we're interested in is this one here bit's five
remember we're counting from 0 0 1 2 3 4 5 so you might see bits number 6 but it spits 5 and we can
find a here.
This is a so we have to change this bit in in order to enable pot f if we were to enable say puts a
we would have to change the first bit here but we enable plain F so this the one we have to change now
let's see how to enable put f all we have to do is change the serial of bits 5 to 1 remember 0 is disable
1 is enable because we have a b c d e f we change this to 1 and then put F S enabled.
Now we have it by a reform but guess what.
We could in use in hexadecimal forms for our addresses so we have to convert this value to hexadecimal
and what we get is 0 x 0 0 0 0 0 2 0.
Now you might be wondering where did it to come from.
Remember we said h h hexadecimal no cases for binary numbers.
That is a decimal digit uses for binary digits.
Yes so if we take a look at the binary numbers 0 0 1 0 it translates to a hexadecimal number two.
That is how come we have this here.
Now let's take a look at how the R operator is used to enable pot.
F this is the code from your vision.
All I see row are serial numbers serial x 2 0.
And what this means is that resets the value because resets value all 0 x to zero.
Remember we used index address and to put their reset the value of the RC GC GPI or register into our
0.
So now our 0 contains the reset value which is 0 6 0 0 0 8 0.
After the X basically another thing is 0 x 0 0 0 0 2 0 is equal to zero x 2 0.
You can always remove the zeros preceding or in front of other integers as long as there is no other
integer after the 0.
So now let us perform the operation first let's convert put the reset value and 0 x 2 0 into buying
a reform.
And this what we get for the Reset value we get 32 zeros and we have this for these 0 x 2 0 0 zeros
except bits 5 which is 1.
This is the binary form of 0 x 2 0.
So as you can guess when we perform operation error within is still 0.
Except that same bits 5 cores input 1 or input to one of them has to be high for the output to be high.
So if you have input 1 0 here and input 2 1 here then the output is 1 and when we convert this back
to hexadecimal we come up with serial x 2 0.
Now I know you might be asking yourself why couldn't we just load the numbers zero x to zero into the
RC GC GPI or register.
The thing is if we load asset value directly into a register we risk tampering with other bits.
The reason why the outputs here is the same as the second input 0 x 2 0 is because the first set of
inputs were 0 0.
We were lucky enough to get 0 for this first set of inputs but we want to be lucky all the time using
the or operation a show star.
We change only the bit we want to change.
So now let's take a look at how to access the RCC GP.
I go register and rename it to the system control our CTC GP or register.
This is the same snapshot from the data sheet but now what we are interested in is up here the base
upgrades and the offset to get the address of the RC GC GP or register.
We will have to at the base and the offset.
Let's copy the base and the offset and bring it down here.
This what we interested in the base and the offset mis copied down here.
This the value of the base.
It's written broadly here and the value of the offset offset sorry.
What we are them.
We get this number.
So.
So the only way to access our GC keep p i o register is through this 32 bit hexadecimal number.
In reality this number here which is the address contains two resets value which is 0 x 0 0 you know
eight zeros after the X.
So because it's going to be quite tedious to always remember addresses and gas 32 bits number form we
can assign a name to the number so that anytime we want to access the address we invoke the name instead
of the number and the way we do this is by using the e q u directive.
Remember we said the e q is used to give a symbolic name to the constant.
This is an excellent example of it would given the symbolic name as white as s.t. l underscore our C
CTP underscore are to the constant 0 x 4 0 0 F E 6 0 8.
The reason why we are given that this long name with underscores and not something a bit more easy to
remember such as the word clock is that this is the symbolic name given to this register in header files
from Texas Instrument and libraries from third party sources in order to maintain consistency.
We must all endeavour to adhere to these sort of names and I have some good news for you.
You don't have to calculate the upgrades and give symbolic names to addresses or even calculate to perform
all operations accurately all the time.
You don't have to go through all this process all the time.
There are risks ahead of file provided by Texas Instruments which has already calculated the addresses
for all the registers we need and given symbolic names to them.
All we have to do is add this file to our project.
As for locating the right bids and then convert in between binary and hexadecimal to be able to perform
logical operations accurately I will teach you something known as the shift operation in the next chapter
and this will make the enabling and disabling of bits much easier.
Remember you don't have to understand everything in this section but if you want to be a cool text and
guru please endeavor to understand it.
Or you can watch this video you can watch this section about three times to make sure you really understand
it.
So we have our symbolic name here.