I am glad to report that I was able to progress from idea to prototype stage. I was able to stitch the individual modules together to build a working solution. Bear in mind that this is no way a professional setup, but, it will be a good tool for enthusiasts. This is going to be a long post, but, stick with me and perhaps you could learn something interesting from this. Ok. Let us dive in.
The first piece of the puzzle was to display the selected frequency on screen. As I detailed earlier I have some 4 digit 7 segment LED modules on hand and I prefer to use them for the display needs. When I bought the LED module, it was a very odd for the reason that there was no good datasheet and so I had to fiddle with my Bus Pirate and try to display something on it. It was very frustrating at that time. But, I was able to unearth a datasheet and was able to finally understand the LED module’s expectations and Bus Pirate’s usage with help from Ian of Dangerous Prototypes. I always tell Ian that he has a great smile. Watch some of his videos and you will know what I mean. Ian is very down to earth and friendly. If you are hearing about Bus Pirate for the first time, then, please visit Dangerous Prototypes to learn more about this wonderful debugging tool. Coming back to the LED module, here is the forum link where I documented the Bus Pirate commands. You can also see a grainy picture of my Bus Pirate and the taste of success of displaying a 0 on screen. All these happened late last year.
Around the same time, Aaron, another forum user raised an issue of chaining multiple displays together and I put together a Shift register based dual LED displays that could be controlled via Energia. You could read more about this from this forum link. I have included the Energia code and a video of displaying numbers on 2 LED displays as part of the forum link. Even though I just show 2 LED displays, the idea could be extended to 8 such displays using a single shift register. Energia is an Arduino type IDE for Texas Instruments Launchpad for MSP430 series. Energia is code compatible with Arduino and so it has some merits. First it was only $4.30 including shipping when they originally released and so I jumped on that offer. It is still available through distribution channels and through TI’s e-store for $9.99 at the time of this writing. So it is very cheap compared to our Arduino. You can take a look at the board layout and Pin mappings here. TI actually included the development board, male and female edge connectors, crystal, additional controller, USB cables and some cool stickers nicely boxed up and delivered through FedEx. So it was a great buy if you ask me.
So I knew how these LED displays operate and was planing to write some wrapper functions to make our job here easier. Accidentally I stumbled upon the work by gblanton. Gblanton has already done the heavy lifting for us in terms of writing a useful class library for Arduino for the exact same display. I tried it out and found that it worked well and so I do not have to reinvent the wheel here. I just adopted his work for our Function Generator’s display.
The AD9850 signal generator module could go up to 40 MHz and it can generate the waveform down to 1 Hz. This made me initially decide that I could have a way to switch the selection from Hz to kHz to MHz. But, on second thoughts I added 2 displays so as to get all 8 digits (40, 000, 000). Now we can precisely control every single digit from Hz to MHz instead of rounding the frequency to fit the 4 digit display. Gblanton has some sample code as part of his website and so I see no reason to include my code here. If you find his work useful, then, please leave a note of thanks.
Now the 2 displays are sitting side by side and they display 10, 000, 000 (10 MHz) as the initial value.
Time to move to the next step. Using the rotary encoder to change the value of a selected digit and then, use the push button as part of the encoder to switch between different digits. Stand by, more to come on the usage of Rotary Encoders in the next post.