EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise
You are here: Home / Replies / This is my approach but i am

This is my approach but i am

|

Microcontroller › AVR › frequency measurement and display on LCD › This is my approach but i am

May 16, 2012 at 10:46 am #7835
sanam
Participant

This is my approach but i am not getting anything. could u please help me where am i doing wrong.

Your help and guidance is heartily acknowledged.

 

#include <avr/io.h> 
#include <util/delay.h> 
#include <stdio.h> 
#include <avr/interrupt.h> 
#include <compat/ina90.h>    
 
#include “easyavr_lcd.c”    
 
volatile ov_counter; 
unsigned long frequency; 
 
 
ISR(TIMER1_CAPT_vect) 
{ 
   // Counter to 0 
   TCNT1 = 0; 
  
   // The result is valid only if the counter 
   // has not overflowed yet 
   if (!(TIFR & (1 << TOV1))) 
   { 
      // Calculating the frequency from the period 
      frequency = (unsigned long)8000000 / 
                  (unsigned long)ICR1; 
   } 
    
} 
 
ISR(TIMER1_OVF_vect){ 
   ov_counter++; 
} 
 
void init_timer(){ 
 TCCR1B = (1<<ICES1)  | (1<<CS10); 
  TIMSK = (1<<TICIE1) | (1<<TOIE1); 
} 
 
int main(){ 
  
   DDRB = 0x00; 
  
    
   init_timer(); 
         lcdinit(); 
lcdmsg(“CURRENT LVL”,1); 
 
 
    
char a1[7]; 
    sei(); 
   while(1){ 
lcdmsg(“CURRENT LVL”,1);    
  
    
    itoa(frequency, a1, 10); 
    lcdmsg(a1,2); 
      lcdmsg(“CURRENT LVL”,1); 
      _delay_ms(500); 
   lcdclr(); 
  
   } 
   return 1; 
} 
 

RSS Recent Posts

  • Back to the old BASIC days May 23, 2025
  • Guitar electronics project May 23, 2025
  • 12v battery, 18v magic May 23, 2025
  • Actin group needed for effective PCB software tutorials May 23, 2025
  • parallel-to-serial problem May 23, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

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 | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise