Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Tachometer using microcontroller

By Dimpal Kumar Kalita January 10, 2013

 

Here is a trial of building a tachometer using AT89S52 Microcontroller. This is a digital tachometer which works using infrared rays. The tachometer designed here can measure rotational speed up to 4200 rpm which is sufficient for small scale use. If the speed goes beyond 4200 rpm, it gives a message on the display screen as “OUT OF RANGE”.

 
COMPONENTS:
 
1.      AT89S52 Microcontroller
2.      11.0592 MHz Crystal
3.      16*2 Alphanumeric Display Screen
4.      5V Power Supply
5.      Speed Sensor Module
 
Speed sensor module:
 
The speed sensor module is a completely home-made module to detect speed of a rotational body. The picture of the module that I have made is shown below. The function of this module is that it converts the speed of a rotational body to pulses. These pulses are fed to a microcontroller. The microcontroller counts them and displays them with a unit of rpm.
 
The components required to make the module are:
1.      Wheel of an optical mouse
2.      Plywood
3.      Screw bearing
4.      Steel rod (1 mm diameter, 10 cm long)
5.      Infrared Transmitter LED
6.      Infrared Receiver (TSOP1738)
7.      Capacitor (47uF)
8.      Resistor (100R)
 
Take out the wheel of a damaged optical mouse and make a hole at the center of the wheel. Put the steel rod at the hole and glue it tightly so that the rod and the wheel rotate simultaneously. Make the plywood frame as shown in figure and screw the screw bearings on both sides so that the rod with the wheel can be mounted. After mounting the rod (with the wheel) on the screw bearings, try rotating the wheel with your finger. While rotating, the rod should have a minimum friction with the screw bearings. This will help measuring the exact speed. Then make the connections of the Infrared Transmitter and the Infrared Receiver as shown in the circuit diagram. Place the Infrared Transmitter on one side of the wheel and the Infrared Receiver on another side both facing each other. Here is a top view of the arrangement.
 
Don’t forget to make a hole on the wheel as shown in the picture below. It is extremely important. The hole will allow passing the infrared rays from the infrared transmitter to the infrared receiver.
 
Now you have your speed sensor module ready. This module should have four wires coming out of it. They are:- +5V Power Supply, Power Ground, wire connecting the  –ve terminal of the Infrared Transmitter and the wire connecting the output terminal of the TSOP1738 Infrared Receiver.
Let us now discuss how to connect this above made module to the microcontroller.
CIRCUIT DIAGRAM:
The circuit diagram should be connected as shown in the Circuit Diagram tab. The 5V Power and Ground of the speed sensor module should be connected to the Power supply to the circuit. The –ve terminal of the infrared transmitter and the output terminal of the infrared receiver should be connected to the specified pins of the microcontroller (see circuit diagram).
 

 OPERATION & PROGRAM STRUCTURE

OPERATION:               
 
OPERATION.jpg
 
To measure speed of a rotational body, you need to hold the speed sensor module by its frame and make contact of the wheel with the rotating body. Soon the wheel will start rotating at the speed of the rotational body. Holding the module in that position, press the reset button of the microcontroller. The speed of the rotational body will be displayed on the LCD screen.
 
Now let us go inside the process and discover what happens during the whole process. When the wheel of the module has no contact with any rotating body, it remains in a still position. So the infrared rays coming out from the transmitter are restricted by the wheel from entering the Infrared receiver. So the output of the infrared receiver is also still and not pulsating. The output of the infrared receiver is connected to COUNTER1 of the microcontroller and it can count only pulsating signals (not a still signal). So no pulses are generated by the infrared receiver and consequently no counting occurs. The display shows 00 rpm in this position.
When the user makes contact of the wheel of the module with a rotational body, the wheel starts rotating at the speed of the rotational body and the hole in the wheel will allow infrared rays to pass from the transmitter to the receiver once in a rotation. This will form a pulsating output of the infrared receiver and the counter in the microcontroller now can count the pulse. As these pulses are proportional to the speed, the counted pulse will represent the speed of the rotational body. That is what happens during the process.   
 
