RTM_TimerCalc is an Advanced Arduino Timer Calculator. V1.3 now includes C++ code generation for external In-Pin clocking.
In-Pin opens the door for Timer Intervals reaching up to 24 (and lots more) hours. To better exploit this wide-range Interval capability, the Ask-Units drop-down has selections for Hz, uSec, mSec, Seconds, Minutes and Hours.
When you create a calculation for a specific Interval, results are shown in your choice of Units (if possible). Ask for Seconds and you'll get an answer in Seconds, ask for Hours and you get Hours. See above image...
Converting between Unit Types
Version 1.3 accepts Ask-Input in multiple unit types. It can also -convert- between types using a context menu (right-click the Ask-Units drop-down). This means you can convert any supported input units-value (Hz, uSec, mSec, Second, Minute and Hour) to any other unit-value. The downside is huge changes (say from uSec to Hours) can cause a small rounding error. See next image...
A new feature is the Limits-Report. Clicking the "Show Limits" button reveals boundaries your "Ask" (Frequency or Interval) will be held to. There are many possible boundaries depending on Clock, Timer bit-size and Mode.
If your calculation goes past a Limit, you're shown an Error Message. You're given the boundary-value and told if you're above or below. Using the Limits report, you can evaluate if its even possible to reach a desired frequency or interval before trying a calculation.
Be advised going out of bounds can happen pretty easily. Thus the need for Limits checking and reporting.
Custom-Clock and In-Pin Edits
In previous versions, TimerCalc only allowed Integer input for a custom crystal clock. With the addition of In-Pin clocking, the edit-box now supports floating point numbers with certain restrictions. The reason is to allow In-Pin clocks as low as 0.1 Hz. Low frequency clocks make possible large interval counting such 24, 48 and lots more hours.
Previous versions of TimerCalc would display an Offset number at times. Its long-winded value often seemed daunting or distracting. To help tame the confusion, results are formatted in simpler terms.
Another value has been added to help make results more friendly. Delta re-states any Offset as a percent of your Ask. Said another way, Delta expresses a percent-difference from what you -wanted- compared to what the hardware will deliver.
If Delta is small, you can likely ignore Offset. If Delta is large, Offset may be significant. Its up to you to decide how much Offset is too much.
Note that Offset and Delta are always present in each calculation report. This is different from previous versions. If there is zero Offset and zero Delta, you'll see that in the report.
The calculated results in previous versions were not well formatted. In V1.30, numbers are now placed in a more consistent format. Please note they're not justified. The decimal point varies from row to row as before.
The big difference you'll notice is Headings, Values and Units line up in a reasonable order. Its easier to read.
Copy-Paste, Undo-Redo for Clock and ASK inputs
You may have noticed previous versions of TimerCalc prevented you from Copy-Pasting to edit-boxes. V1.30 supports Copy, Paste, Undo and Redo operations (for ASK and Clock input). You can copy numbers from the message screen and paste them into your Ask edit-box.
In previous versions, Scientific Notation (for inputs like Ask and Clock) was supported. I didn't really announce this. I used a capital E (such as 5E6 = 5 MHz) to support sci-entry. I decided the capital E was blending in with numbers making it somewhat confusing to read. I changed the E to e. The lower-case e seems to contrast better with numbers (5e6 = 5MHz).
Please note: The Sci-Notation is meant to be used with small exponents, like 3 and 6. Examples for frequency: 500e3 is the same as 500,000 = 500 kHz. 5e6 is the same as 5,000,000 = 5 MHz. Watch out you don't enter 5e66 or 500e33. This will leave you in a stuck situation. The blinking-prompt will stay stuck on that particular edit box -- until you notice and fix the huge exponent. Then all should work fine.
Detailed Low Resolution Warnings
V1.30 now provides added detail regarding Low PWM and Low Phase Resolution. Instead of being told you have (>1%, >1degree), you are now shown the step-size in per-cent or degrees. This info appears in both Code and Message Windows.
If RTM_TimerCalc's beeping makes you crazy, you can shut it off in the Message-Filter section of Settings Grid. You can also shut down Warnings and Error messages.
Other Added Settings
Additional settings for Limits have been added to allow you to take control should RTM_TimerCalc prevent you from trying something wild. Specifically, I call your attention to the new 'Limits' section of settings. These entries allow you to do things you probably shouldn't. But if you're in a "what-if" state of mind, its nice to have a few choices should the need arise.
Locale Fix for Commas
I never tried to make RTM_TimerCalc for languages other than English. But in some countries, the Locale rules caused it to substitute commas for decimal points in generated code. Eventually, I fixed the problem by forcing the App. to use US-Locale rules when generating code. After code generation, normal OS defined Locale formatting -might- work correctly in different countries (not tested).
Arduino Timers and Prescalers are Integer counter/dividers. They divide whatever clock frequency you route to them. They are not and can not be used as a regular frequency synthesizer! There are frequency gaps you cannot reach without harsh tactics (changing the clock frequency).
That said, RTM_TimerCalc lets you exploit supported Arduino Timers for frequencies and Intervals that can be reached. If what you Ask for can't be delivered by the hardware, the App. throws a warning: and shows the difference. Its up to you to decide if the output serves your need. If not, it may be time to consider a synthesizer module (like an AD9833) and investigate if that gets you where you wish to go.
Have fun using RTM_TimerCalc V1.3.