Coding Like A Champ

So yesterday I got back into programming the control software for my home brew rig. One thing that I needed to tackle, among all the other things I got done, was to display and format the VFO frequency. Now anyone who has used some of the original authors code and or a derivative of the various Arduino VFO’s you can find on the web, will know that how they format and display the frequency as say 7.000.230 is not very readable. In fact, it requires a lot of mental gymnastics to work out which digit is being divided down for and what the remainder is to be displayed. So I set about to doing this my way so that my display code is much more readable and that it was obvious which digit was being calculated and displayed.

So, I created a function that takes two parameters and returns the remainder. N is the digit to be split off the number and int_ToSplit is the actual displayed VFO frequency. So if the VFO was 7,125.000 and you wanted to know the digit in the thousands column, all you have to do is Do_SplitInt(3, 7125000), where 3 is the 4th column from the right, C being every count starts at 0 and all.

From here its just a matter of wrapping it up in a sprintf call and using some variables and the actual formatting when using a TFT display where you have to give X and Y coordinates to position each number becomes rather trivial.

Cant say I am a design genius, but at least its all my own work, thought and design.