You are on page 1of 49

TRANSFORMER OVER HEAT PROTECTION

In this project we are taking electrically measuring temperature variations of Transformer. If transformer temperature varies above the limited value then we control that using relay and will give feedback on buzzer. For wireless detection we will use RF technology We used buzzer 5v to 27v i.e. we can give voltage from 5v to 27v. it will work. IN normal temperature controller we get a output for on and off purpose only but in this project we control the speed of the fan automatically. In brief firstly we convert the temperature into small voltage with the help of lm 35 sensor. LM 35 is temerature sensor convert the temperature in to small voltage at very accurately. Output of the temperature sensor is further converted into digital signal with the help of the ADC. IN this project we use ADC0804 . ADC 0804 is a 8 bit ADC and convert the any analogue signal into digital signal in 100 microsecond. To control the ADC we required a clock pulse, and 4 different signal . All this signal is provided by the controller. IN this project we use ic 89s51 as a main controller. IC 89s51 sense the output from the ADC in hex code. This HEX code is further converted into binary code with the help of program code inside the controller. IN the output device we use LCD display . LCD

display display the contents of the display with the help of the ASCII code. ASCII CODE is a special code for displaying the character in the LCD. In the controller we convert the binary code in to ASCII codes with the help of the code conversion program. Temperature sensor by the lm 35 is now display in the ASCII code on the LCD display. In the controller. We take four different output from the controller. These different output display the different temperature zone step by step. If the temperature is in between 25 to 30 then zone one is on and if the temperature is in between 30 to 35 then second zone is on. As the temperature increases different zones are on step by one. As the

temperature zone increase. LCD display a speed 1 or 2,or3 on the second line of the display. All the four zone are connected to the one variable resistor logic or connected to the fan regulator circuit. We use main resistance of the fan regulator . In the normal fan regulator there is total 5 point for 5 different speed. We use the same resistance for control the speed of the fan or control the intensisty of the light.

COMPONENTS USED: ADC 0804 OPAMP OP07 TEMPERATURE SENSOR LM 335 MICROCONTROLLER 89C51 LCD 2 BY 16 CRYSTAL 3.58 MHz RESISTOR 10 K 50 K 1K 2.2K 470 OHM CAPACITOR 22 PF 10 MFD

11 Pc 2 Pc VARIABLE VARIABLE 1 Pc 1Pc

2 Pc 1 PC 2 PC. 9-0-9

PUSH TO ON SWITCH

7805 REGULATOR STEP DOWN TRANSFORMER DIODE IN 4007( 4Pc) RELAY 4

500 OHM VARIABLE RESISTOR OF FAN REGULATOR

Earlier, we are looking into the face of future when we talked about automated devices, which could do anything on instigation of a controller, but today it has become a reality. 1. An automated device can replace good amount of human working force, moreover humans are more prone to errors and in intensive conditions the probability of error increases. Whereas an automated device can work with diligence, versatility and with almost zero error. 2. This is why this project looks into construction and implementation of a system involving hardware to control a variety of electrical and electronics instruments.

COMPLETE PROJECT IS TO BE DIVIDED INTO FEW PARTS TEMPERATURE SENSOR. OP-AMP AMPLIFIER. ANALOGUE TO DIGITAL CONVERTER. MICR-CONTROLLER INTERFACE. LCD INTERFACE OUTPUT CONTROL DEVICE.

TEMPERATURE SENSOR: Here we use LM 335 as a temperature sensor. Output of the temperature sensor is further connected to the op-amp circuit. Op-amp circuit amplify the signal from the temperature sensor and then this signal is further connected to the ADC 0804. Output of the ADC is connected to the micrcocontroller circuit. Microcontroller process the logic and then this logic is connected to the lcd driver circuit. LCD display the current temperature and set temperature at a time. Set temperature is set by the outside switches. With the help of these switches we set the temperature and . Current temperature that display on the lcd is display and compare with the set value of the controller. When current value is above from the set value then output load or heater is off. As the temperature is down from the set value then output load is again on. Once we set the value then temperature is to be maintain between these two value and stay here between the set point and current point. Out project is to be dived in two many parts. Sense the temperature by the temperature sensor. AMPLIFY THE TEMPERATURE SIGNAL BY THE OP-AMP CIRCUIT. Convert analogue signal into digital signal.

