Now let's see the protest simulation for the same process.
And then I will explain you how to write the code in assembly language and see language.
How orderly did encoding Assembly ANC language.
And also how creative to this fight simulation for variable registered island through file and alien.
I will provide you all these files in this whole section
let's open for this simulation.
I have made you same condition that I have shown you on PBT as you can see you put two pins are connected
to this row to be seven pins of this read through 9 and see the.
Negative negatives connected to grown v difference positive.
It is connected to 2.5 6.
Void
we are connected.
This elementary file to input signal.
Analog input beam and 1.
And we are taking output on both 1 and 2 Pt. 1 how connected 8 different entities.
Just to show you the binary conversion for input analog voltage
no let's quickly see what is electrify 3 I see and how it's work.
Electrified.
The temperature sensor I see it s trippin I see one penis busy add penis grown and the third penis output
the output wattage supplied by this AC is linearly proportional to the senses temperature that means
for every 1 degree change in the temperature the output water supplied by decisively increased by 10
million would
so I will run this simulation first Okay so you can see here when the temperature is 1 degree you can
say the amplitude by these two pins if the input what is 1 degree that means output what it is then
Billy Ward and the output will be logic 1 here.
Similarly if you increase the voltage if lit let's say 4 degrees Celsius that time output to what it
would be 40 million void and fill the binary or put would be for it is 0 8 0 9 I said don't count on
clock we are supplying globe from 8 0 5 0 microcontroller to this beam.
So now let's see the programming part let's see the assembly language program first.
I'm using your echo you assembler be reduced to you name to this beans in place of writing.
This being in code I will use name in India a queue I have given name Aditya a coupon for three point
zero DMB to put three point one hundred thirty two point forty three point twenty.
So on the output will be available on board B1 and I have named it as if only the output and the data
from 8 0.
This is ready to run and I will be available on pins output P2.
I won't name it as a ADC data as I told you that ADC is the way to run and I said don't count on Internet
club secretary we have supplied it from 8 0 5 1 microcontroller.
This particular interrupt code will generate their crop buds.
So here what I'm doing is I am simply complementing the output available on both three point seven points.
If it is zero then it will become one.
If it's one then it will become zero and I am clearing dear Zero flag.
I would turn this logic from our dress juror zero B H because it is the address where the controller
will jump whenever timer 0 or 4 interrupt will occur.
So here in this code I will use timer zero overflow Trump to generate square wave.
So that's why I hurried on this logic from my address to the zero v edge.
Okay so now here is the main logic since you want to use damage to an auto reload mode.
That's why we have to supply zero to each value to moderate user.
Then we ought to supply the a value let's do a b h.
Now while it drew a bitch I will tell you as I told you we have to sublet block from a digital file
microcontroller to it this is ready to donate nicely but of what frequency.
If you see the data sheet of a DC 0 0 9 I see you will find that the globe frequency ranges in close
to 1 2 8 0 kilohertz.
And let's say we want to supply clerk at a frequency of hundred kilohertz.
In that case we are to gendered our time period of in microsecond.
That means the delay will be of five microseconds.
Since we're using it to reload mode the formula to borrow the value is 256 minus family generator due
by one point thirty five microseconds.
So this alone will result into approximately 5 or so 256 minus file is 2 5 1 in decimal number and this
conversion in exile is a B H.
That's why we have taken value here.
If B edge them to enable them to zero also interrupt we are to supply a two edge to interrupt anybody
register.
I e to start time what do we have to set the editorial bit to logic.
1 So this configuration is there to generate clock of frequency.
Hundred kilohertz.
Now let's come to the main part where we are communicating with.
I see really see the red 0 9.
Since we you want to use both the input put your we are passing value their faith to what we do.
We want to use all means of put B one as output.
That's what we are buzzing velvety rage and we want to use for three or been support three as the output
except one that is nothing but forty three point six being that so we are passing value for euro each
to put P3
to select and one at the input source you have to set a DDR a and you have to clear edit there be energy
to see.
So basically we are supplying logic 1 0 0 to address bins to select and 1 pin has a input analog P then
2 large developers Internet address bins inside ADC the Ready 0 9 yeah to set a leaping high then to
start conversion you are to set start up conversion being high then you have to set logic 0 2 really
and to start off conversion being after this part we are to wait on your sleeping till the time very
soon logic 0 so we are doing that by using this statement jump bit if you Yosemite's logic will then
be in this loop once you spin get logic 0 it will come out of that loop and it will enter into this
loop.
So now here we will wait till the time use it becomes 1 again once it does become 1 then it will come
to this statement.
So we are basically waiting for transition on usurping from 1 to 0 then from 0 to 1 once very soon.
End of conversion signal from this is ready 0 9 AC then we are to set or put annual pin 2 logic 1.
Once you said these two logic 1 we can read converted data present on datapoints of ADC to microcontroller
pins we had we have connected LRAD then you're to clear or unable P.
We have written this logic in infinite loop using statement short jump back so no I hope you must have
got some idea how you can program interfacing of ADC with a 0 5 1 microcontroller in assembly language
similarly you can write code in C language
while declaring beans in C language you have to use assembler data DOS is built for individual pins
and has defined for into port
to generate bus you have to write one function just to make sure that after the function name you are
to write interrupt one here the one indicates interrupt number four timer zero or interrupt.
So like assembly language these first four lines is to generate clock pulse of hundred kilohertz.
This logic is to make both two as it input port Port one at the output port and port three as output
port except PIN number three point six
then you have to pass logic 1 0 0 to ABC either spins them to let values present on our address been
inside a DC I see your do good logic one to a leaping then your to do logic one to start conversion
being then you are to make a loop in low start conversion been low and you have to wait for end of conversion
process that we are doing using this true statement while you constrict goes to what till the time the
value of your spin is 1 it will be in this loop once it is become 0 it will come out of this loop and
it will enter into this loop then the logical usage in June from 0 to 1 this condition will become false
and it will come to this statement ends by using these two statement We are monitoring the status of
end of conversion being once these early signs indicates the end of conversion we will send logic one
on output enviable pin and then we will do data present on ATC data spins to microcontroller and we
will send it to board where we have connected LCD for display outputs and then we will make output unable
been to logic zero we have written this logic an inside while one loop No I hope you have understood
how we can write C language program to interface ADC with 8 0 5 microcontroller I see as I already told
you that I have already created project files for assembly language called C language good and it is
0 5 and interfacing with ADR alien to 5 and variable registers and I am going to provide you all these
files in a little section
I will not waste time in writing code in assembly language in C language because if you are watching
this you do that means you have already watched my earlier we do it and you know how to write assembly
language program and see language programs in Cal software.
So thats why I will skip that portion and I will also skip the simulation part because it's pretty straightforward
and I have already created assembly language file C language files and put in simulations files for
your ready reference thank you for watching we do have a nice day.