Mt10 Exp5 ADC
-
Upload
gaurav-patel -
Category
Documents
-
view
26 -
download
2
Transcript of Mt10 Exp5 ADC
Group no. mt-10
Name: PATEL GAURAV MAHENDRA Roll No.11EC65R04
Name: SOURABH SINGH YADAV Roll No.11EC65R07
Experiment 5: ADC interfacing
Objective:
Design a temperature monitoring and control system. It uses a temperature sensor whose output is fed to the ADC. The ADC sends the digital output to the microcontroller. There are two cutoff
temperatures – higher and lower. A heating coil and a fan is interfaced with the microcontroller.
The heating coil is turned on. If the temperature is more than the higher cutoff, a relay is triggered
to turn on a fan working at 12V, the coil is turned off. Again when the temperature comes down to the lower preset value, the fan is turned off and the coil is turned on.
Methodology:
Here to sense the temperature of the heating coil we are using LM35. Since o/p of the
LM35 is analog we convert it to digital using ADC0809.
LPC2129 here controls ADC0809 and reads the digital data from it on PORT0.
After reading the data LPC2129 takes decision of the task to be performed i.e. if
temperature is below a certain value it turns on the heater and if it is above a certain value
it turns on the fan. The threshold values are set in software.
To interface a cooling fan and a heating coil with LPC2129 we are using a relay.
This way temperature is continuously monitored and appropriate action is taken.
Hardware Description:
Various Connections of LPC2129 are as follows
START P0.2
OE(output enable) P0.4
EOC(end of conversion) P0.3
ALE(Address latch enable) P0.5
D0(LSB) – D7(MSB) P0.15 – P0.22
HEATER P0.13
Rest of the circuit is as shown in diagram.
Software Description:
Following function are used in our code:
1) delay(): This function is used to provide proper delay in the program.
2) main():
In this function firstly various pins are configured as input or output as per the
requirement.
Once this is done following part is repeatedly performed,
we apply pulses on ALE and START pins as follows.
IOSET0=ALE;
IOSET0=START;
delay(1);
IOCLR0=ALE;
IOCLR0=START;
After this we wait for conversion to get over i.e. EOC to be 1.
While(!EOC) - Waits till end of conversion sets.
Once conversion is completed we enable the output and read data from ADC and
display it on PORT1 as follows
IOSET0=OE;
temp_data=(DATA>>15);
IOSET1=temp_data<<16;
After this the DATA is compared with threshold values .
If DATA is greater than UT (upper threshold) heating coil is turned off, if it is
less than LT(lower threshold ) heating coil is turned on as follows.
if (temp_data>=UT)
IOSET0=HEAT;
else if (temp_data<=LT)
IOCLR0=HEAT;
Here UT is set to be 0x18 and LT is 0x12.
This cycle is repeated continuously.
Results and Observation:
We observed that whenever the temperature fell below the lower threshold (LT) the coil
is turned on and simultaneously fan is turned on. Due to this the temperature starts to
increase and when it reaches the upper threshold (UT) the coil is turned off and fan is
turned on due to which temperature starts to decrease.
Thus we have successfully implemented temperature monitoring and control system.