Digital signal is processed by the microcontroller and then convert it into ASCII code. ASCII code is to be display on the lcd by set value and current value Set the temperature from the outside. Switch on the load circuit with microcontroller. Temperature sensor. NEXT IMPORTANT PART OF THIS PROJECT IS LM 35 TEMPERATURE SENSOR. BY USING THIS SENSOR WE GIVE A INPUT TO THE ADC AND THEN USE THE ADC INTO MICROCONTROLLER CIRCUIT

POWER SUPPLY FOR DIGITAL CIRCUITS


Summary of circuit features

Brief description of operation: Gives out well regulated +9V output, output current capability of 100 mA. Circuit protection: Built-in overheating protection shuts down output when regulator IC gets too hot. Circuit complexity: Simple and easy to build. Circuit performance: Stable +9V output voltage, reliable operation. Availability of components: Easy to get, uses only common basic components. Design testing: Based on datasheet example circuit, I have used this circuit successfully as part of other electronics projects. Applications: Part of electronics devices, small laboratory power supply. Power supply voltage: Unregulated DC 8-18V power supply. Power supply current: Needed output current 1A. Components cost: Few rupees for the electronic components plus the cost of input transformer.

DESCRIPTION OF POWER SUPPLY

This circuit is a small +12 volts power supply, which is useful when experimenting with digital electronics. Small inexpensive wall transformers with variable output voltage are available from any electronics shop. Those transformers are easily available, but usually their voltage regulation is very poor, which makes them not very usable for digital circuit experimenter unless a better regulation can be achieved in some way. The following circuit is the answer to the problem. This circuit can give +12V output at about 1A current. The circuit has overload and terminal protection.

Circuit Power supply The above circuit utilizes the voltage regulator IC 7812 for the constant power supply. The capacitors must have enough high voltage rating to safely handle the input voltage feed to circuit. The circuit is very easy to build for example into a piece of Vero board.

Pin diagram of 7812 regulator IC PIN 1 : Unregulated voltage input PIN 2 : Ground PIN 3 : Regulated voltage output Component list 1. 7805 regulator IC. 2. 4700 uf electrolytic capacitor, at least 25V voltage rating. 3. 1000 uf electrolytic capacitor, at least 25V voltage rating.

Temperature Sensor - The LM35 The LM35 is an integrated circuit sensor that can be used to measure temperature with an electrical output proportional to the temperature (in oC)

The LM35 - An Integrated Circuit Temperature Sensor

Why Use LM35s To Measure Temperature? o You can measure temperature more accurately than a using a thermistor. o The sensor circuitry is sealed and not subject to oxidation, etc. o The LM35 generates a higher output voltage than thermocouples and may not require that the output voltage be amplified. What Does An LM35 Look Like?

What Does an LM35 Do? How does it work? o It has an output voltage that is proportional to the Celsius temperature. o o The scale factor is .01V/ C o The LM35 does not require any external calibration or trimming and maintains an accuracy of +/-0.4 oC at room temperature and +/- 0.8 oC over a range of 0 oC to +100 oC. o Another important characteristic of the LM35DZ is that it draws only 60 micro amps from its supply and possesses a low self-heating capability. The sensor self-heating causes less than 0.1 oC temperature rise in still air.

The LM35 comes in many different packages, including the following.


TO-92 plastic transistor-like package, T0-46 metal can transistor-like package 8-lead surface mount SO-8 small outline package TO-202 package. (Shown in the picture above) How Do You Use An LM35? (Electrical Connections) o Here is a commonly used circuit. For connections refer to the picture above. o In this circuit, parameter values commonly used are: Vc = 4 to 30v 5v or 12 v are typical values used. -6 Ra = Vc /10 Actually, it can range from 80 KW to 600 KW , but most just use 80 KW.

Here is a photo of the LM 35 wired on a circuit board. The white wire in the photo goes to the power supply. Both the resistor and the black wire go to ground. The output voltage is measured from the middle pin to ground.l

Here we use lm 35 is connected to the op-amp circuit to amplify the current Output of the LM35 is further connected to the pin no 26 of the

