Back in my engineering days, I worked on a team project involving the creation of a digital sine wave generator using an FPGA (please don’t laugh… please don’t laugh…). A Field Programmable Gate Array is a small chip, similar to an integrated circuit, which allows its users to define how it operates when powered up. Unusual for people used to programming in C, C++ or any of the other textual formats, this Xilinx FPGA used a graphical programming language all its own… and written in a program that was undoubtedly ahead of its time, but clumsy, idiosyncratic and often unstable, even for the early 2000’s.
There are a handful of techniques known for developing a digital sine wave generator, but probably the most common of them makes ample use of the CORDIC algorithm, whose acronym stands for COrdinate Rotation DIgital Computer.
With a couple of physical dials connected to the FPGA to set the desired amplitude and frequency, and a digital-to-analog converter on the output, we were able to create a lovely stepped sine wave; add a low pass filter, and there’s your clean waveform.
While practicing with HTML5 on my home computer, I thought to revisit the CORDIC routine and digital sine wave system again, and built a version that shows it in action. I can’t post a working version of the script here, but I *can* put up a few screenshots. So I’ll do just that. Note that each of the BANG! points is a single setting that the generator held for a specific period of time, as defined by fSamp.