Ha ha, Yeah Thanks Ben,
My brain kicked in over night and I came to the same conclusion.
Attached is a simple working example for anyone following along.
A Variable pot on input 1, will vary the output frequency between roughly 0.5Hz to 150Hz.
Again some of my learning process...
My FC programs DSP uses the 'Tick' method, so each time the DSP routine is evaluated (triggered by the interrupt TMR0) it processes one sample in the defined waveform.
In my example I chose a Period value of 100, thus 100 samples for a complete waveform.
So with an Interupt (TMR0 1:32) of ~1464Hz, My waveform is fully processed at around (1464 / 100) 14.6Hz
The 'SetOfset' component macro is then used to scale this base frequency.
The value used for SetOffset is a Float value, so there is a bit of int2float calculation to get the AV input value into something usable.
For display purposes an approximate frequency value is calculated and converted to an integer.
Notes on my example program:
I've generally found it easy to stick to Signed integer values for DSP Variables and use the appropriate SINT macros in my DSP calls. No great reasoning behind this, I just seem to get things working quicker this way!
Using an interupt to trigger the DSP calculation, made it much more regular, thus easier to play with and understand.
The calculated freq values shown on the MIAC display are approximate.
Remember, You need to stop Zero values getting into your calculations.
The chosen frequency output just happens to the the spark rate range for a four stoke engine, from cranking to 18K RPM and a handy test rig for checking RPM tachos!
At least some of the DSP stuff is starting to make a bit more sense!
Cheers, J.