ADC. Here we use 0804 Adc to convert analogue signal into digital signal. This signal is further connected to the microcontroller. Our nest part of this project is ADC. Our ADC is very important part in this project. Here we use 0804 adc. This adc is 8 channel multiplexer and analog switch also. To select the desired channel we use 3 bit address. . In this project we give a input to the pin no 26. Pin no 26 is a o number input . so to select this input we connect all the address pins to the zero level.. Pin no 23 ,24,25 is the address pins so we ground all the pins to zero point.. By this we select the IN0 and we connect a thermo sensor to this point. Pin no 11 is the positive supply pin and connected to the regulated 5 volt dc power supply. Pin no 13 is ground pin so it is connected to the ground pin. Pin no 12 is the +voltage refrence pin. And pin no 16 is the negative refrence pin. . The conversion time in this conversion is 100 microsecond and 640 KHz. . Data output from the ADC is further connected to the port 3 of the microcontroller. All the eight output from the ADC is connected to the port 3 of the microcontroller. In this ADC we connect the voltage reference pin to the positive supply and negative reference pin to the ground pin.. Working of the ADC is depend on these five signal ALE ADDRESS LACH ENABLE EOC- END OF CONVERSION OE- OUTPUT ENABLE START- START THE CONVERSION CLK THIS IS VERY IMPORTANT IN ALL , CONTINUOUS CLOCK PULSE

All this signal is provided by the microcontroller circuit Detail of this important point is described in this below Adc details COMPONENTS USED: ADC 0804 OPAMP OP07 TEMPERATURE SENSOR LM 335 MICROCONTROLLER 89C51 LCD 2 BY 16 CRYSTAL 3.58 MHz RESISTOR 10 K 50 K 1K 2.2K 470 OHM CAPACITOR 22 PF 10 MFD

11 Pc 2 Pc VARIABLE VARIABLE 1 Pc 1Pc

2 Pc 1 PC 2 PC. 9-0-9

PUSH TO ON SWITCH

7805 REGULATOR STEP DOWN TRANSFORMER DIODE IN 4007( 4Pc) OPTO COUPLER MOC 3021 TRIAC BT 136

BASIC NOTES ON ADC Displaying data ADC 0804 in LCD Character as a Decimal

In this lesson will be learn how to display data ADC on LCD Character, for a simple task that we assume ADC have input ranges 0 - 5 volt, and then will display data as desimal that must be 3 digit 0 - 255.

Figure 2.5.1. Display data ADC to LCD Character as decimal

Step 1st Build the circuit as shown in figure 2.5.1. As you seen on figure 2.5.1. P0.0 trough P0.7 is connected to DB0 - DB7 ADC0804, and P2.0- P2.7. is connected to D0 - D7, and P3.0, P3.1. is connected to RS and EN each. Remember, that all we want to do with this lesson is write data ADC, in the first line of LCD Character

Step 2nd In this step, you must tipe the assembly program to make your LCD Character shown the data, we assume that you have already known the editor, we used MIDE-51 to edit the program. ( Download File asm : exp251.zip, Download Complete Circuit File : ADC.pdf ) org 0h call init_LCD start: call ADC call Bin2Dec call Write2LCD sjmp start ; ;================================================= ;this subroutine is used to take data from ADC and ;keep to Accumulator ;================================================= ADC: mov A,P0 nop nop ret ; ;===================================================== ;this subroutine is used print out data decimal to LCD ;character 2 x16 on address DDRAM 0C9 0CA 0CB each for ;hundreds, tens, and ones ;===================================================== Write2LCD: mov r1,#0c9h call write_inst mov a,hundreds add a,#30h mov r1,a call write_data ; mov r1,#0cah call write_inst mov a,tens add a,#30h mov r1,a

call write_data ; mov r1,#0cbh call write_inst mov a,ones add a,#30h mov r1,a call write_data ret ; ;===================================================== ;this subroutine is used to convert binary data from ADC ;become decimal 3 digit ;===================================================== Bin2Dec: mov b,#100d div ab mov hundreds,a mov a,b mov b,#10d div ab mov tens,a mov ones,b ret ; write_char: mov dptr,#word1 ;DPTR = [ address word1 ] mov r3,#16 ;R3=16,number character to be display mov r1,#80h ;R1=80h,address DDRAM start position acall write_inst ; write1:clr a ;A=0 movc a,@a+dptr ; A = [A+ DPTR] mov r1,A ; R1 = A inc dptr ; DPTR = DPTR +1 acall write_data; djnz r3,write1 ; R3 = R3-1, ret ; Init_lcd:

mov r1,#00000001b ;Display clear acall write_inst ; mov r1,#00111000b ;Function set, ;Data 8 bit,2 line font 5x7 acall write_inst ; mov r1,#00001100b ;Display on, ;cursor off,cursor blink off acall write_inst mov r1,#00000110b ;Entry mode, Set increment acall write_inst ret ; Write_inst: clr P2.0 ; RS = P2.0 = 0, write mode instruction mov P0,R1 ; D7 s/d D0 = P0 = R1 setb P2.1 ; EN = 1 = P2.1 call delay; call delay time clr P2.1 ; EN = 0 = P2.1 ret ; Write_data: setb P2.0 ; RS = P2.0 = 1, write mode data mov P0,R1 ; D7 s/d D0 = P0 = R1 setb P2.1 ; EN = 1 = P2.1 call delay; call delay time clr p2.1 ; EN = 0 = P2.1 ret ; delay: mov R0,#0 delay1:mov R2,#0fh djnz R2,$ djnz R0,delay1 ret ; word1: DB ' Data ADC0804 ' ; end

