Port javascript freq generator parameters calculation to Arduino

Is it possible to port javascript Frequency generator parameters calculation logic from this html to build arduino schetch that will perform the same calculation without this javascript ? Input parameter is target clock freq. Calculated outputs: bit clock, mark bits, space bits, buffer size, div1, div2.
index .txt (11.1 KB)

Yes.

If the HTML is structured like it should be, this

function calculateClock() {

and maybe one or two other functions that do the heavy lifting could be taken out and repurposed.

I don't think Javascript used in this way will be terribly different to using C/C++, but it might mean you'd need to know what you are doing. Which would perhaps mean you wouldn't need to askā€¦

"Port" is too strong a verb. You would make better use of time hunting down example code for performing those caculations, code that is not encumbered with the HTML stuff, and already in C or C++.

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.