PIC 16f877 microcontroller based RPM Meter




Summary: The speed of the motor is measured in Rotations per Minutes,RPM.The RPM Meter is to read the running speed of Motor like DC MOTOR. Here the speed of the DC Motor is sensed with the help of a speed sensor and it is signal conditioned to have pulses which given as Timer1 clock input of PIC Microcontroller, configured to accept external clock input.The count value in Timer1 for one second represents speed in seconds which can be converted into RPM by multiplying the count by 60.The Display of the speed will be on Lyquid Crystal Display LCD .

AIM :

To develop a RPM meter using microcontroller & to display the speed on LCD Display PIC Microcontroller 16F877.
PIC 16f877 microcontroller based RPM Meter

INTERFACING:

  1. Pulses from speed sensor connected to TMR1 clock input-RC2
  2. Run/Hold push button switch connected to –RC4
LCD Display –
  • Data lines connected to Port C – RC0: RC7
  • Control lines connected to Port D – RD0: RD2
  • Timer0 used for generating time slice of 1/16 sec in interrupt driven mode
NOTE: DC motor, DC motor driver circuit, speed sensor, signal-condition circuit to be Provided.
DESCRIPTION:
Pulses from the speed sensor, after signal conditioning, is connected to Timer 1 input.
RPM meter works in two modes viz RUN & HOLD. The mode toggles for every push of the mode selection push of the mode selection push button switch:
HOLD Mode: Previous value of the speed is displayed
RUN Mode: Speed is measured for every second
  • By default meter will be in HOLD mode with display ‘00’.
  • Mode of operation and the speed are displayed on LCD
Figure4: Functional Flow Chart for RPM Meter
LIST P=16F877
#INCLUDE”P16F877.INC”
CBLOCK 20H
HEX1
HEX2
DEC1
DEC2
DEC3
DEC4
DEC5
DD1
DD2
DV1
DV2
Q2
Q1
TEMP
DISNO
DLOC1
DLOC2
ENDC
ORG 00H
GOTO MAIN
PIC 16f877 microcontroller based RPM Meter SchematicMAIN CLRF CCP1CON ; CCP Module is off
CLRF TMR1H ; Clear Timer1 High byte
CLRF TMR1L ; Clear Timer1 Low byte
CLRF CCPR1L
CLRF CCPR1H
CLRF INTCON ; Disable interrupts and clear T0IF
BSF STATUS, RP0 ; Bank1
BSF TRISC, 2 ; Make CCP pin input
CLRF TRISD
CLRF TRISE
CLRF PIE1 ; Disable peripheral interrupts
BCF STATUS, RP0; Bank0
CLRF PIR1 ; Clear peripheral interrupts Flags
MOVLW 07 ; Capture mode, every 4th rising edge
MOVWF CCP1CON
BSF STATUS, RP0
BSF PIE1, CCP1IE
BCF STATUS, RP0
MOVLW 21H
MOVWF T1CON ; Timer1 starts to increment 1:8 PRESCALAR MODE
; The CCP1 interrupt is disabled,
; do polling on the CCP Interrupt flag bit
Capture_Event
BCF T1CON, TMR1ON; off the timer after capturing the 4th pulse
BANKSEL TRISA
CLRF TRISC
BANKSEL PORTA
BCF PIR1, CCP1IF ; This need to be done before next compare
MOVF CCPR1L, 0
MOVWF HEX1
MOVF CCPR1H, 0
MOVWF HEX2
BCF STATUS, C ; for performing right shift
RRF HEX2 ; dividing the period by 2 i,e right shift
RRF HEX1;
CALL DIVIDE ; converting the period into frequency i,e RPS=Fclk / (capture period)

 

 

For more detail: PIC 16f877 microcontroller based RPM Meter




Current Project / Post can also be found using:

  • pic rpm counter
  • rpm detector circuit diagram using pic microcontroller
  • pic 16f877 microcontroller using techometer
  • pic 16f877a using rpm counter

Leave a Comment

*
= 3 + 4

Scroll to top