Step 3rd Safe your assembly program above, and name it with adc1.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction. Step 4th Download your hex file ( adc1.hex ) into the microcontroller by using Microcontroller ATMEL ISP software, see the instruction.After download this hex file you'll see the action of ADC ( of course if your cable connection and your program are corrected ) ADC0804LCN - 8 bit A/D Convertor Photograph Features Compatible with 8080 Microprocessors Easy interface to all microprocessors, or operates 'stand alone' Differential analog voltage inputs Logic inputs and outputs meet both MOS and TTL voltage level specifications Works with 2.5V (LM336) Voltage Reference On-chip clock generator 0V to 5V analog input voltage range with single 5V supply No zero adjust required
Operates ratiometrically or with 5 Vdc, 2.5Vdc, or analog span adjusted voltage reference

Pin Description Pin Description Number 1 CS - Chip Select (Active Low) RD - Read (Active Low) WR - Write (Active Low) CLK IN Clock IN INTR Interrupt (Active Low) Vin+ Analog Voltage Input Vin- Analog Voltage Input AGND Analog Ground Vref/2 Voltage Reference / 2

Pin Layout

Dimensional Drawing

3 4

10 11 12 13 14 15 16 17 18 19 20

DGND Digital Ground DB7 - Data Bit 7 (MSB) DB6 - Data Bit 6 DB5 - Data Bit 5 DB4 - Data Bit 4 DB3 - Data Bit 3 DB2 - Data Bit 2 DB1 - Data Bit 1 DB0 - Data Bit 0 (LSB) CLKR Clock Reset
Vcc - Positive Supply or Vref

he easiest way to do analog to digital conversion is to use an IC such as the ADC0804 that does the work for you. The analog voltage is applied to pin 6 and the result is available at pins 11 through 18. We will connect pin 1 and 2 (Chip Select and Read) to ground so that the chip is always enabled. (If you wanted to use more than one ADC you could use this pin to control which chip is currently enabled). Connect pin 7 (Vin - ) to ground. The ADC0804 includes an internal oscillator which requires an external capacitor and resistor to operate. Connect the 150 pF capacitor from pin 4 (CLOCK IN) to ground and

the 10k ohm resistor from pin 4 to pin 19 (CLOCK R). ( Download Complete Circuit File : ADC.pdf )

Figure 2.5.1 Typical connection of free running mode

For example: The input range of ADC is 0 - 5 volt then we must setting Vref = 0.5 Vin maximum or = 2.5 volt because this ADC0804 is 8 bit then V resolution = 5/255 = 0.02 volt this is mean that ADC will respon each 0,02V increasing Vin D0 D1 D2 D3 D4 D5 D6 D7 (volt) 0 0 0 0 0 0 0 0 0 0.02 0 0 0 0 0 0 0 1 0.04 0 0 0 0 0 0 1 0 0.06 0 0 0 0 0 0 1 1 0.08 0 0 0 0 0 1 0 0 0.10 0 0 0 0 0 1 0 1 0.12 0 0 0 0 0 1 1 0 : 5 1 1 1 1 1 1 1 1

Des 0 1 2 3 4 5 6 : 255

Stage 1) to operate this ADC, we use a free running mode, by connecting WR to INT Stage 2) When the conversion process is complete, pin 5 (Interrupt) will go low and this signal is used to convert ADC again. Stage 3) Next we read the values into the 89s51 Port 0. The assembly program will be: Org 0h start: mov A,P0 ; saving data ADC to Accumulator sjmp start end

Displaying data ADC 0804 in LCD Character as a Decimal

In this lesson will be learn how to display data ADC on LCD Character, for a simple task that we assume ADC have input ranges 0 - 5 volt, and then will display data as desimal that must be 3 digit 0 - 255.

Figure 2.5.1. Display data ADC to LCD Character as decimal

