So we were asked to reproduce the function generator and oscilloscope as a virtual instrument for our final exam. But I'd like to focus on the function generator. The audio generator GW Instek GAG-809/810 has only a single button for the waveform wherein the user would just press it repeatedly to show the desired waveform (i.e., sine wave, square wave). Yeap, the audio generator only have the two waveform but our professor wanted us to add the generator's feature, that is, for the users to be able to display the wave into sawtooth and triangle wave.

So how do we construct it, that different wave forms would display everytime we press the button?

4 Years
Discussion Span
Last Post by albucurus

You can count the button presses in a counter.

counter = 0  (at start)
user press button
counter = counter + 1 display waveform  (counter = 1)
user press button
counter = counter + 1 display sawtooth  (counter = 2)
user press button
counter = counter + 1 display triangle wave  (counter = 3)
user press button
counter = counter + 1 (counter = 4)
if(counter == 4)
    counter = 1;
    display wave form

Maybe this help you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.