Create VFD Bit Pattern With Help Of Google Sheets
With a successful integration test of our salvaged vacuum fluorescent display (VFD) we proceed to a few other tasks. On the hardware side, we'll need to simplify our power supply situation. Our test had three separate AC plugs, we only really need one. We'll also need to transfer what's on the breadboard to a prototype circuit board.
On the software side, things are less clear because we're still coming up with ideas on what to do with a salvaged VFD. Our very simple PIC driver code merely controls a pattern of bits, each bit representing a segment to be illuminated. This gives us a lot of flexibility but so far these bit patterns have been created using pencil and paper and quite time consuming. Once we have a project in mind we can write code specific to a theme, but until then it's wide-open bits.
Well, at least we can streamline the pencil and paper system somewhat. The logic is not difficult, just time consume, and should be easy to automate. I started by creating a HTML form and laying out checkbox controls. I got as far as designing a JavaScript structure for checkbox click events when I realized everything is on a grid and looks a lot like a spreadsheet.
That realization led me to put my basic HTML and JavaScript on hold and switch to investigate what I can do in Google Sheets. The key that made it all possible is the BINTOHEX()
function that reads a number, interpret it as binary, and translate to hexadecimal. This is the core functionality for my pattern generation and I was able to build everything else around it.
Here's the initial build, with a fully populated grid of checkboxes and a test pattern for me to verify things were working.
Once verified, I deleted the checkboxes that didn't have a corresponding segment. This array now properly corresponds to our specific VFD.
Now creating a bit pattern is as simple as checking on the segments I wish to have illuminated. Here's the pattern for "12:00", the canonical Hello World for a time-based VFD display.
I thought it would be fun to make this available for anyone to play with, but that requires keeping the sheet and its formulas fixed while allowing people to check and uncheck boxes. Unfortunately "view only" sharing does not allow checkbox manipulation, and "editable" sharing also allows modifying the sheet formula. Until I figure out how to do what I want, it was shared as "View Only" to the general public.