PROGRAM STRUCTURE:
 
The program first sets the TIMER2 of the microcontroller to generate 38 KHz frequency. This frequency is then supplied to the Infrared Transmitter so that the Infrared Transmitter LED sends out infrared rays at the same frequency. It is because the TSOP1738 Infrared Receiver can receive infrared rays of 38 KHz only.
The program then starts the COUNTER1 of the microcontroller for one second so that the pulses coming from the Infrared Receiver can be counted. After one second, the counter is stopped again. It is because of the fact that a tachometer generally gives out reading with a unit of ROTATION PER MINUTE (RPM). So for the process someone needs to hold the speed sensor module in contact with a rotational body for a whole minute and then the counted value to be displayed with a unit of RPM. This process will be too tedious. But if the number of rotation in one second can be counted then multiplying the value with 60 will give rotation in one minute. So the counter is opened for one second by the program and the pulses are counted during the second. The counted value is then multiplied by 60 and then the final value is displayed on the LCD screen with a unit of RPM.
It is to mention here that though the words PULSE and ROTATION are used alternately during the description, they actually mean the same. Because for one rotation of the wheel, the hole in the wheel will allow the rays of the infrared transmitter to pass to the receiver once and consequently one pulse will be formed by the receiver. So the total numbers of pulses denote total number of rotation.
 

Video

 
Video

 

 

 

Project Source Code

###


ORG 00H

HARDWARE_CONNECTION:

                        LCD_DATA  EQU P2

                        LCD_RS    EQU P3.6

                        LCD_EN    EQU P3.7                       

                       

SOFTWARE_VARIABLE:             

                        TEMPVAR_1 EQU R0

                        TEMPVAR_2 EQU R1

                        TEMPVAR_3 EQU R2

                        TEMPVAR_4 EQU R3

                        TEMPVAR_5 EQU R4

                        TEMPVAR_6 EQU R5

                        TEMPVAR_7 EQU R6

                        TEMPVAR_8 EQU R7

                       

LCD_INITIALIZATION:                

                        MOV A,#38H                                                                        

                        ACALL LCD_COMND_WRT

                        MOV A,#0CH

                        ACALL LCD_COMND_WRT

                        MOV A,#01H

                        ACALL LCD_COMND_WRT                    

                        MOV A,#80H                                                               

                        ACALL LCD_COMND_WRT

 

CLOCK:

                        MOV 0C9H,#02H  ;T2MOD

                        MOV 0CAH,#0B7H ;RCAP2L

                        MOV 0CBH,#0FFH ;RCAP2H

                        MOV 0CCH,#0B7H ;TL2        

                        MOV 0CDH,#0FFH ;TH2

                        MOV 0C8H,#04H  ;T2CON

 

ORIGIN:

                        MOV TH1,#00H

                        MOV TMOD,#60H

                        SETB TR1                 

                        ACALL DELAY_ONESEC

                        CLR TR1

                        MOV A,TL1

 