Step 1st Build the circuit as shown in figure 2.5.1. As you seen on figure 2.5.1. P0.0 trough P0.7 is connected to DB0 - DB7 ADC0804, and P2.0- P2.7. is connected to D0 - D7, and P3.0, P3.1. is connected to RS and EN each. Remember, that all we want to do with this lesson is write data ADC, in the first line of LCD Character Step 2nd In this step, you must tipe the assembly program to make your LCD Character shown the data, we assume that you have already known the editor, we used MIDE-51 to edit the program. ( Download File asm : exp251.zip, Download Complete Circuit File : ADC.pdf )

org 0h call init_LCD start: call ADC call Bin2Dec call Write2LCD sjmp start ; ;=================================================== ;this subroutine is used to take data from ADC and ;keep to Accumulator ;=================================================== ADC: mov A,P0 nop nop ret ; ;===================================================== ;this subroutine is used print out data decimal to LCD ;character 2 x16 on address DDRAM 0C9 0CA 0CB each for ;hundreds, tens, and ones ;===================================================== Write2LCD: mov r1,#0c9h call write_inst mov a,hundreds add a,#30h mov r1,a call write_data ; mov r1,#0cah call write_inst mov a,tens add a,#30h mov r1,a call write_data ; mov r1,#0cbh call write_inst mov a,ones add a,#30h

mov r1,a call write_data ret ; ; ====================================================== == ;this subroutine is used to convert binary data from ADC ;become decimal 3 digit ;===================================================== === Bin2Dec: mov b,#100d div ab mov hundreds,a mov a,b mov b,#10d div ab mov tens,a mov ones,b ret ; write_char: mov dptr,#word1 ;DPTR = [ address word1 ] mov r3,#16 ;R3=16,number character to be display mov r1,#80h ;R1=80h,address DDRAM start position acall write_inst ; write1:clr a ;A=0 movc a,@a+dptr ; A = [A+ DPTR] mov r1,A ; R1 = A inc dptr ; DPTR = DPTR +1 acall write_data; djnz r3,write1 ; R3 = R3-1, ret ; Init_lcd: mov r1,#00000001b ;Display clear acall write_inst ; mov r1,#00111000b ;Function set,

;Data 8 bit,2 line font 5x7 acall write_inst ; mov r1,#00001100b ;Display on, ;cursor off,cursor blink off acall write_inst mov r1,#00000110b ;Entry mode, Set increment acall write_inst ret ; Write_inst: clr P2.0 ; RS = P2.0 = 0, write mode instruction mov P0,R1 ; D7 s/d D0 = P0 = R1 setb P2.1 ; EN = 1 = P2.1 call delay; call delay time clr P2.1 ; EN = 0 = P2.1 ret ; Write_data: setb P2.0 ; RS = P2.0 = 1, write mode data mov P0,R1 ; D7 s/d D0 = P0 = R1 setb P2.1 ; EN = 1 = P2.1 call delay; call delay time clr p2.1 ; EN = 0 = P2.1 ret ; delay: mov R0,#0 delay1:mov R2,#0fh djnz R2,$ djnz R0,delay1 ret ; word1: DB ' Data ADC0804 ' ; end Step 3rd Safe your assembly program above, and name it with adc1.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction.

Step 4th Download your hex file ( adc1.hex ) into the microcontroller by using Microcontroller ATMEL ISP software, see the instruction.After download this hex file you'll see the action of ADC ( of course if your cable connection and your program are corrected ) Clock The clock signal is required to cycle through the comparator stages to do the conversion. There are 8, 8 clock cycle periods required in order to complete an entire conversion. This means that an entire conversion takes at least 64 clock cycles. (Up to 72 if the start signal is received in the middle of an 8 clock cycle period.) The clock should conform to the same range as all other control signals. The maximum frequence of the clock is 1.2MHz. The maximum clock frequency is affected by the source impedance of the analog inputs. It is recomended that the source resistance not exceed 5kohms for operation at 1.2MHz and 10komhs for operation at 640kHz. Note that when operating the ADC at 500kHz and below the ALE signal and the Start signal can be can be tied together. This is how the ADC is implemented in the VHDL code provided. The purpose of the start signal is two fold. On the rising edge of the pulse the internal registers are cleared and on the falling edge of the pulse the conversion is initiated. Like the ALE pulse the minimum pulse width is 100ns. The signal can be tie to the ALE signal when the clock frequency is below 500kHz. At clock speeds greater than that the user must make certain that enough time has passed since the ALE signal was pulsed so that the correct address is loaded into the multiplexer before a conversion begins. Note that it can take up to 2.5 microseconds for this to occur. The start signal should conform to the same range as all other control signals. The Output Enable signal causes the ADC to actually output the digital values on the output lines. The ADC stores the data in a tri-state output latch until the next conversion is started, but the data is only output when enabled. In this implementation the OE signal is pulsed high one clock cycle after the EOC signal goes high and remains high until the data is safely stored into the desired register in the FPGA. The OE signal should conform to the same range as all the other control signals.

