Loading ...
Sorry, an error occurred while loading the content.

1927Re: Bls: [booksbybibin,www.booksbybibin.tk] reading frequency of an ac signal by atmega8

Expand Messages
  • danial_1000
    Aug 7, 2010
    • 0 Attachment
      i know that and do the same by impleminting a transistor buffer
      and voltage divider at the input of the transistor gate to switch the vcc at the mcu ICP @ input signal frequency and its ok i having problem with the code .i although do it by using the external interrupt and calculate the exact frequency but i wana do it by using ICP.
      my code which i written for reading the frequency by using the ICP is here.plz any help will be appreciated to calculate the exact frequency.
      uint32_t time_in_milliseconds=0;
      uint32_t rising_edge,falling_edge;
      uint32_t pulse_clock;
      uint32_t ov_counter++;

      int main(void)

      TIMSK1=(1<<ICIE1)|(1<<TOIE1);//input capture and timer overflow interrupt enable

      /*Noise canceller, prescaler/8, rising edge*/


      while(1) //loop forever

      //do nothing the
      return 0;




      /*This subroutine checks was it start of pulse (rising edge)

      or was it end (fallingedge)and performs required operations*/

      if (ICP) //if high level


      //save start time

      //set to trigger on falling edge


      //reset overflow counter





      //save falling time


      //rising edge triggers next


      pulse_clock=(uint32_t) falling_edge-(uint32_t) rising_edge +(uint32_t)ov_counter*0x10000;
      time_in_milliseconds= pulse_clock/1000;



      --- In booksbybibin@yahoogroups.com, miftahul muhid <azil_man@...> wrote:
      > before u read frequency of AC, must turn down voltage until micro can read that.
      > u can use voltage divide.
      > ________________________________
      > Dari: danial_1000 <danial_1000@...>
      > Kepada: booksbybibin@yahoogroups.com
      > Terkirim: Ming, 25 Juli, 2010 21:15:15
      > Judul:[booksbybibin,www.booksbybibin.tk] reading frequency of an ac signal by
      > atmega8
      > i m newbie to avr progarmming i wana read a frequency of a ac signal by atmega8
      > plz any help will be appreciated .
      > regards
      > dany
    • Show all 4 messages in this topic