Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Differential Relay to protect System from Negative Phase

By Subasis Pani, Orisha, Inida

 

The combined protection relay is one of the relays, which basically designed to protect the user device from negative phase sequence, single phasing and also the power distribution line with the help of a differential relay. The negative phase sequence relay basically protects the devices against the reverse phase sequence and also against the unbalance phase sequence generated due to unbalance loading. Single phasing relays protect the device against the phase failure. The differential relay protects the zone of the transmission line.

The specialty in this project is the design is made on 89c51 microcontroller, which is faster and controls all the relays. This is static relay so no much mechanical movement is there. The response time is very fast and can be programmed for any value. The great advantage of programmability is available to the user.

Combined Protection System

This protection system is developed on 89C51 Microcontroller. If the relay will be developed with same facility by electro mechanical comnponent, then the cost and size of the device will be too high. The use of Microcontroller reduces extra hard wares such as timers and connectors etc. The controller is embedded with all the components. The controller is the heart of the device and there are other hardwares used for signal conditions and comparison. In this relay there are four current setting and it can handed maximum up to 15A current.

 Principle of Operation

PRINCIPLE OF OPERATION:

Single Phasing Relay

Principle:

Single-phase relay can be designed on many principles, but the most popular methods are voltage sensing and current sensing methods. The voltage sensing method is quite popular compared to the current sensing method.  In current sensing method, the abrupt current change cannot be taken care and the design is for a specific load only.  Whereas, voltage sensing method is flexible and can be designed for any system.The basic principle of this relay is that it senses the three phase voltage and step down it, which further converted in Square waves. This signal is conditioned to a CMOS compatible signal pulses and feed to the micro controller and checked sequentially for its presence.The phase to neutral voltage is VPN =230volt, with the help of a voltage divider network  a low voltage is sampled and pulses are generated at the zero cross points.

Differential Relay:

This relay works on the principle of current sensing. There are two special type of current sensors used to sample current. The output of both the current transformer are compared and found if both the C.T. s   are reading the same current then the transmission line connected between the C.T.s is found to be normal and there is no fault. Whenever there is a short circuit in the protected zone, then the current bleed on the short-circuited path so the reading of both the C.T. s differs that out put is taken into the micro controller for deciding the fault condition.

CURRENT SAMPLING SECTION:  This section consists of a special type of ferrite core transformer a signal condition circuit. The current transformer develops a secondary voltage proportional to primary current.

 

 

Current transformer

 

Design of current transformer

This is a special type of current transformer which is having 5 turns of 10SWG winding in the primary and 350 turns of 38SWG at secondary winding. The cone is high-density ferrite cone. The cones are made out of E-section and the winding is made as the central limb.

Signal conditioning

The output of the current transformer is rectified and the DC output is  smoothened by using a RC filter and that out put is  feed to the comparator circuit  through a voltage divider  network.

UNDER VOLTAGE & OVERVOLTAGE RELAY

The under voltage and over voltage section samples the line voltage through a step-down transformer and converts it into DC voltage and compare it with a reference to detect under voltage and over voltage condition. The corresponding bits are send to the micro controller for action. 

 Circuit Description

 

 

CIRCUIT DESCRIPTION

 

POWER SUPPLY:-( +ve)

Circuit connection: – Shown in circuit tab 1 using Transformer (0-12) v, 1mpA, IC 7805 & 7812, diodes IN 4007,LED & resistors.

 

 Motherboard

MOTHER BOARD

Mother Board Block Diagram

The motherboard of this project is designed with a MSC –51 core compatible micro controller. The motherboard is designed on a printed circuit board, compatible for the micro controller. This board is consisting of a socket for micro controller, input /output pull-up registers; oscillator section and auto reset circuit.

The layout of the 89C51‘s internal memory is presented in the following memory map:

Mother Board Memory Layout

As is illustrated in this map, the 8051 has a bank of 128 bytes of Internal RAM. This Internal RAM is found on-chip on the 8051 so it is the fastest RAM available, and it is also the most flexible in terms of reading, writing, and modifying it’s contents. Internal RAM is volatile, so when the 8051 is reset this memory is cleared.

The 128 bytes of internal ram is subdivided as shown on the memory map. The first 8 bytes (00h – 07h) are “register bank 0”. By manipulating certain SFRs, a program may choose to use register banks 1, 2, or 3. These alternative register banks are located in internal RAM in addresses 08h through 1Fh. We’ll discuss “register banks” more in a later chapter. For now it is sufficient to know that they “live” and are part of internal RAM.

Port assignment:-

OUTPUT  PORTS