EOC The End of Conversion signal is sent to the FPGA from the ADC. The signal goes low once a conversion is initiated by the start signal and remains low until a conversion is complete

Pin Label Input/Output Description Number Note: All control signals should have a high voltage from Vcc - 1.5 to 15V and a low voltage from 1.5V to -0.3V. 1 IN3 Input Analog data in. It is selected as channel 3 by the multiplexer. CBA = 011. 2 IN4 Input Analog data in. It is on channel 4 of the multiplexer. CBA = 100. 3 IN5 Input Analog data on channel 5 of the multiplexer. CBA = 101. 4 IN6 Input Analog data on channel 6 of the multiplexer. CBA = 110. 5 IN7 Input Analog data on channel 7 of the multiplexer. CBA = 111. 6 Start Input It is a control signal from the FPGA, which tells the converter when to start a conversion. It is a pulse of at least 100ns in width. 7 EOC Output Signal from the ADC. It goes low when a conversion is started and high at the end of a

2-5

Output

Output Input Enable

10 11 12

Clock Vcc

Input Input

VREF(+) Input

13 14

GND 2-7

Input Output

15

2-6

Output

16

VREF(-) Input

17

2-8

Output

conversion. Users can look for a rising edge transition. This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. Control signal for FPGA that turns the output of the ADC on while high. Useful for handshaking. Clock signal from FPGA. Max 1.2MHz. Power to the chip. Range 4.5V to 6.0V DC. Top rail of Reference voltage. The voltage level that, when received as an input, will output "11111111" to the FPGA. Max Value Vcc + 0.1V Ground. 0V This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. Bottom rail of Reference voltage. The voltage level that, when received as an input, will output "00000000" to the FPGA. Min Value -0.1V This is a bit of the digital

18

2-4

Output

19

2-3

Output

20

2-2

Output

21

2-1

Output

22

ALE

Input

converted output. 2-8 is the LSB. This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. This is a bit of the digital converted output. Where 2-8 is the LSB and 2 -1 is the MSB. This is a bit of the digital converted output. 2 -1 is the MSB. Control signal from FPGA. This should be a pulse from the FPGA sent when the address is ready to be loaded into the ADC. The minimum pulse width is 100ns. It can be tied to the Start line if the clock is operated under 500kHz.

Output of the AdC is now connected to the microcontroller. Microcontroller provide a clock pulse as well as OE , ALE, EOC, start, CKL pulses to the ADC to process the analogue to digital converter. Data is available from the Adc is connected to Port 1 of the microcontroller. All the control signal is provided by the Port p2 of the 89c51. Pin no 40 of the 89c51 is connected to 5 volt power supply. Pin no

20 is connected to the ground pin. Port p3.6 and port p3.7 is connected to the set point of microcontroller. Pin no 9 is the reset pin of the microcontroller. When circuit is power on the microcontroller reset automatically and then jump to the 0 location automatically. Program:

Firstly we assigned all the pins of the microcontroller to the port address or bit connection by their name LCD_DATA equ P0 lcd_en bit P2.7 lcd_rs bit P2.5 lcd_rw bit P2.6 ADC_DATA equ 23h ADC_PORT equ P1 START bit P2.4 EOC bit P2.2 ALE bit P2.3 OE bit P2.1 key1 key2 OUT1 bit p3.7 bit p3.6 p2.0

bit

Out means out output is available on this p2.0 for controlling the output load Key 1 and key 2 is set point from the outside to set the upper limit of the temperature.

org 0000h ljmp main main: lcall DELAY41 lcall DELAY41 clr lcd_rs clr lcd_rw clr lcd_en first of all we clear the lcd command and intialize the lcd by clr all the pins of the lcd control pins. RS, Rw and En is the control pins of the lcd.

setb

OUT1

mov LCD_DATA,#038h lcall COMMAND_BYTE

command byte is command funtion of the lcd. By using this command we force the lcd to recive the commanf signal

