cldt final

Upload: mayur-chandak

Post on 10-Apr-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 CLDT Final

    1/43

  • 8/8/2019 CLDT Final

    2/43

    2P a g e

    ACKNOWLEDGMENT

    We would take this opportunity to thank the almighty

    who has endowed us with intelligence so as to be able to

    undertake a project on Contact Less Digital Tachometer

    At the outset we express our heartfelt gratitude to our

    project guide Prof.Manisha Wajewho, guided us with her

    knowledge and experience our sole mean of guidance is

    Prof. Manisha Waje and our respected H.O.D Prof.Vijay

    Joshi. We also would like to thank our honorable principle

    Dr. D.D.Shah for their support. It would have been simply

    impossible for us to undertake this project without their

    help.

    We would also like to thank all staff members of our

    department for their kind support.

    -Mayur Chandak

    -Ketan Kalantri

    -Kapil Chandak

  • 8/8/2019 CLDT Final

    3/43

  • 8/8/2019 CLDT Final

    4/43

    4P a g e

    ABSTRACT

    Counting revolutions per minute (RPM) of motors

    determining the motor speed is essential in the field of industrial

    automation. It is useful especially for closed loop systems whereproper action can be taken in case the actual RPM deviates from

    the set RPM.

    So we have designed a simple microcontroller based

    system to measure RPM of any machine accurately without

    actually touching it. This system measures the RPM and shows

    on LCD the RPM of running motor or machine.

    Using proper transducer, first the rotations of the

    motor are converted into pulses. The generated pulses are

    counted by microcontroller for a fixed time (one second). The

    count is multiplied by factor to get the exact RPM and then

    displayed on the LCD.

  • 8/8/2019 CLDT Final

    5/43

    5P a g e

    INTRODUCTION

    TACHOMETER: Tachometer is a device which measures RPM(Rotational speed) of any rotating element.

    This is a portable tachometer, which has battery and can measure15,300rpms.

    As this is a digital tachometer, it displays the measured reading onan alphanumeric LCD, in rpms (revolution per min.).

    As the name implies, what makes this device special, is that it can

    very accurately measure the rotational speed of a shaft withouteven touching it. This is very interesting when making direct

    contact with the rotating shaft is not an option or will reduce the

    velocity of the shaft, giving faulty readings.

    The sensor used in this tachometer is an IR Proximity sensor,which produces pulses according to received IR rays & provides

    them as input to the microcontroller.

    Microcontroller counts these pulses according to algorithm built inas program and displays results on LCD.

    It can be used for speed measurements of various motors & shaftswhere very precise measure of rotational speed is required.

  • 8/8/2019 CLDT Final

    6/43

    6P a g e

    FEATURES

    Digital Readout.

    Speed displayed in rpm (Revolution per min.).

    Contactless measurement.

    Measures up to 15,300 rpm.

    Instantaneous measurement.

    Automatic DATA Hold Function.

    Portable, due to use of battery.

    Reliability due to use of microcontroller.

    No mechanical wear & tear, as no moving part.

    User friendly.

  • 8/8/2019 CLDT Final

    7/43

    7P a g e

    SPECIFICATIONS

    Measures up to 15,300 rpm.

    9v Battery.

    All ICs require 6v supply.

    Electrical & mechanical specifications of allcomponents are provided in the datasheets attached

    Herewith at the end of the report.

  • 8/8/2019 CLDT Final

    8/43

    8P a g e

    PRINCIPLE OFOPERATION:

    The idea behind most digital counting device, frequency meters

    and tachometers, is a micro-controller, used to count the pulses

    coming from a sensor or any other electronic device.

    In the case of this tachometer, the counted pluses will come fromIR proximity sensor, which will detect any reflective element

    passing in-front of it, and thus, will give an output pulse for each

    and every rotation of the shaft, as show in the picture. Those pulses

    will be fed to the microcontroller and counted.

  • 8/8/2019 CLDT Final

    9/43

    9P a g e

    BLOCK DIAGRAM:

    DISCRIPTION:IR Proximity Sensor:

    Here the proximity sensor used is IR proximitysensor.

    Thus it works on the principle of IR transmission &reception.

    When transmitted IR gets reflected back receiverdetects it & we get output.

    Microcontroller(8051):It is the most important part of the design,

    it processes the input obtained from IRproximity sensor

    & produces output which

    is displayed on the LCD.

    The P89C51RD2Hxx is a member of 8051 family,

    DIGITAL TACHOMETER

    Microcontroller

    P89C51RD2Hxx

    IR

    Proximity

    sensor

    Reflective

    strip

    Power Supply 6 V

    Alphanumeric

    LCD

  • 8/8/2019 CLDT Final

    10/43

    10P a g e

    produced by Phillips Semiconductor with 64Kb of on chip ROM & 1Kb of on chip

    RAM & comes with ISP (In System Programming) mode for easy programming. It

    also has 3 Timers & 7 Interrupts.

    With a few support chips and a program stored in memory, one can use theP89C51RD2Hxx-BASIC to sense, measure, and control processes, events, or

    conditions.

    LCD(Liquid Crystal Display):

    An alpha-numeric LCD module is used todisplay the results.

    The LCD we used here is 2 linealphanumeric Liquid Crystal Module that

    can display 2 lines of 16 characters each.Backlight is provided.

    It has ability to display numbers, characters & graphics .It displays speed &distance even at night.

    The 14 pins needed for control, the main controller is built in the module.

    POWER SUPPLY:

    As it is a portable device, power to the whole circuitry can be provided with9V battery supply.

    The unregulated 9V power of battery is regulated using 7805fixed IC regulator.

    The output of the regulator is then provided to each component ofmain design.

  • 8/8/2019 CLDT Final

    11/43

    11P a g e

    MODULE WISE DESIGN

    1.LOW RANGE IR PROXIMITY SENSOR:

    Principle of Operation:An IR proximity sensor works by applying a voltage to a pair of IR light emitting

    diodes (LEDs) which in turn, emit infrared light. This light propagates through the air

    and once it hits an object it is reflected back towards the sensor. If the object is close, the

    reflected light will be stronger than if the object is further away. The sensing unit (for

    this experiment a TSOP 1738 will be used), in the form of an integrated circuit (IC),

    detects the reflected infrared light, and if its intensity is strong enough, the circuit

    becomes active. When the sensing unit becomes active, it sends a corresponding signal

    to the output terminal which can then be used to activate any number of devices. For the

    purpose of this exercise, a small green LED will turn on when the sensor becomes active.

    As shown in above block diagram Proximity sensor consist of three parts namely :

    1)IR Transmitter2)IR Receiver &

    3)Pulse Generator

    1) IR Transmitter:

    It simply consist of an Simple IR Transmitter LED, which is

    biased through a resistor R, which controls its intensity.

    2) IR Receiver:

    Similar to IR transmitter it also simply consist of an IR

    Receiver Module i.e. TSOP 1738 which also biased similar to IR

    Transmitter.

    IR

    Trans.

    IR

    Receiv

    Pulse

    Generator

  • 8/8/2019 CLDT Final

    12/43

    12P a g e

    3) Pulse Generator:

    The pulse generator consist ofTimer IC NE555, which is

    biased in monostable multivibrator mode & which is triggered

    when ve pulse is applied at pin2, which is pulled high with a

    resistor. The IR Transmitter module is connected to the pin2 of

    timer. When IR light falls on the Receiver module pin2 isshorted to ground via the Receiver module & thus Timer is

    Triggered generating a +ve pulse at

    the output (pin 3).

    IC NE555 Pin Description

    Nr. Name Purpose

    1 GND Ground, low level (0 V)

    2 TRIG A short pulse high-to-low on the trigger starts the timer

    3 OUT During a timing interval, the output stays at +VCC

    4 RESET A timing interval can be interrupted by applying a reset pulse to low (0 V)

    5 CTRL Control voltage allows access to the internal voltage divider (2/3 VCC)

    6 THR The threshold at which the interval ends (it ends if the voltage at THR is at least 2/3

    7 DIS Connected to a capacitor whose discharge time will influence the timing interval

    8 V+, The positive supply voltage which must be between 3 and 15 V

  • 8/8/2019 CLDT Final

    13/43

  • 8/8/2019 CLDT Final

    14/43

    14P a g e

    16-bit address bus - It can access 216 memory locations - 64 KB (65536 locations)each of RAM and ROM

    On-chip RAM 128/256/512bytes (data memory) On-chip ROM - 4k/16k/32k/64k Byte (program memory) Fourbyte bi-directional input/output port

    UART (serial port) Two/Three 16-bit Counter/timers Two-level interrupt priority Power saving mode

    Common features included in modern 8051 based microcontrollers include built-in reset

    timers with brown-out detection, on-chip oscillators, self-programmable Flash ROMprogram

    memory, bootloader code in ROM, EEPROM non-volatile data storage, IC, SPI, and USB host

    interfaces, CAN orLIN bus, PWM generators, analog

    comparators, A/Dand D/A converters, RTCs, extra counters and timers, in-circuit debugging

    facilities, more interrupt sources, and extra power saving modes.

    MEMORY ARCHITECTURE

    The 8051 has four distinct types of memory - internal RAM, special function registers,

    program memory, and external data memory.

    Internal RAM (IRAM) is located from address 0 to address 0xFF. IRAM from 0x00 to

    0x7F can be accessed directly, and the bytes from 0x20 to 0x3F are also bit-addressable. IRAM

    from 0x80 to 0xFF must be accessed indirectly, using the @R0 or @R1 syntax, with the address

    to access loaded in R0 or R1.

    Special function registers (SFR) are located from address 0x80 to 0xFF, and are accessed

    directly using the same instructions as for the lower half of IRAM. Some of the SFR's are also

    bit-addressable.

    Program memory (PMEM, though less common in usage than IRAM and XRAM) is

    located starting at address 0. It may be on- or off-chip, depending on the particular model of chip

    being used. Program memory is read-only, though some variants of the 8051 use on-chip flash

    memory and provide a method of re-programming the memory in-system or in-application.

    Aside from storing code, program memory can also store tables of constants that can be accessed

    by MOVC A, @DPTR, using the 16-bit special function registerDPTR.

    External data memory (XRAM) also starts at address 0. It can also be on- or off-chip;

    what makes it "external" is that it must be accessed using the MOVX (Move eXternal)

  • 8/8/2019 CLDT Final

    15/43

    15P a g e

    instruction. Many variants of the 8051 include the standard 256 bytes of IRAM plus a few KB of

    XRAM on the chip. If more XRAM is required by an application, the internal XRAM can be

    disabled, and all MOVX instructions will fetch from the external bus.

    BLOCK DIAGRAM OF INTERNAL

    ARCHITECTURE OF P89C51RD2HXX

  • 8/8/2019 CLDT Final

    16/43

    16P a g e

    Instruction setThe 8051 instruction set offers several addressing modes, including

    Direct register, using ACC (the accumulator) and R0-R7 Direct memory, which access the internal RAM or the SFR's, depending on

    the address

    Indirect memory, using R0, R1, orDPTR to hold the memory address. Theinstruction used may vary to access internal RAM, external RAM, or program

    memory.

    Individual bits of a range of IRAM and some of the SFR's

    Many of the operations allow any addressing mode for the source or the

    destination, for example, MOV 020h, 03fh will copy the value in memory location

    0x3f in the internal RAM to the memory location 0x20, also in internal RAM.

    Because the 8051 is an accumulator-based architecture, all arithmetic

    operations must use the accumulator, e.g. ADD A, 020h will add the value in

    memory location 0x20 in the internal RAM to the accumulator.

    It is important to note that one does not need to master these instructions in

    order to program the 8051. With the availability of good quality C compilers,

    including open sourceSDCC, virtually all programs can be written in C high-level

    language.

    LCD(LIQUID CRYSTAL DISPLAY):

    A liquid crystal display (LCD) is a thin,

    flat panel used for electronically displaying

    information such as text, images, and moving

    pictures. Its uses include monitors for

    computers, televisions, instrument panels, and

    other devices ranging from aircraft cockpit

    displays, to every-day consumer devices such as video players, gaming devices,

    clocks, watches, calculators, and telephones. Among its major features are itslightweight construction, its portability, and its ability to be produced in much

    larger screen sizes than are practical for the construction of cathode ray tube (CRT)

    display technology. Its low electrical power consumption enables it to be used in

    battery-powered electronic equipment. It is an electronically-modulated optical

    device made up of any number of pixels filled with liquid crystals and arrayed in

    front of a light source (backlight) or reflector to produce images in color or

  • 8/8/2019 CLDT Final

    17/43

  • 8/8/2019 CLDT Final

    18/43

    18P a g e

    measurements make comparison difficult.[2]

    Refresh rate: The number of times per second in which the monitor draws the

    data it is being given. Since activated LCD pixels do not flash on/off between

    frames, LCD monitors exhibit no refresh-induced flicker, no matter how low

    the refresh rate.[3]

    High-end LCD televisions now feature up to 240 Hz refresh

    rate, which allows advanced digital processing to insert additional interpolatedframes to smooth up motion, especially with lower-framerate 24p material like

    the Blu-ray disc. However, such high refresh rates may not be supported by

    pixel response times, and additional processing can introduce considerable

    input lag.

    Matrix type: Active TFT or Passive.

    Viewing angle: (coll., more specifically known as viewing direction).

    Color support: How many types of colors are supported (coll., more specifically

    known as colorgamut).

    Brightness: The amount of light emitted from the display (coll., more

    specifically known as luminance).

    Contrast ratio: The ratio of the intensity of the brightest bright to the darkest

    dark.

    Display applicationsThe applications for the LCDs are endless, Some of them are:

    Television and digital television Liquid crystal display television (LCD TV) Digital signage LCD projector Computer monitor Aircraft instrumentation displays (see glass cockpit) HD44780 Character LCD, a widely accepted protocol for small LCDs Various medical equipment.

    Mobile Phone Displays.

  • 8/8/2019 CLDT Final

    19/43

    19P a g e

    CIRCUIT DIAGRAM

    The circuit is divide into two parts :

    1) MAIN CIRCUIT

    2) SENSOR CIRCUIT(Proximity sensor)

  • 8/8/2019 CLDT Final

    20/43

    20P a g e

    MAIN CIRCUIT

  • 8/8/2019 CLDT Final

    21/43

    21P a g e

    SENSORCIRCUIT

  • 8/8/2019 CLDT Final

    22/43

  • 8/8/2019 CLDT Final

    23/43

    23P a g e

    B) SENSOR CIRCUIT:

    Sensor circuit comprises of three parts, Transmitter , Receiver &

    pulse generator.

    Transmitter circuit consist of an IR transmitter LED which is

    simply forward biased through resistor R5. It emits IR beam of moderateintensity continuously.

    As shown in above the Receiver & Pulse Generator circuit

    comprises of timer NE555, which is configured as a monostablemultiviabratorwhose time period depends upon combination of resistor

    R1 & capacitorC2, given by the equation:

    Where we selected R1= 820ohm & C2 = 100nF

    Therefore t = 1.1(820)(100 E-9)

    = 0.902 sec. 1 sec.

    Thus we generate a pulse of 1 sec. each time NE555 timer is

    triggered.

    Here the trigger pin 2 of timer 555 is pulled high through resistor

    R6. The IR Receiver Module TSOP1738 is connected along with the

    resistor R6 such that when the IR beam reflected by the refleactor falls

    on IR Receiver, pin-2 goes low to trigger timer NE555. The output from

    the pin-3 of timer 555 is inverted by the transitor Q1 and taken out as

    output for the main circuit. This output is fed to the pin P3.4 ofmicrocontroller P89C51RD2Hxx for counting.

  • 8/8/2019 CLDT Final

    24/43

    24P a g e

    LISTOFCOMPONENTS

    Sr no. Name of Component Quantity

    1. Microcontroller P89C51RD2 1

    2. 16 by 2 LCD 13. IR Receiver 1

    4. IR Transmitter 1

    5. Crystal-11.0592 MHz 1

    6. Push Button 3

    7. IC Regulator-7806, 7805 2

    8. NE555

    9. Transistor-2N2222 1

    10. LEDs 3

    11. Battery 9Volt 1

    12. Resistors -150 , 220 ,470, 820, 1k,10k.

    10

    13. 1K Resistor Bank 1

    14. Capacitors 33pF, 0.1uF,1uF, 100uF

    10

    15. Connectors & wires 1m

    16. IC ZIP 1

    17. PCBs 2

  • 8/8/2019 CLDT Final

    25/43

  • 8/8/2019 CLDT Final

    26/43

  • 8/8/2019 CLDT Final

    27/43

    27P a g e

    SENSOR CIRCUIT PCB

    Sensor Circuit PCB Component Layout

  • 8/8/2019 CLDT Final

    28/43

    28P a g e

    SOFTWARE SECTION

    The software i.e. program for counting RPM and displaying it on LCD is

    written in Assembly Language of 8051 microcontroller. It is complied &

    assembled in KEIL VISION.3 compiler & hex file is created. The Hex file is

    downloaded in the microcontroller IC with help ofFLASH MAGICsoftware.

    Algorithm & flow chart of the program is as given below:

    ALGORITHM:

    1. Equate (assign each pin of microcontroller the corresponding name.)

    2. Start

    3. Define interrupt routine

    4. Start main program

    5. Make LED2 on & LED2 off

    6. Initialize LCD by proper commands

    7. Display MSG0: RPM counter

    8. Display MSG1: TE Electronics

    9. Display MSG2:W

    ant to Count

    10.Make P2.0 input port i.e. set P2.0 for switch input

    11.Set Timer-0 as counter in mode 2(set TMOD=00000110B)

    12.Make P3.4 as input port for counter input from sensor

    13.Scan the switch until it is pressed (low to high pulse at P2.0)

    14.When switch is pressed, start counter (Timer 0), make LED1 on & LED2 off.

    15.Display MSG3: Counting RPM

    16.Wait for 1 sec.

    17.Get contents of TL0 copied in Accumulator

    18.Stop counter, make LED2 on & LED1 off.

  • 8/8/2019 CLDT Final

    29/43

  • 8/8/2019 CLDT Final

    30/43

    30P a g e

    FLOWCHART

    No

    Yes

    Start

    Define interrupt vector

    If timer over flows call subroutine OUT

    Start Main Pro ram

    Make LED1 off & LED2 on

    Initialize LCD

    Dis la Messa es from MSG0 to MSG2

    Make P2.0 & P3.4 as in ut ort

    Set Timer-0 as counter in Mode-2

    Scan the switch at ort P2.1

    Is switch

    pressed ?

    Start Counter Timer0 A

  • 8/8/2019 CLDT Final

    31/43

    31P a g e

    Make LED1 on & LED2 off

    Wait for 1sec

    Co contents of TL0 counter to A

    Is A=0?

    Make LED1 off & LED2 on

    Call subroutine OUT

    Convert contents in A in BCD & save.

    Multi l each di it b 6

    Convert each di it in ASCII format & save.

    Dis la MSG5 on LCD line 1

    Dis la results saved on LCD line 2

    Sto

    A

  • 8/8/2019 CLDT Final

    32/43

    32P a g e

    ASM CODE FOR COUNTING & DISPLAYING RPM

    DB0 BIT P1.0 ;Equate DB0 By P1.0

    DB1 BIT P1.1 ;Equate DB1 By P1.1DB2 BIT P1.2 ;Equate DB2 By P1.2

    DB3 BIT P1.3 ;Equate DB3 By P1.3

    DB4 BIT P1.4 ;Equate DB4 By P1.4DB5 BIT P1.5 ;Equate DB5 By P1.5

    DB6 BIT P1.6 ;Equate DB6 By P1.6

    DB7 BIT P1.7 ;Equate DB7 By P1.7

    EN BIT P3.1 ;Equate P3.1By Enable of LCD

    RS BIT P3.7 ;Equate RS By P3.7

    RW BIT P3.6 ;EquateWrite of LCD By P3.6

    DAT EQU P1 ;Equate Port-1 By data I/p of LCD

    SW BIT P2.0 ;Equate P2.0 by start button

    LED1 BIT P2.1 ;Equate P2.1 by LED1LED2 BIT P2.6 ;Equate P2.6 by LED2

    TIM0 BIT P3.4 ;Equate P3.4 by T0(counter input)

    ORG0000H ;Start Execution

    LJMP MAIN ;Jump to MAIN

    ORG000BH ;Timer 0 interrupt vector table

    LJMP OUT ;Jump to OUT

    RETI

    ORG0030H ;Main Program

    MAIN:

    SETB LED2 ;Make LED2 onCLR LED1 ;Make LED1 off

    ;Initialize LCDMOV DPTR,#MYCOM

    C1: CLRA

    MOVC A,@A+DPTR

    JZNEXT0

  • 8/8/2019 CLDT Final

    33/43

    33P a g e

    LCALL COMMAND ;Call command subroutine

    INC DPTR

    SJMP C1

    NEXT0:NOP

    MOV DPTR,#MSG0 ;Point DPTR to MSG0

    LCALL LCD_MSG ;Write MSG0 to LCD

    LCALL DELAY1

    LCALL CLEAR_LCD ;Clear LCD

    MOV DPTR,#MSG1 ;Point DPTR to MSG1

    LCALL LCD_MSG ;Write MSG1 to LCD

    LCALL DELAY1

    LCALL CLEAR_LCD ;Clear LCD

    MOV DPTR,#MSG2 ;Point DPTR to MSG2

    LCALL LCD_MSG ;Write MSG2 to LCD

    LCALL DELAY1SETB SW ;Make P2.0 as input bit(Switch)

    MOV TMOD,#00000110B ;Set Timer 0 as counter in mode 2

    SETB TIM0 ;Make TIM0 (P3.4) input port

    MOV TH0,#00H

    MOV TL0,#00H

    SETB EA ;Enable interrupt control

    SETB ET0 ;Enable Timer 0 overflow interrupt

    START:JB SW,START ;Stay in loop, until switch is pressed(SW=1)

    SETB LED1 ;Make LED1 on

    CLRLED2 ;Make LED2 off

    MOV TL0,#00H ;Load TL0 with 00

    SETB TR0 ;Turn on Counter

    LCALL CLEAR_LCD ;Clear LCD

    MOV DPTR,#MSG3 ;Point DPTR to MSG3

    LCALL LCD_MSG ;Write MSG3 to LCD

    LCALL DELAY1 ;Wait for 1 sec.

    MOV A,TL0 ;Check counter & copy it into Acc.

    JNZNEXT5

    DISP: CLRLED1 ;Display MSG 6 if A=0

    LCALL OUT

    CLRTR0 ;Stop counter

    SETB LED2 ;

  • 8/8/2019 CLDT Final

    34/43

    34P a g e

    LCALL DELAY1 ;

    NOP ;LCALLDELAY1 ;

    NOP ;

    LCALL DELAY1 ;Wait for 5 seconds

    NOP ;

    LCALLDELAY1 ;NOP ;

    LCALL DELAY1 ;

    NOP ;

    LJMP MAIN ;Jump to main again

    NEXT5: NOPCLRTR0 ;Stop counter

    ;Convert Counted result in ASCII Code

    MOV B,#010DIV AB

    MOV R3,B ;Save least significant digit in R3

    MOV B,#010

    DIV AB

    MOV R2,B ;Save second digit in R2

    MOV R1,A ;Save most significant digit in R1

    ;Multiply by 6 & Store result in R0(MSB), R1(second digit), R2(third digit),--

    ; --R3(LSB);Multiply LSB by 6MOV A,R3

    MOV B,#06

    MUL AB

    MOV B,#010

    DIV AB

    MOV R3,B

    MOV R4,A

    ;Multiply Second digit by 6MOV A,R2

    MOV B,#06

    MUL AB

    MOV B,#010

    DIV AB

    MOV R5,A

  • 8/8/2019 CLDT Final

    35/43

    35P a g e

    MOV A,B

    ADD A,R4

    MOV R2,A

    CJNE R2,#09,NOT_EQ1

    SJMPNEXT

    NOT_EQ1:JCNEXT

    MOV A,#01

    ADD A,R5

    MOV R5,A

    MOV A,R2

    SUBB A,#0AH

    MOV R2,A

    NEXT:NOP

    ;Multiply MSB by 6MOV A,R1

    MOV B,#06

    MUL AB

    MOV B,#010

    DIV AB

    MOV R0,A

    MOV A,B

    ADD A,R5MOV R1,A

    CJNE R1,#09,NOT_EQ2

    SJMPNEXT1

    NOT_EQ2: JCNEXT1

    MOV A,#01

    ADD A,R0

    MOV R0,A

    MOV A,R1

    SUBB A,#0AH

    MOV R1,A

    NEXT1: NOP

    MOV A,R3

    ADD A,#30H

  • 8/8/2019 CLDT Final

    36/43

  • 8/8/2019 CLDT Final

    37/43

    37P a g e

    COMMAND:

    LCALLWAIT_LCD

    MOV DAT,A

    CLRRS

    CLRRW

    SETB EN

    LCALL DELAYCLREN

    RET

    WAIT_LCD:

    SETB DB7 ; Make P1.7 input port

    CLRRS ;Its a command

    SETB RW ;Its a read command

    ;Read Command register and check busy flag

    BACK: CLREN

    LCALL DELAYSETB EN

    JB DB7,BACK

    LCALL DELAY

    CLREN

    CLRRW

    RET

    WRITE_DATA:

    LCALLWAIT_LCD

    MOV DAT,A

    SETB RS

    CLRRW

    SETB EN ;Clock out command to LCD

    CLREN ;Finish command

    RET

    LCD_MSG:

    CLRA ;Clear Index

    MOVC A,@A+DPTR ;Get byte pointed by DPTRJZ LCD_MSG9 ;Return if found the zero (end of string)

    LCALLWRITE_DATA ;It was data, write it to LCD

    LCALL DELAY ;Give LCD some time

    INC DPTR ;Point to the next byte

    SJMP LCD_MSG ;Go get next byte from string

    LCD_MSG9: RET ;Return to Caller

  • 8/8/2019 CLDT Final

    38/43

    38P a g e

    CLEAR_LCD:

    LCALLWAIT_LCD

    MOV DAT,#01H

    CLRRS

    CLRRW

    SETB EN

    LCALL DELAYCLREN

    RET

    DELAY1: ;1 sec. delay subroutineMOV R7,#20

    L1: MOV R6,#180

    L2: MOV R5,#255

    L3: DJNZ R5,L3

    DJNZ R6,L2

    DJNZ R7,L1

    RET

    DELAY:MOV R6,#10

    D1: MOV R7,#255

    D2: DJNZ R7,D2

    DJNZ R6,D1

    RET

    ORG400H

    MYCOM: DB 38H, 0EH, 01, 06, 84H, 0 ;Commands & Null

    MSG0: DB "RPM Counter", 0 ; data and null

    MSG1: DB "TE Electronics", 0 ; data and null

    MSG2: DB "Want To Count ", 0 ; data and null

    MSG3: DB "Counting RPM", 0 ; data and null

    MSG4: DB "Counting Finished", 0 ; data and null

    MSG5: DB "RPM of Machine is", 0 ; data and null

    MSG6: DB "RPM out of range", 0 ; data and null

    END

  • 8/8/2019 CLDT Final

    39/43

    39P a g e

    APPLICATIONS:

    1.In automobiles, trucks, tractors and aircraft:

    Tachometers or rev counters on automobiles, aircraft, and other vehicles show

    the rate of rotation of the engine's crankshaft, and typically have markings

    indicating a safe range of rotation speeds. This can assist the driver in selectingappropriate throttle and gear settings for the driving conditions. Prolonged use at

    high speeds may cause inadequate lubrication, overheating (exceeding capability

    of the cooling system), exceeding speed capability of sub-parts of the engine (for

    example spring retracted valves) thus causing excessive wear or permanent

    damage or failure of engines. This is more applicable to manual transmissions than

    to automatics. On analogue tachometers, speeds above maximum safe operating

    speed are typically indicated by an area of the gauge marked in red, giving rise to

    the expression of "redlining" an engine revving the engine up to the maximum

    safe limit.2.Hours meters:When used in stationary engines or vehicles where an odometerwould not give

    an accurate reading of the vehicle's use (such as in aircraft,boats ortractors),

    tachometers frequently incorporate a display showing the total number of hours the

    engine has run. Service intervals are given and measured in hours.

    3.Traffic Engineering:Tachometers are used to estimate traffic speed and volume (flow). A vehicle

    is equipped with the sensor and conducts "tach runs" which record the traffic data.These data are a substitute or complement to loop detectordata. To get statistically

    significant results usually requires a fairly high number of runs, and bias is

    introduced by the time of day, day of week, and the season. However, because of

    the expense, spacing (a lower density of loop detectors diminishes data accuracy),

    and relatively low reliability of loop detectors (often 30% or more are out of

    service at any give time), tach runs remain a common practice.

    4.In trains and light rail vehicles:Speed sensing devices, termed variously "wheel impulse generators" (WIG),

    speed probes, or tachometers are used extensively in rail vehicles. Common typesinclude opto-isolatorslotted disk sensors[1]

    and Hall effect sensors.

    5.In analogue audio recording:In analogue audio recording, a tachometer is a device that measures the speed

    ofaudiotape as it passes across the head. On most audio tape recorders the

    tachometer (or simply "tach") is a relatively large spindle near the ERP head stack,

    isolated from the feed and take-up spindles by tension idlers.

  • 8/8/2019 CLDT Final

    40/43

    40P a g e

    RESULTSAND CONCLUSION

    Thus we successfully implemented CONTACT

    LESS DIGITAL TACHOMETER using

    microcontrollerP89C51RD2Hxx.

    As far as hardware testing is concerned, PCB is

    working properly. Each IC is performing the functions

    properly.

    The assembly language program written for the project is working without errors. RPM are counted

    properly & are displayed on the display within the range

    given for each as per the specification. The RPM are

    counted precisely with resolution of60/1 RPM. The most

    accurate measurements are taken when the sensor is

    placed at proper distance from the motor shaft.

    During actual implementation of the project on the

    motor, proper mounting of sensors on the bike is very

    important without causing damage to the circuit.

    In our testing we discovered how hard it is to design

    a tachometer that would be effective for a wide range of

    machines with wide range of RPMs.

  • 8/8/2019 CLDT Final

    41/43

    41P a g e

    Bill OFMaterials

    Sr no. Name of Component Quantity Cost PerUnit (Rs)

    Total Cost

    (Rs)

    1. Microcontroller P89C51RD2 1 450 450

    2. 16 by 2 LCD 1 120 120

    3. IR Receiver 1 25 25

    4. IR Transmitter 1 12 12

    5. Crystal-11.0592 MHz 1 6 6

    6. Push Button 3 5 15

    7. IC Regulator-7806, 7805 2 7 148. NE555 1 10

    9. Transistor-2N2222 1 3 3

    10. LEDs 3 3 9

    11. Battery 9Volt 1 25 25

    12. Resistors -150 , 220 ,470, 820, 1k,10k.

    10 0.20 2

    13. 1K Resistor Bank 1 5 514. Capacitors 33pF, 0.1uF,

    1uF, 100uF

    10 2 20

    15. Connectors & wires 1m 4 4

    16. IC ZIP 1 45 45

    17. PCBs 2 75 150

    TOTAL COST 932

  • 8/8/2019 CLDT Final

    42/43

    42P a g e

    REFRENCES

    1.8051 microcontroller - Kenneth Ayala

    2.89C51 data book - ATMEL manual

    3.8051 microcontroller - Mazidi

    4.Magazines - Electronics For You

    - Nut & Volts

    5.Datasheets - Atmel ,Fairchild

    6.Internet

    a.www.electronicsforyou.com

    b.www.alldatasheets.comc.www.ustr.net

    d.www.iplogic.com

  • 8/8/2019 CLDT Final

    43/43