P0.0     NORMAL INDICATOR

P0.1     R-PHASE FAILURE

P0.2     Y-PHASE FAILURE

P0.3     B-PHASE FAILURE

P0.4     DIFFRENTIAL FAULT

P0.5     RELAY INDICATOR

P.6       UNDER VOLTAGE INDICATOR

P0.7 OVER VOLTAGE INDICATOR

INPUTS:

P1.0     R-PHASE INPUT

P1.1     Y-PHASEINPUT

P1.2     B-PHASE INPUT

P1.3     COMPARATOR 1 INPUT FROM CT1

P1.4     COMPARATOR 2 INPUT FROM CT2

P1.5     RELAY DRIVER

P1.6     UNDER VOLTAGE INPUT

P1.7     OVER VOLTAGE INPUT

Motherboard Circuitry

LED Indicator

LED INDICATOR

The indicator section consists of a light emitting diode and its driver circuit is designed on the basis of current required to glow the light emitting diode. Here the driver circuit is required for the following functionality.

1) The Microcontroller cannot provide adequate current for glowing the LED. The LEDs requires a current between 10mA to 20mA of current to glow.

2)The driver circuit provides current to the load from a separate source, so the load current used not pass through the Microcontroller.

3)The driver circuit activates the load on receipt of a logic signal from the Microcontroller and of the load in the absence of the signal as he current requirement Is very less to glow a LED a single stage driver is sufficient to drive the load. The driver circuit is nothing other than a perfect a transistor switch. The driver transistor goes in to saturation on receipt of base signal and drives into cut-off region, in absence of base signal.

The driver designs around a BC548/BC547 transistor and designed for a working voltage of +5 V dc and 10mA current.

Rc= Vcc-VCEsat     = 5-0.2V

IC                     10mA

= 4.8KW

Ib=Ic/b=10mA/200=5×10-5 A=0.5×10-6A

=0.5mA

  

As per the design a 0.5mA current is sufficient to trigger the driver circuit. As this current is very small and to avoid mistriggering a base current of 100mA is assumed

VB-IBRB-VBE=0

                  Þ IBRB  = 5-0.7

                  RB   = 5-0.7V/100mA   = 4.3/100 MW

                              =  0.043×10-6W

                              =  43KW

On approximation 68K is connected by calculating back

                              IB  = 4.3/68K  = [email protected] 70mA

which is adequate to avoid mis-triggering level also this amount of current can be drawn from the Microcontroller without any problem.

The indicator section consists of 8 no of driver with 8 no of LED as indicator load. The circuit diagram is enclosed.

Whenever there is a fault in any of the condition (parameter) it indicates a high output at the Microcontroller, which is given to the base of the driver transistor (BC547/BC548) with a base resistance (68k/56k)  & thus transistor comes to saturation condition i.e. ON condition, thus the emitter current flows to the collector of the transistor at which the LED is connected through a current limiting resistor (330E/470E) thus the LED gets forward biased which turns ON the LED it indicates the channels fault .

LED Indicator

 Relay Driver & Signal Conditioning

RELAY DRIVER

The relay driver is design by using a BC547 transistor .The relay used here having the specification as follows

1) Coil resistance =400ohm

2) Coil voltage=12Vdc

3) Contact capacity=230V, 7A

The above specification indicates that the coil requires 12V dc and 200mA current dc. The Microcontroller can’t supply more then 10mA current. So driver section is very much required. BC547 has a typical current gain of 200 and maximum current capacity of 1A. So a typical base current of 200 mA can trigger to on the relay.

Relay Driver

SIGNAL CONDITIONING

 Comparator

The output form the input signal i.e. comparator or any other external circuit must be compatible with the m -controller, because the m -controller can takes 5V as input voltage and gives a 5V as output voltage. That for we need a signal conditioning circuit as given in the below figure.  

Signal Conditioning

fig..1:1           

In the fig1: 1, whenever the base voltage is HIGH the transistor comes to saturation condition i.e. the collector current flows to the emitter which gives a high voltage at the output corresponding to Vcc given at the collector. The output is taken from the emitter junction through a current limiting resistance and the output signal is given to the m – controller or any other circuit which needs a compatible (5V) voltage. Similarly, whenever the base voltage is LOW the emitter current flows from the emitter junction of the transistor, which gives a low voltage at the output corresponding to GND. The output is taken from the emitter junction through a current limiting resistance and the output signal is given to the m – controller or any other circuit which needs a compatible (5V) voltage.

 

Signal Conditioner

fig..1:0           