lcall DELAY41 mov LCD_DATA,#038h lcall COMMAND_BYTE 038 h is also a address of the lcd it maeans that we are using lcd of 2 by 16 line mov LCD_DATA,#008h lcall COMMAND_BYTE lcall DELAY1 mov LCD_DATA,#00ch lcall COMMAND_BYTE lcall DELAY1 mov LCD_DATA,#006h lcall COMMAND_BYTE lcall DELAY1 lcall CLR_LCD lcall DELAY1 mov LCD_DATA,#082h lcall COMMAND_BYTE mov LCD_DATA,#'C' lcall DATA_BYTE mov LCD_DATA,#083h lcall COMMAND_BYTE mov LCD_DATA,#'U' lcall DATA_BYTE mov LCD_DATA,#084h lcall COMMAND_BYTE mov LCD_DATA,#'R'

lcall DATA_BYTE mov LCD_DATA,#08ah lcall COMMAND_BYTE mov LCD_DATA,#'.' lcall DATA_BYTE mov LCD_DATA,#08bh lcall COMMAND_BYTE mov LCD_DATA,#'C' by this command we put a value of cur---c meassage on the first line of the lcd . On the second line of the lcd we agailn put a value of the set---c lcall DATA_BYTE mov LCD_DATA,#0cah lcall COMMAND_BYTE mov LCD_DATA,#'.' lcall DATA_BYTE mov LCD_DATA,#0cbh lcall COMMAND_BYTE mov LCD_DATA,#'C' lcall DATA_BYTE mov LCD_DATA,#0c2h lcall COMMAND_BYTE mov LCD_DATA,#'S' lcall DATA_BYTE mov LCD_DATA,#0c3h lcall COMMAND_BYTE mov LCD_DATA,#'E' lcall DATA_BYTE mov LCD_DATA,#0c4h lcall COMMAND_BYTE mov LCD_DATA,#'T'

by this command we set the lcd display and now we start the conversion by the command.

main_lp1: setb START clr START lp1: jnb EOC,lp1 setb OE clr OE by this routine we set the start bit of Adc and then we receive the data on output by monitioring EOC pin and Output enable pin and then we receive this data in the accumulator

after receivein the data we convert this data in to bcd signal by using hex to binary converter by div tchnique mov ADC_DATA,a mov b,#10d div ab mov dp2,b mov b,#10d div ab mov dp1,b mov dp0,a mov mov lcall lcall mov lcall lcall mov mov lcall lcall mov lcall lcall a,dp2 LCD_DATA,a DATA_BYTE DELAY41 LCD_DATA COMMAND_BYTE DELAY41 a,dp1 LCD_DATA,a DATA_BYTE DELAY41 LCD_DATA, COMMAND_BYTE DELAY41

mov mov lcall lcall mov mov div mov mov div mov mov mov lcall lcall mov mov lcall lcall mov lcall lcall mov

a,dp0 LCD_DATA,a DATA_BYTE DELAY41 a,cont b,#10d ab dp4,b b,#10d ab dp3,b dp5,a LCD_DATA COMMAND_BYTE DELAY41 a,dp4 LCD_DATA,a DATA_BYTE DELAY41 LCD_DATA COMMAND_BYTE DELAY41 a,dp3

by this way we display the temperature on the lcd

jb nxt:

key1,nxt ljmp up jb key2,nxt1 ljmp down

nxt1: ljmp

CMPOUT

by this keys we set the upper limit of the set temperature , in this routine we use two type of function one is up and second is down when we press a key1 then we call up and when we press key2 then we call down function .In the up and down function we increse and decrese the c set value by 1 and in the down we decrese the value by 1 cmp out is the compare function when set value is lower is compare to the cur value then output is on and when set value is equal to the cur value then output is off.

Bibliography: For project idea and components shop www.ludhianaprojects.com/antifalling_collision robot.doc www.8051projects.com project coding help www.mcuprojects.com for 8051 detail www.atmel.com for datasheet.com www.datasheetarchieve.com Programming Code RS BIT P2.5 RW BIT P2.4 E BIT P2.3 FL BIT P0.7 buzz equ p2.7 LCD EQU P0 mydata equ p1 ORG 00H AJMP START ORG 30H

START: MOV LCD,#00H mov p1,#0ffh setb INTR MOV A,#38H ACALL COMMAND MOV A,#02 ;RETURN HOME ;2*16 MATRIX

ACALL COMMAND MOV A,#01 ;CLEAR DISPLAY SCREEN

ACALL COMMAND MOV A,#0CH ACALL COMMAND MOV A,#80H COLOUMN ACALL COMMAND MOV DPTR,#TABLE1 ACALL DISPLAY acall READING ;DISPLAY ERP ;MOVE CURSOR TO FIRST LINE SECOND ;DISPLAY ON CURSOR OFF

METER: MOV R1,#00