CMPR_0: CJNE A,#00H,CMPR_1

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_1: CJNE A,#01H,CMPR_2

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_2: CJNE A,#02H,CMPR_3

                        MOV A,#01H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_3: CJNE A,#03H,CMPR_4

                        MOV A,#01H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_4: CJNE A,#04H,CMPR_5

                        MOV A,#02H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_5: CJNE A,#05H,CMPR_6

                        MOV A,#03H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_6: CJNE A,#06H,CMPR_7

                        MOV A,#03H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_7: CJNE A,#07H,CMPR_8

                        MOV A,#04H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_8: CJNE A,#08H,CMPR_9

                        MOV A,#04H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_9: CJNE A,#09H,CMPR_10

                        MOV A,#05H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_10: CJNE A,#0AH,CMPR_11

                        MOV A,#06H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_11: CJNE A,#0BH,CMPR_12

                        MOV A,#06H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_12: CJNE A,#0CH,CMPR_13

                        MOV A,#07H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_13: CJNE A,#0DH,CMPR_14

                        MOV A,#07H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_14: CJNE A,#0EH,CMPR_15

                        MOV A,#08H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_15: CJNE A,#0FH,CMPR_16

                        MOV A,#09H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_16: CJNE A,#10H,CMPR_17

                        MOV A,#09H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_17: CJNE A,#11H,CMPR_18

                        MOV A,#10H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_18: CJNE A,#12H,CMPR_19

                        MOV A,#10H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_19: CJNE A,#13H,CMPR_20

                        MOV A,#11H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_20: CJNE A,#14H,CMPR_21

                        MOV A,#12H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_21: CJNE A,#15H,CMPR_22

                        MOV A,#12H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_22: CJNE A,#16H,CMPR_23

                        MOV A,#13H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_23: CJNE A,#17H,CMPR_24

                        MOV A,#13H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_24: CJNE A,#18H,CMPR_25

                        MOV A,#14H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_25: CJNE A,#19H,CMPR_26

                        MOV A,#15H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_26: CJNE A,#1AH,CMPR_27

                        MOV A,#15H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_27: CJNE A,#1BH,CMPR_28

                        MOV A,#16H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_28: CJNE A,#1CH,CMPR_29

                        MOV A,#16H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_29: CJNE A,#1DH,CMPR_30

                        MOV A,#17H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_30: CJNE A,#1EH,CMPR_31

                        MOV A,#18H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_31: CJNE A,#1FH,CMPR_32

                        MOV A,#18H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_32: CJNE A,#20H,CMPR_33

                        MOV A,#19H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_33: CJNE A,#21H,CMPR_34

                        MOV A,#19H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_34: CJNE A,#22H,CMPR_35

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_35: CJNE A,#23H,CMPR_36

                        MOV A,#21H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_36: CJNE A,#24H,CMPR_37

                        MOV A,#21H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_37: CJNE A,#25H,CMPR_38

                        MOV A,#22H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_38: CJNE A,#26H,CMPR_39

                        MOV A,#22H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_39: CJNE A,#27H,CMPR_40

                        MOV A,#23H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_40: CJNE A,#28H,CMPR_41

                        MOV A,#24H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_41: CJNE A,#29H,CMPR_42

                        MOV A,#24H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_42: CJNE A,#2AH,CMPR_43

                        MOV A,#25H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_43: CJNE A,#2BH,CMPR_44

                        MOV A,#25H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_44: CJNE A,#2CH,CMPR_45

                        MOV A,#26H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_45: CJNE A,#2DH,CMPR_46

                        MOV A,#27H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_46: CJNE A,#2EH,CMPR_47

                        MOV A,#27H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_47: CJNE A,#2FH,CMPR_48

                        MOV A,#28H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_48: CJNE A,#30H,CMPR_49

                        MOV A,#29H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_49: CJNE A,#31H,CMPR_50

                        MOV A,#29H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_50: CJNE A,#32H,CMPR_51

                        MOV A,#30H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_51: CJNE A,#33H,CMPR_52

                        MOV A,#30H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_52: CJNE A,#34H,CMPR_53

                        MOV A,#31H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_53: CJNE A,#35H,CMPR_54

                        MOV A,#32H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_54: CJNE A,#36H,CMPR_55

                        MOV A,#32H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_55: CJNE A,#37H,CMPR_56

                        MOV A,#33H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_56: CJNE A,#38H,CMPR_57

                        MOV A,#33H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_57: CJNE A,#39H,CMPR_58

                        MOV A,#34H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_58: CJNE A,#3AH,CMPR_59

                        MOV A,#35H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_59: CJNE A,#3BH,CMPR_60

                        MOV A,#35H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_60: CJNE A,#3CH,CMPR_61

                        MOV A,#36H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_61: CJNE A,#3DH,CMPR_62

                        MOV A,#36H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY        

