NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Basic Electronics » Counting
January 17, 2011 by Jalex |
Hi I want to read a frequency for a few ms and print out the result similar to a frequency counter. I know how to set up the pins and read inputs but I don't know the best procedure for timing. The frequency is fairly slow, Less than 10k. Do I use a timer for this? I don't want to tie up the program with a delay as it is doing other things as well. Also can you explain a little on the interupts as to what they are for and how the function? |
---|---|
January 17, 2011 by Jalex |
I wrote some code to do it but I wanted to learn more on using the timers and interupts. I saw one of the kits used the timer but I can't find it to study as I forgot wich one it was. |
January 17, 2011 by Ralphxyz |
Probable best to start with the Real Time Clock tutorial. That will walk you through a timer interrupt. I'd be interested in seeing your code once you get this figured out. Ralph |
January 18, 2011 by Jalex |
Hi Ralph
I didn't want to show you this because I know it's not good programming but it works.
The IR is high when ever the trimmer is past the 180 degree(fully meshed position) mark.
It just uses a do nothing count while another variable counts out the Wind Speed
|
January 18, 2011 by Jalex |
Hi Again Anyway now you can see why I need to learn timers. I could then get rid of the 555 oscillator on the RC circuit and just measure the time between pulses. I am going to study real time clock now and learn to use it. I do it this way because we have lots of rain here and capasitors seem to handle the damp climate better. I make my own with just one rotating plate close to the other. |
Please log in to post a reply.
Did you know that you can use printf and scanf functions to talk to your computer from your USB NerdKit? Learn more...
|