j11: clr WR1 setb WR1 h121: jb INTR,h121 clr RD1 mov R1,P1 acall READING1 s12: ACALL CHECKC2

S11: setb RD1

sjmp START

READING: ACALL LCDCLR MOV A,#80H ACALL COMMAND MOV DPTR,#TABLE2

ACALL DISPLAY MOV A,#08AH ACALL COMMAND

MOV A,#087H ACALL COMMAND MOV DPTR,#TABLE3 ACALL DISPLAY

ret READING1: MOV A,#0C0H ACALL COMMAND MOV DPTR,#TABLE4 ACALL DISPLAY MOV A,R1 SUBB A,#150 SUBB A,#105 Acall write sjmp S12

CHECKC2: CLR A MOV A,P1 CJNE A,#00,J01 ACALL TEMP0 J01:CJNE A,#1,J02 ACALL TEMP0 J02:CJNE A,#2,J03 ACALL TEMP0 J03:CJNE A,#3,J04 ACALL TEMP0 J04:CJNE A,#4,J05 ACALL TEMP0 J05:CJNE A,#5,J06 ACALL TEMP0 J06:CJNE A,#6,J07 ACALL TEMP0 J07:CJNE A,#7,J08

ACALL TEMP0 J08:CJNE A,#8,J09 ACALL TEMP0 J09:CJNE A,#9,J10 ACALL TEMP0 J10:CJNE A,#10,J111 ACALL TEMP1 J111:CJNE A,#11,J121 ACALL TEMP1 J121:CJNE A,#12,J13 ACALL TEMP1 J13:CJNE A,#13,J14 ACALL TEMP1 J14:CJNE A,#14,J15 ACALL TEMP1 J15: CJNE A,#15,J22 ACALL TEMP1 J22:CJNE A,#16,J23 ACALL TEMP2 J23:CJNE A,#17,J24

ACALL TEMP2 J24:CJNE A,#18,J231 ACALL TEMP2 J231:CJNE A,#19,J2411 ACALL TEMP2 J2411:CJNE A,#20,J251 ACALL TEMP2 J251: CJNE A,#21,J242 ACALL TEMP3 J242:CJNE A,#22,J232 ACALL TEMP3 J232:CJNE A,#23,J233 ACALL TEMP3 J233:CJNE A,#24,J241 ACALL TEMP3 J241:CJNE A,#25,J25 ACALL TEMP3 J25:CJNE A,#26,J26 ACALL TEMP3 J26:CJNE A,#27,J27

ACALL TEMP3 J27:CJNE A,#28,J28 ACALL TEMP3 J28:CJNE A,#29,J29 ACALL TEMP3 J29:CJNE A,#30,J30 ACALL TEMP3 J30:CJNE A,#31,J31 ACALL TEMP3 J31:CJNE A,#32,J32 ACALL TEMP3 J32:CJNE A,#33,J33 ACALL TEMP3 J33:CJNE A,#34,J34 ACALL TEMP3 J34:CJNE A,#35,J35 ACALL TEMP3 J35:CJNE A,#36,J36 ACALL TEMP3 J36: CJNE A,#37,n33

ACALL TEMP3 n33:CJNE A,#38,n34 ACALL TEMP3 n34:CJNE A,#39,n35 ACALL TEMP3 n35:CJNE A,#40,n36 ACALL TEMP3 n36: ACALL TEMP3 AJMP S11 TEMP0: mov p3,#07fh AJMP START TEMP1: mov p3,#0bfh AJMP START TEMP2: mov p3,#00fh AJMP START TEMP3: mov p3,#0efh

LCDCLR: MOV A,#01H ACALL COMMAND RET ; DISPLAY DATA ON LCD DISPLAY: CLR A MOVC A,@A+DPTR JZ NEXT ACALL WRITE INC DPTR JMP DISPLAY NEXT: RET WRITE: MOV LCD,A SETB RS CLR RW SETB E acall delay1 CLR E ;CLEAR DISPLAY SCREEN

RET COMMAND: MOV LCD,A CLR RS CLR RW SETB E acall delay1 CLR E RET delay1: MOV R4,#255 AGAIN22: MOV R5,#150 BACK22: DJNZ R5,BACK22 DJNZ R4,AGAIN22 RET DELAY: MOV R6,#25 AGAIN: MOV R7,#2 BACK: DJNZ R7,BACK DJNZ R6,AGAIN

RET TABLE1: DB 'DIGI.TEMPERATURE',0 TABLE2: DB 'CURR. READING.',0 TABLE3: DB '',0 TABLE4: DB 'DEG.',0 end

You might also like