In the fig1: 0, whenever the base voltage is HIGH the transistor comes to saturation condition i.e. the emitter current flows to the collector which gives a low voltage at the output corresponding to GND. The output is taken from the collector junction through a current limiting resistance and the output signal is given to the m – controller or any other circuit which needs a compatible (5V/0V) voltage. Similarly, whenever the base voltage is LOW the collector current flows from the collector junction of the transistor, which gives a high voltage at the output corresponding to Vcc. The output is taken from the emitter junction through a current limiting resistance and the output signal is given to the m – controller or any other circuit which needs a compatible (5V/0V) voltage.

COMPARATOR

UNDER / OVER VOLTAGE:

In this section our aim is to detect the line varying voltage.

Line Voltage Signalling Circuit

 

The line voltage (230V AC) coming from the mains is to be step down that voltage with the help of a step down transformer. If the line voltage varies, the step down voltage also varies in accordance with the input voltage. Due to the mutual induction of the transformer, if the primary winding of the transformer voltage is more the flux induced is more and the secondary voltage is more. Similarly, if the primary winding of the transformer voltage is less the flux induced is less and the secondary voltage is less. In this way under/over voltage occurs.

The above figure shows a half-wave rectifier, in which it will converts ac to dc voltage. We can vary the voltage with the variable load resistance (10k) The sample voltage can be calibrated by varying the load resistance RL The important part of this design to sample the voltage accurately as an replica of the  line voltage.  The step down transformer samples the line voltage at a reduced signal voltage

Vac = (N2/N1)*VL­

The DC voltage after the half wave rectifier is approximately Vm due to the charging of the capacitor, this capacitor voltage represents the line voltage. The time constant of the circuit is defined by C*RL. The time constant   of the circuit must be more then five times of the time period of the signal. RC>5T.  If the RC value is less the 5T then the sample voltage fluctuates unnecessarily, if the RC value is too high the sampling response becomes too slow.

Operation: The output of the signal sampling voltage (3v) goes to the input of both of the comparator. In the first comparator we have set the voltage say 3.5Vto the non-inverting terminal. In this case non-inverting terminal is greater than the inverting terminal. That means output of the first comparator is LOW. At present under temperature can¢t be done because the room temperature will be always available If we want¢s to do under temperature, we have to vary or change the set point which is connected to the inverting terminal of that comparator. Similarly, for the second comparator we have set the voltage say 4V to the inverting terminal. In this case inverting terminal is greater than the non-inverting terminal that means output of the second comparator is HIGH.

 

If the temperature increases, the corresponding voltage will increase say 4.5V. That voltage goes to the input of both of the comparator. In the first comparator we have set the voltage say 3.5Vto the non-inverting terminal. In this case inverting terminal is greater than the non- inverting terminal. That means output of the first comparator is HIGH this means that over temperature has occurred. Similarly, for the second comparator we have set the voltage say 4V to the inverting terminal. In this case non- inverting terminal is greater than the inverting terminal that means output of the second comparator is LOW. That output signal is not compatible with the m-controller because as we know that the controller takes input signal as 5V and gives output as 5V.

 

Signal Conditioning Circuit

For this reason we needs a signal conditioning circuit which is given in the below figure-2. That output signal is compatible with the controller because the current will flows from the collector of the transistor whenever the base voltage is high due to the transistor action. Similarly the output is low in the absence of the input signal to the signal conditioning circuit from the comparators. 

Under and Over Voltage Circuit

Over Temperature Detector

OVER  TEMPERATURE DETECTOR:

Over Temperature Detector

The above fig shows the under / over temperature. In this section our aim is to detect under and over temperature, for that we needs a temperature sensor as a  (THERMISTOR) for sensing the temperature and for comparing the temperature we needs a comparator (LM393) which compares the two input voltage and gives the corresponding outputs according to the temperature. In the temperature sensor is a circuit that converts temperature to the corresponding voltage.

Connection:

The temperature sensor (THERMISTOR) one end of the terminal of the thermister is connected to a Vcc and the other end terminal is connected to the GND through a series connected resistances, which forms a voltage divider network. At constant room temperature, the corresponding voltage will be available at the output. If the temperature increases the corresponding voltage will increase according to the increase in temperature. That output signal is given to the comparator for comparing the voltage. If the comparator input is connected to the inverting terminal (+) reference value is greater than the non-inverting terminal (-), the comparator output is high i.e. ON condition. Similarly, if the comparator input is connected to the non-inverting terminal (-) reference value is greater than the inverting terminal (+), the comparator output is low i.e. OFF condition. But, here both of the comparator inputs of inverting and non-inverting of both of the comparators are connected to the temperature sensor and the set value input inverting and non-inverting of both of the comparator through a variable resistance (10k). That output signal is given to the LED indicator section for indication purpose for the availability of the signal at the output of the comparator.

