Header Ads

Make Pulse counter use PIC Micrcocontroller and mikro c

Welcome to MINA TECHNOLOGY.

In this tutorial we will learn how to make a pulse counter circuit. Here I am use PIC16F877A Microcontroller and LM16x2 Lcd display. The pulse generator circuit generate the pulses and pulse counter circuit measure that pulses. You can watch the video or read the written tutorial below.



Pulse counter circuits are use for measuring the pulses. It is use in digital circuit for frequency measure. In next tutorials I will show you  how to make frequency meter use pule counter circuit.

Pulse Generator Circuit:
Pulse generator use 555 ic


Pulse Counter Circuit:


pulse counter circuit

Mikro C code:

// Lcd module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
//end lcd module connections
#define SW PORTD.RD7                           // RD7 pin is pulse input pin
int pulse=0;
char text[15];
void main() {
     TRISD.F0 = 1;                                       // RD0 pin is input
     Lcd_Init();                                                  // Initialize the Lcd module
     Lcd_Cmd(_LCD_CLEAR);                           // Clear Lcd display
     Lcd_Cmd(_LCD_CURSOR_OFF);            // Lcd Cursor off
     Lcd_Out(1,1,"Pulse Counter");
     Lcd_Out(2,5,"Circuit");
     delay_ms(2000);                                          // 2 second delay
     Lcd_Cmd(_LCD_CLEAR);
     Lcd_Out(1,3,"DEVELOPED BY");
     Lcd_Out(2,1,"MINA TECHNOLOGY");
     delay_ms(2000);
     Lcd_Cmd(_LCD_CLEAR);
     Lcd_Out(1,1,"Pulse Counter");

   

     while(1){
              if(SW==1){
                        while(SW==1);
                        pulse++;
                        }
              if(pulse>=10000000) pulse  = 0;
              if(RD0_bit==1) pulse = 0;                     // Reset the counter

              IntToStr(pulse,text);                               // Lcd show the pulse
              Lcd_Out(2,1,text);
              }

}


Click the download button for program file:
download

No comments

Theme images by 5ugarless. Powered by Blogger.