D/A converter exercises
Direct digital synthesis
Write a timer interrupt service routine that can generate a variable frequency sinusoidal signal using one of the DACs. In order to support this, a single period of the sinusoidal pattern should be stored in an array (phase-to-amplitude lookup table). Use 8-bit resolution and store 256 samples in the array. Use a 16-bit variable (phase register) to store the actual phase of the sinusoidal signal. In each execution of the interrupt service routine this variable should be incremented by a given step size (tuning word). The higher 8 bits of the phase register should be used to pick up the next DAC value from the array. A flag bit should be used to enable/disable signal generation.