RTM_TimerCalc v1.20 Is Out Now!

1 post / 0 new
Runtime Micro's picture
Runtime Micro
Joined: 07/24/2016 - 9:18am
RTM_TimerCalc v1.20 Is Out Now!

RTM_TimerCalc V1.20 is released! Its been heavily reworked. Here are some highlights on what it can do.

A view of RTM_TimerCalc -- Version 1.20

Better Code Generation

The first version used a flawed code approach. I was setting TCCRB before writing Output Compares and Modes. This was bad as Timers had their Clock enabled once TCCRB was loaded! The counter was running while other registers were being written! Not good.

CTC-Mode-12 revealed the code order problem. Phased Square Waves could swap positions and worse! The fix was turn off the Clock, load all registers, then allow the Clock to run. Once code flowed in this fashion, results were predictable and repeatable. This method is now applied to all Timer modes.

Here's a code snippet for 90 degree phase shifted square waves. Note the register ordering;

// RTM_TimerCalc 1.20,  RuntimeMicro.com
// Timer-3 Mode_12_16Bit_CTC_TOP_is_ICR

TCCR3B = 0x18; // Disable Timer Clock 
TCCR3A = 0x50; // 0101 0000

ICR3 = 8000-1;
OCR3A = (int) (ICR3 * 0.01);
OCR3B = (int) (ICR3 * 0.51);

pinMode(5, OUTPUT); // OC3a
pinMode(2, OUTPUT); // OC3b

TCCR3B |= 1; // Prescale=1, Enable Timer Clock

PWM Resolution

Claiming WYSIWYG operation for the first version was premature. The reason was at small Counter values, only large duty cycle steps were possible. The WYSIWYG Chart Sliders were telling a different story. They were wrong!

I set out to restore the ability for WYSIWYG to be accurate no matter what settings were entered. It seemed easy at first. Unfortunately, the underlying VB Code was not structured to allow this in a seamless manner. It took some time to fix.

This version warns you of low PWM and low Phase-Shift resolution. The WYSIWYG Chart will show only the possible duty cycle steps available. You'll notice it takes larger steps as Resolution goes down. Now, calculations and C++ code reflect the situation appropriately. Its up to you to decide if the results are what you need.

I think its safe to say version 1.20 delivers on WYSIWYG PWM.  Smile

Display Improvements

The first version WYSIWYG Chart came with fixed fonts for Title, X-axis Readouts and Duty Cycle per-cent. In Windows 10, this didn't always look good. So I added the ability for you to pick the Fonts for Chart text as well as Duty per-cent. That should make things easier for anyone who wants a custom display. Just click the Options button to make your changes.

With regard to the Settings-Grid, you now have the ability to change its font for easier viewing. Another feature is you can instantly tell which settings you have customized (shown in bold) and which are still at their default values. As before, you can revert any single-setting (or all of them) using a mouse-right-click on the Grid.

Image shows Settings Grid view within RTM_TimerCalc application.

Enhanced Warning System

Inherent in the use of Arduino Timers is the possibility of making subtle mistakes. For example, if you fail to include an Interrupt ISR routine but still enable an Interrupt -- crazy symptoms can appear. Version 1.20 adds warnings to help sidestep problems like this and more.

To better grab your attention, sections of some Warning Messages are colored Blue to stand out. Also, some parts of the resulting code will be Blue too. The colored text does not affect copy-paste operations. You can disable the text coloring in the Settings area.

One serious warning has been added to flat-out Stop you from copying invalid Code. If you make any changes to settings or WYSIWYG controls, an internal flag is set. Trying to copy Code will be blocked and you'll see a pop-up warning you to re-calculate! After you do, you can copy as usual. This is intended to prevent you from using Code that does not reflect your most recent changes!

Extended Frequency Range

Scanning the web, I discovered Timer code allowing waveform frequencies as high as 1/2 the Standard 16 MHz clock. I wondered why RTM_TimerCalc dropped out above 4 MHz. A small tweak in VB code fixed things so outputs as high as 8 MHz were possible (in certain Modes only). This forced quite a rewrite of Error Message code but now things seem to work well.

I have more to share about range limits and text-color high-lights. But for now, be assured there's lots of extra's in this version.

New Version Check

The first release of RTM_TimerCalc had no way to let you know an update was available. Version 1.20 includes a background thread that checks if a newer Version is ready at RuntimeMicro.com. If so, a new Toolbar Button appears far right. Click that button to reach the new Download file.

NOTE: you can disable this feature in Settings.

Website Help Page

Yeah, I know. Up to now, there really wasn't a document that explained a lot of the application's details. And the app's Help link just lead you to a Forum for Example Articles.

Now there is a reasonable Help page. RTM_TimerCalc's Help menu-item with take you directly to a Forum designated for Help-type pages. Its OK to post your questions in this Forum too. So, if you have questions or suggestions, let me hear from you!

BUGS in RTM_TimerCalc

This software is written and tested by just one person -- me. There's no way I could catch every possible Bug and flaw. They're in there! For Version 1.20, I tripled my test time and took detailed Data across all supported Timers and Modes of Nano, Uno and 2560 MCU's.

Hopefully, I shook out the big issues. If not, at least there is a way to know when an update is available.

So far, no one has called me out on any of version 1.01 failings or flaws. Possibly, version 1.20 gives correct results every time. Smile

But if not, I won't be surprised. If you discover a problem, please post it in the RTM_TimerCalc Forum or contact me thru the website.