- Demo of power on/reset wave config, square wave w/ freq. And real-time duty cycle adjustments
- Demo of alternative waveforms (no freq adjustments)
- Demo of alt. Waveform freq.
- Demo of alt. Waveforms & rejection of duty cycle adjustment
The behavior of the function generator is the same output that one would see out of a normally-operated waveform generator. There is an interface to which you can set the waveform type, frequency, and duty cycle (done via the keypad), and there is a resulting voltage observable at the
- Waveform Types: Square wave (with variable duty cycle), sinusoid, sawtooth (ramp), and triangle.
-
Adjustable Frequencies: 100 Hz, 200 Hz, 300 Hz, 400 Hz, 500 Hz (
$\pm$ 2.5 Hz in error). -
Voltage Levels: All waveforms have a
$V_{pp}$ of 3.0 V and are DC-biased at 1.5 V. - Default Power-Up State: 100 Hz square wave with a 50% duty cycle.
We utilized our previous SPI_DAC library, tim2 library, and keypad library for this project. We also wrote a new wave_generator library that integrates and abstracts away the tim2 and SPI_DAC libraries, allowing for an easy wave_generator API from main.
-
Initialization: The main program handles keypad and
wave_generatorinitializations (wave_generatorinternally configures thetim2andspi_dacsettings). -
Main Loop: The program enters a
whileloop that continuously polls the keypad and feeds that input directly intoupdate_waveform. This essentially allows the keypad library to listen for requests from the keypad and direct thewaveform_generatorlibrary on what to do with$V_{OUT}$ on the DAC.
There is a global state struct that describes the current waveform being outputted on the DAC. On initialization, this waveform structure is instantiated with values that default to outputting a 50% duty cycle, 100 Hz square wave.