Operation: At constant room temperature suppose in 30°C, the output at the of the sensor circuit that forms a voltage divider network gives a corresponding voltage suppose 3V. That voltage goes to the input of both of the comparator. In the first comparator we have set the voltage say 3.5Vto the non-inverting terminal. In this case non-inverting terminal is greater than the inverting terminal. That means output of the first comparator is LOW. At present under temperature can¢t be done because the room temperature will be always available If we want¢s to do under temperature, we have to vary or change the set point which is connected to the inverting terminal of that comparator. Similarly, for the second comparator we have set the voltage say 4V to the inverting terminal. In this case inverting terminal is greater than the non-inverting terminal that means output of the second comparator is HIGH.

If the temperature increases, the corresponding voltage will increase say 4.5V. That voltage goes to the input of both of the comparator. In the first comparator we have set the voltage say 3.5Vto the non-inverting terminal. In this case inverting terminal is greater than the non- inverting terminal. That means output of the first comparator is HIGH this means that over temperature has occurred. Similarly, for the second comparator we have set the voltage say 4V to the inverting terminal. In this case non- inverting terminal is greater than the inverting terminal that means output of the second comparator is LOW.

That output signal is not compatible with the m-controller because  the comparator gives a high voltage corresponding to Vsat (12V)as we know that the controller takes input signal as 5V and gives output as 5V.

Signal Conditioning for temperature

For this reason we needs a signal conditioning circuit which is given in the below figure-That output signal is compatible with the controller because the current will flows from the collector of the transistor whenever the base voltage is high due to the transistor action. Similarly the output is low in the absence of the input signal to the signal conditioning circuit from the comparators. 

 Over Current Detector

OVER CURRENT DETECTOR:

This is a circuit designed to detect over current. In this section a special type of CT is used to detect very low current The output of this CT is a AC voltage proportional to the Load current. The CT voltage varies with load current.

The line voltage (230vac) coming from the mains is given to the one end of primary of the current transformer and another end through a load (1KW) to the neutral. The current in the primary coil of the CT induce an voltage in the secondary of the CT. In this special type of CT the primary COIL IS ONE TURN AND SECONDARY IS 200TURN. If the load varies, the CT output also varies in accordance with the load current. The output voltage of the CT depends on the primary flux density.  The CT is designed with 10 SWG wire at primary side and 40 SWG wire at the secondary side. The principle of operation of this CT as simple as the normal single winding CT coil, but the construction is a cell type to measure low current.  As the low load current can not produce high flux density a multiple turns of primary is made increase the flux density.  

The above figure shows a half-wave rectifier, in which it will converts ac to dc voltage.  In this circuit the importance of designing the rectifier is at the priority to achieve the accuracy and precession.   

The sample voltage can be calibrated by varying the load resistance RL The important part of this design to sample the  load current  accurately  and produce a DC voltage as an replica to the AC load current.  The Current Transformer (CT) samples the load current as a reduced signal voltage

Vac = (N2/N1)*fm *K

The out put voltage wave form of the CT is quit poor so a careful design of rectifier circuit is desired. While choosing the time constant of the circuit following precautions are required to be followed,

The DC voltage after the half wave rectifier is approximately Vm due to the charging of the capacitor, this capacitor voltage represents the line voltage. The time constant of the circuit is defined by C*RL. The time constant   of the circuit must be more then five times of the time period of the signal. RC>5T.  If the RC value is less the 5T then the sample voltage fluctuates unnecessarily, if the RC value is too high the sampling response becomes too slow.

 Differential Current

Differential Current

Differential Circuit

The above figure shows the differential amplifier with one op-amp. Close examinations of the above figure reveals that a differential amplifier is a combination of inverting and non-inverting amplifier. That is, when Vx is reduced to zero the ckt is a non-inverting amplifier. Whereas the ckt is an inverting amplifier when input Vy is reduced to zero.

The ckt in figure has two inputs, Vx and Vy: we will therefore use the superposition theorem in order to establish the relationship between inputs and outputs. When Vy =0V, the configuration becomes an inverting amplifier: hence the output due to Vx only is

                                                Vox = – Rf (Vx) / R1.

Similarly, when Vx = 0V, the configuration is a non-inverting amplifier having a voltage –divider network composed of R2 & R3 at the non inverting input. Therfore,

 

                                    V1 =  R3(Vy)  /  R2 + R3