CMPR_62: CJNE A,#3EH,CMPR_63

                        MOV A,#37H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_63: CJNE A,#3FH,CMPR_64

                        MOV A,#38H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_64: CJNE A,#40H,CMPR_65

                        MOV A,#38H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_65: CJNE A,#41H,CMPR_66

                        MOV A,#39H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_66: CJNE A,#42H,CMPR_67

                        MOV A,#39H

                        ACALL BCD_TO_ASCII

                        MOV A,#80H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_67: CJNE A,#43H,CMPR_68

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        MOV A,#40H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_68: CJNE A,#44H,CMPR_69

                        MOV A,#41H

                        ACALL BCD_TO_ASCII

                        MOV A,#00H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_69: CJNE A,#45H,CMPR_70

                        MOV A,#41H

                        ACALL BCD_TO_ASCII

                        MOV A,#60H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

CMPR_70: CJNE A,#46H,EXIT

                        MOV A,#42H

                        ACALL BCD_TO_ASCII

                        MOV A,#20H

                        ACALL BCD_TO_ASCII

                        LJMP RPM_DISPLAY

 

EXIT:  MOV DPTR,#NO_RANGE                

                        ACALL STRING_DISPLAY

                        SJMP $

 

RPM_DISPLAY:

                        MOV A,#' '

                        ACALL LCD_DATA_WRT

                        MOV DPTR,#RPM                  

                        ACALL STRING_DISPLAY

                        SJMP $

 

LCD_COMND_WRT:                                                                                                 

                        MOV LCD_DATA,A

                        CLR LCD_RS

                        SETB LCD_EN

                        ACALL DELAY_NINE

                        CLR LCD_EN

                        RET

 

LCD_DATA_WRT:                                                                                      

                        MOV LCD_DATA,A

                        SETB LCD_RS

                        SETB LCD_EN

                        ACALL DELAY_NINE

                        CLR LCD_EN

                        RET

 

BCD_TO_ASCII:

                        MOV TEMPVAR_4,A

                        ANL A,#0FH

                        ORL A,#30H

                        MOV TEMPVAR_3,A

                        MOV A,TEMPVAR_4

                        ANL A,#0F0H

                        SWAP A

                        ORL A,#30H

                        ACALL LCD_DATA_WRT

                        ACALL DELAY_NINE

                        MOV A,TEMPVAR_3

                        ACALL LCD_DATA_WRT

                        ACALL DELAY_NINE

                        RET

 

DELAY_NINE:        

        MOV TEMPVAR_5,#16                                                          

                        NINE_BACK:MOV TEMPVAR_6,#250    

                        DJNZ TEMPVAR_6,$                      

                        DJNZ TEMPVAR_5,NINE_BACK

                        RET

 

DELAY_ONESEC:

                        MOV TEMPVAR_5,#10         

BK_C: MOV TEMPVAR_6,#255       

BK_B: MOV TEMPVAR_7,#179       

BK_A:            DJNZ TEMPVAR_7,BK_A

                        DJNZ TEMPVAR_6,BK_B

                        DJNZ TEMPVAR_5,BK_C

                        MOV TEMPVAR_6,#50

BK_E: MOV TEMPVAR_5,#9

BK_D:            DJNZ TEMPVAR_5,BK_D

                        DJNZ TEMPVAR_6,BK_E

                        RET

 

STRING_DISPLAY:                                                                                                

        DIS_BACK:CLR A

                        MOVC A,@A+DPTR

                        JZ DIS_OUT

                        ACALL LCD_DATA_WRT

                        INC DPTR

                        SJMP DIS_BACK

                DIS_OUT:RET

 

RPM: DB 'RPM',0

NO_RANGE: DB 'OUT OF RANGE',0

 

                        END

 

###

 


Circuit Diagrams

Tachometer-using-Microcontroller


Filed Under: Electronic Projects
Tagged With: 8051, at89s52, ir, microcontroller, tachometer
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Will this TL084C based current clamp circuit work?
  • ADS optimization cockpit window does not open
  • Voltage mode pushpull is a nonsense SMPS?
  • How to determine the maximum PAD frequency ?
  • Xiaomi Mijia 1C Robot problem of going backwards while working

RSS Electro-Tech-Online.com Discussions

  • Curved lines in PCB design
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • using a RTC in SF basic
  • PIC KIT 3 not able to program dsPIC
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection
  • Convection-cooled power controller integrates EtherCat connectivity

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe