Piezo and Tone Frequency
Selection: The code must be edited to cater to the attributes of the
piezo buzzer attached to the circuit. The piezo buzzer used to design and
configure the provided code is the PS1230P02BT. The sample rate, as well as the
frequency of the tones themselves must be altered to the frequency
characteristics of any piezo.
Sine Table Generation: In
the example code, a basic 64 entry sine table is used for creating the output on
the DAC. However this creates a lower quality output, and thus can be scaled to
a higher resolution to have a clearer output. The recommendation is that the
sine table is either a predefined array of constants, or generated once upon
startup using the MathACL module.
Sample Rate and Timer: The
sample rate of this subsystem, declared in the code as gSampleRate, must be
equivalent to the period of the timer module. For example, if the desired
gSampleRate is 20kHz, the timer period must be 0.05ms. Increasing the sample
rate can provide better audio quality and smoother sine wave reproduction.