And the output due to Vy then is

                        V0y  =  ( 1+ Rf / R1) V1

That is,

            V0y = R3  /  R2 + R3 (R2 + R3 / R1) Vy

Since  R1  =  R2  &  Rf  =  R3,

            V0y  =  Rf( Vy) / R1

Thus from equation 1 and 2 ,the net output voltage is

            V0  =  V0x  +  V0y

                  = –  Rf  /  R1 ( Vx – Vy)

`                 = – Rf(Vxy) / R1

or the voltage gain

            Ad  =  V0 / Vxy  =  – Rf / R1

 

Note that the gain of the differential amplifier is the same as that of inverting amplifier.

 Circuit Operation

Circuit operation:

 At  normal condition ,the  o/p of the two CT, the current will be same at the both end of the CT i.e the voltage will be same, may be slight different due to CT winding, but the ac voltage will be  same at the secondary, since the heart of the circuit is a differential amplifier which is nothing but OPAMP which operates in DC voltage. Therefore, we have first converted AC to DC with the help of a half wave rectifier, The DC o/p goes to voltage divider network which configured as 1:!  And the out put is taken across the taping opont which we have set same voltage normally, that O/P is given as input to the OPAM, one  to the inverting terminal and another  to the  non-inverting terminal which is configured as differential amplifier.

When we switch ON another load 100W which is connected in between to the two CT in series, the O/P current increased and the DC voltage increases at the out put of the one CT-1 and another CT-2 remains as it is. The out put voltage goes to 3v .The non-inverting terminal and another voltage 2.7 goes to the inverting k terminal. The gain of the amplifier according to the formula is – 10 v. In this case the O/P of k the OPAM goes to + V sat i.e.3V which is given to the relay driver circuit through a Bistable circuit, it states that whenever the switch gets on or if the load increases the relay gets ON ie.make the relay trip i.e de activates the load.

Circuit Isolator

Circuit Operation

 Optoisolator

OPTOISOLATOR / FREQUENCY

An opto coupler is a device containing an infrared LED and a matching phototransistor, mounted close together (optically coupled) within a light-excluding package as shown in below figure.

Optoisolator

Here sw1 is normally open, so zero current flows through the LED: Q1 is thus in darkness and also passes zero current, so zero output voltage appears across R2. When sw1 is closed, however current flows through the LED via R1, thus illuminating Q1 and causing it to generate an R2 output voltage. The R2 output voltage can thus be controlled via the R1 input current, even though R1 and R2 are fully isolated electrically.In practice, the device can be used to optocouple either digital or analogue signals, and can provide hundreds or thousands of volts of isolation between the input and output circuits.

Circuit Optoisolation

 Algorithm & Assembly Programming

SOFTWARE:

Algorithm:

1. The controller after initialization check for the inputs from the phase sampling section. If the phase samples are received at proper interval as per the theory then the timer is reset , if doesn’t appear then the negative sequence and phase failure error.

2. Then controller check for the inputs from the CTs, if the inputs found to be different then the differential fault is indicated.

3. Then the under and over voltage section is checked for fault condition.

If any time a fault occurs then automatically the controller stay in that loop and comes out only when the fault is cleared.

Assembly Program

#include <reg51.h>
main()
 {
       TMOD=0x20;         
       SCON=0x40;         
       TL1=0xFD;            
       TH1 = 0xFD;
       TR1 = 1;            
loop:REN = 1;              
      while(RI==0){}    
      RI=0;                   
      ACC = SBUF;       
      REN = 0;               
      SBUF = ACC;         
      while(TI==0){}      
      TI=0;                   
      goto loop;              

Movr2, #00h             

Movie, #84h                

           Here:     Sjmp here            

 

Org 0013h                              

Incr2                          

Cjner2, #00h, out        

Movie, #00h                

Clr       p0.0                

            Out      : reti                             

 

}

 

 

 Code

Code

 

               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

 

 

Project Source Code

 ###


    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

Power-Supply


Filed Under: Electronic Projects
Tagged With: 8051, differential relay, microcontroller, negative phase, relay
 

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.

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!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Vco cadencd
  • Thyristor Gate Drive
  • Variable Phase shift control circuit for PWM circuit
  • Passive Harmonics Filter
  • Constraining a combo path (Synopsys DC)

RSS Electro-Tech-Online.com Discussions

  • HV Diodes
  • Disabled son needs advice please
  • Question about ultrasonic mist maker
  • RF modules which can handle high number of bytes per second
  • DIY bluetooth speaker
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 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 | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering