I'm still a newb, so let me start with what I'd like to do, and then I'll move onto my guess as to how I need to do it (it's a real rough guess..)
What I want to do is read in a frequency, divide that frequency by 1000, then multiply it by a user definable amount, something like 923, and then output the new frequency on another pin.
Both the incoming and outgoing signals would be a fixed 50% duty cycle. The frequency would be between 2hz and 200hz, I'd prefer .1hz resolution on both the input and output.
I found a library that uses Timer2 to get the incoming frequency. Much of how it works is well over my head, but as I understand it, the timer just causes a recurring interrupt on a time specific table, so that you can accurately time the high and low input events on a pin. Do I have that right?
Now for the output, would I use Timer1? Can I use Timer1 and Timer2 at the same time? Or would I just schedule the output along with checking the input on the same Timer1?
I believe the kind of output I'd be doing at this point would be referred to as bit-banging, because I'd be manually changing the pin state based on the timer, rather than using a PWM output. Sounds like the PWM outputs are not what I need, because I only need 50% duty cycle, and the Frequency selection is very limited.
What am I trying to build? Electronic speedometer correction device.. If your tires are 7.3% too tall, put this in between the speedo and the speed sensor, and it'll correct the speed. It's an 8000pulse per mile sensor, so that's where I get the 2-200hz (2.2hz=1mph and 222hz is 100mph). If someone has already written something like this, point me to it please.
If there's a library for the kind of output I'm trying to get (something like an analogWrite(frequency) rather than analogWrite(duty cycle)) point me to that too..
And if what I want to do is completely impossible with an Arduino, tell me that too..
hehe.. Thanks guys.