transormer protection k

Upload: khehracybercafe-sahnewal

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Transormer Protection k

    1/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

  • 8/3/2019 Transormer Protection k

    2/49

    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.

  • 8/3/2019 Transormer Protection k

    3/49

    COMPONENTS USED:

    ADC 0804

    OPAMP OP07

    TEMPERATURE SENSOR LM 335

    MICROCONTROLLER 89C51

    LCD 2 BY 16

    CRYSTAL 3.58 MHz

    RESISTOR

    10 K 11 Pc

    50 K 2 Pc VARIABLE

    1 K VARIABLE

    2.2K 1 Pc470 OHM 1Pc

    CAPACITOR

    22 PF 2 Pc

    10 MFD 1 PC

    PUSH TO ON SWITCH 2 PC.

    7805 REGULATOR

    STEP DOWN TRANSFORMER 9-0-9

    DIODE IN 4007( 4Pc)

    RELAY 4

    500 OHM VARIABLE RESISTOR OF FAN REGULATOR

  • 8/3/2019 Transormer Protection k

    4/49

    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.

  • 8/3/2019 Transormer Protection k

    5/49

    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 orheater 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.

  • 8/3/2019 Transormer Protection k

    6/49

    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

  • 8/3/2019 Transormer Protection k

    7/49

    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.

  • 8/3/2019 Transormer Protection k

    8/49

    DESCRIPTION OF POWER SUPPLY

    This circuit is a small +12 volts power supply, which is useful when

    experimenting with digital electronics. Small inexpensive walltransformers 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.

  • 8/3/2019 Transormer Protection k

    9/49

    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.

    1 2 3

    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)

  • 8/3/2019 Transormer Protection k

    10/49

    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 The scale factor is .01V/oC

    o The LM35 does not require any external calibration ortrimming 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.

  • 8/3/2019 Transormer Protection k

    11/49

    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.

    Ra = Vc /10-6

    Actually, it can range from 80 KW to 600 KW , but

    most just use 80 KW.

    o 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

  • 8/3/2019 Transormer Protection k

    12/49

    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

  • 8/3/2019 Transormer Protection k

    13/49

    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 11 Pc50 K 2 Pc VARIABLE

    1 K VARIABLE

    2.2K 1 Pc

    470 OHM 1Pc

    CAPACITOR

    22 PF 2 Pc

    10 MFD 1 PC

    PUSH TO ON SWITCH 2 PC.

    7805 REGULATOR

    STEP DOWN TRANSFORMER 9-0-9

    DIODE IN 4007( 4Pc)

    OPTO COUPLER MOC 3021

    TRIAC BT 136

  • 8/3/2019 Transormer Protection k

    14/49

    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. isconnected 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

  • 8/3/2019 Transormer Protection k

    15/49

    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

    http://www.mytutorialcafe.com/download/exp251.ziphttp://www.mytutorialcafe.com/download/ADC0804.pdfhttp://www.mytutorialcafe.com/download/exp251.ziphttp://www.mytutorialcafe.com/download/ADC0804.pdf
  • 8/3/2019 Transormer Protection k

    16/49

    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 = Ainc dptr ; DPTR = DPTR +1

    acall write_data;

    djnz r3,write1 ; R3 = R3-1,

    ret

    ;

    Init_lcd:

  • 8/3/2019 Transormer Protection k

    17/49

    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 = R1setb 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

  • 8/3/2019 Transormer Protection k

    18/49

    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 FeaturesCompatible 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 generator0V to 5V analog input voltage range with

    single 5V supply

    No zero adjust requiredOperates ratiometrically or with 5 Vdc, 2.5Vdc, or

    analog span adjusted voltage reference

  • 8/3/2019 Transormer Protection k

    19/49

  • 8/3/2019 Transormer Protection k

    20/49

    10

    DGND -

    Digital

    Ground

    11 DB7 - DataBit 7 (MSB)

    12DB6 - Data

    Bit 6

    13DB5 - Data

    Bit 5

    14DB4 - Data

    Bit 4

    15 DB3 - DataBit 3

    16DB2 - Data

    Bit 2

    17DB1 - Data

    Bit 1

    18DB0 - Data

    Bit 0 (LSB)

    19CLKR -

    Clock Reset

    20Vcc - PositiveSupply 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 willconnect 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

  • 8/3/2019 Transormer Protection k

    21/49

    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

    http://www.mytutorialcafe.com/download/ADC0804.pdfhttp://www.mytutorialcafe.com/download/ADC0804.pdf
  • 8/3/2019 Transormer Protection k

    22/49

    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 thenV resolution = 5/255 = 0.02 volt

    this is mean that ADC will respon each 0,02V increasing

    Vin

    (volt)D0 D1 D2 D3 D4 D5 D6 D7 Des

    0 0 0 0 0 0 0 0 0 0

    0.02 0 0 0 0 0 0 0 1 1

    0.04 0 0 0 0 0 0 1 0 2

    0.06 0 0 0 0 0 0 1 1 30.08 0 0 0 0 0 1 0 0 4

    0.10 0 0 0 0 0 1 0 1 5

    0.12 0 0 0 0 0 1 1 0 6

    : :

    5 1 1 1 1 1 1 1 1 255

    Stage 1)

    to operate this ADC, we use a free running mode, by connecting WR toINT

    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

  • 8/3/2019 Transormer Protection k

    23/49

    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, andthen 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)

    http://www.mytutorialcafe.com/download/exp251.ziphttp://www.mytutorialcafe.com/download/ADC0804.pdfhttp://www.mytutorialcafe.com/download/exp251.ziphttp://www.mytutorialcafe.com/download/ADC0804.pdf
  • 8/3/2019 Transormer Protection k

    24/49

    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,acall write_data

    ;

    mov r1,#0cbh

    call write_inst

    mov a,ones

    add a,#30h

  • 8/3/2019 Transormer Protection k

    25/49

    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,amov 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,

  • 8/3/2019 Transormer Protection k

    26/49

    ;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.1ret

    ;

    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.

  • 8/3/2019 Transormer Protection k

    27/49

    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 sourceresistance 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 outputlatch 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.

    http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#EOChttp://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201http://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#EOChttp://feynman.ee.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/ad_converter/#note%201
  • 8/3/2019 Transormer Protection k

    28/49

    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

    Number

    Label Input/Output Description

    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 bythe 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 6of 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 ofat 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

  • 8/3/2019 Transormer Protection k

    29/49

    conversion. Users can

    look for a rising edge

    transition.

    8 2-5 Output This is a bit of the digital

    converted output. Where2-8 is the LSB and 2 -1 is

    the MSB.

    9 Output

    Enable

    Input Control signal for FPGA

    that turns the output of

    the ADC on while high.

    Useful for handshaking.

    10 Clock Input Clock signal from FPGA.

    Max 1.2MHz.

    11 Vcc Input Power to the chip. Range4.5V to 6.0V DC.

    12 VREF(+) Input 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

    13 GND Input Ground. 0V

    14 2-7 Output This is a bit of the digital

    converted output. Where

    2-8 is the LSB and 2 -1 is

    the MSB.

    15 2-6 Output This is a bit of the digital

    converted output. Where

    2-8 is the LSB and 2 -1 is

    the MSB.

    16 VREF(-) Input Bottom rail of Referencevoltage. The voltage level

    that, when received as an

    input, will output

    "00000000" to the FPGA.

    Min Value -0.1V

    17 2-8 Output This is a bit of the digital

  • 8/3/2019 Transormer Protection k

    30/49

    converted output. 2-8 is

    the LSB.

    18 2-4 Output This is a bit of the digital

    converted output. Where

    2-8 is the LSB and 2 -1 isthe MSB.

    19 2-3 Output This is a bit of the digital

    converted output. Where

    2-8 is the LSB and 2 -1 is

    the MSB.

    20 2-2 Output This is a bit of the digital

    converted output. Where

    2-8 is the LSB and 2 -1 is

    the MSB.21 2-1 Output This is a bit of the digital

    converted output. 2 -1 is

    the MSB.

    22 ALE Input 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 pulsewidth 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

  • 8/3/2019 Transormer Protection k

    31/49

    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 P0lcd_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 bit p3.7

    key2 bit p3.6

    OUT1 bit p2.0

    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.

  • 8/3/2019 Transormer Protection k

    32/49

    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.

  • 8/3/2019 Transormer Protection k

    33/49

    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,#038hlcall 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,#083hlcall COMMAND_BYTE

    mov LCD_DATA,#'U'

    lcall DATA_BYTE

    mov LCD_DATA,#084h

    lcall COMMAND_BYTE

    mov LCD_DATA,#'R'

  • 8/3/2019 Transormer Protection k

    34/49

    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_BYTEmov 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.

  • 8/3/2019 Transormer Protection k

    35/49

    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 usinghex 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 a,dp2

    mov LCD_DATA,a

    lcall DATA_BYTE

    lcall DELAY41

    mov LCD_DATA

    lcall COMMAND_BYTE

    lcall DELAY41

    mov a,dp1mov LCD_DATA,a

    lcall DATA_BYTE

    lcall DELAY41

    mov LCD_DATA,

    lcall COMMAND_BYTE

    lcall DELAY41

  • 8/3/2019 Transormer Protection k

    36/49

    mov a,dp0

    mov LCD_DATA,a

    lcall DATA_BYTE

    lcall DELAY41

    mov a,cont

    mov b,#10d

    div ab

    mov dp4,b

    mov b,#10d

    div ab

    mov dp3,b

    mov dp5,a

    mov LCD_DATA

    lcall COMMAND_BYTE

    lcall DELAY41mov a,dp4

    mov LCD_DATA,a

    lcall DATA_BYTE

    lcall DELAY41

    mov LCD_DATA

    lcall COMMAND_BYTE

    lcall DELAY41

    mov a,dp3

    by this way we display the temperature on the lcd

    jb key1,nxt

    ljmp up

    nxt:

    jb key2,nxt1

    ljmp downnxt1:

    ljmp CMPOUT

  • 8/3/2019 Transormer Protection k

    37/49

    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.

  • 8/3/2019 Transormer Protection k

    38/49

    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

    http://www.ludhianaprojects.com/antifalling_collision%20robot.dochttp://www.8051projects.com/http://www.mcuprojects.com/http://www.atmel.com/http://www.datasheetarchieve.com/http://www.ludhianaprojects.com/antifalling_collision%20robot.dochttp://www.8051projects.com/http://www.mcuprojects.com/http://www.atmel.com/http://www.datasheetarchieve.com/
  • 8/3/2019 Transormer Protection k

    39/49

    START:

    MOV LCD,#00H

    mov p1,#0ffh

    setb INTR

    MOV A,#38H ;2*16 MATRIX

    ACALL COMMAND

    MOV A,#02 ;RETURN HOME

    ACALL COMMAND

    MOV A,#01 ;CLEAR DISPLAY SCREEN

    ACALL COMMAND

    MOV A,#0CH ;DISPLAY ON CURSOR OFF

    ACALL COMMAND

    MOV A,#80H ;MOVE CURSOR TO FIRST LINE SECOND

    COLOUMN

    ACALL COMMAND

    MOV DPTR,#TABLE1 ;DISPLAY ERP

    ACALL DISPLAY

    acall READING

  • 8/3/2019 Transormer Protection k

    40/49

    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

  • 8/3/2019 Transormer Protection k

    41/49

    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

  • 8/3/2019 Transormer Protection k

    42/49

    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

  • 8/3/2019 Transormer Protection k

    43/49

    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

  • 8/3/2019 Transormer Protection k

    44/49

    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

  • 8/3/2019 Transormer Protection k

    45/49

    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

  • 8/3/2019 Transormer Protection k

    46/49

    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

  • 8/3/2019 Transormer Protection k

    47/49

    LCDCLR:

    MOV A,#01H ;CLEAR DISPLAY SCREEN

    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

  • 8/3/2019 Transormer Protection k

    48/49

    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

  • 8/3/2019 Transormer Protection k

    49/49

    RET

    TABLE1: DB 'DIGI.TEMPERATURE',0

    TABLE2: DB 'CURR. READING.',0

    TABLE3: DB '',0

    TABLE4: DB 'DEG.',0

    end