Question
Using the STM32F4-Discovery Board, you are to design an assambely language Programmable Function Generator (PFG) capable of producing two different electrical signal waveforms at seven
Using the STM32F4-Discovery Board, you are to design an assambely language Programmable Function Generator (PFG) capable of producing two different electrical signal waveforms at seven different signal frequencies. The PFG is to meet the following requirements.
1) Two different waveforms are to be generated, as selected by the user.
A) Sawtooth the signal is to rise linearly from 0 volts to 3 volts during each time period of length T.
(This should be the default waveform after the system is reset.)
B)Triangle the signal is to rise linearly from 0 volts to 3 volts in the first half of each period, and then decrease linearly from 3 volts to 0 volts in the second half of each period, where the total period length is T.
2).Each period of the waveform is to comprise 100 data points, spaced evenly across the period. The data are to be 12-bit unsigned numbers, ranging from 0 to 4095. These correspond to voltages from 0v to 3v, respectively.
3) There is to be an off condition (no generated waveform) plus seven user-selectable waveform periods: [OFF, 0.5s, 1.0s, 1.5s, 2.0s, 2.5s, 3.0s, 3.5s]. These periods must be accurate to the nearest microsecond (thus requiring the use of a programmable timer.)
4) All timing is to be produced by periodic interrupts from Timer 6 on the microcontroller.
5) The waveform period and type are to be selected with the User Button on the board as
follows.
A) The PFG is to initially be off.
B) Each push of the button selects the next period in the list:
[OFF, 0.5s, 1.0s, 1.5s, 2.0s, 2.5s, 3.0s, 3.5s]
C) Allow time for the period to be examined before pressing the button again.
D) However - if the button is pressed twice within a 2-second interval, the waveform type is to be changed to the other format (Sawtooth to Triangle, or vice-versa).
6) The User Button is to trigger an interrupt each time it is pressed all responses to the User Button should be done by an interrupt handler. The User Button should be debounced, as necessary, to prevent more than one action per button press.
7) The blue LED is to blink at the rate of the selected waveform period.
8) LEDs 4-3-5 (green-orange-red) are to display a 3-bit binary number (0 to 7), indicating which of the 8 waveform periods (OFF through 3.5s) is currently selected.
9) The digital data values of the waveform are to be converted to analog voltages by the microcontrollers digital-to-analog converter (DAC). The DAC output to be connected to GPIOA pin PA4.
10) The data written to the DAC is also to be written to a global variable named DACvalue, which is to be displayed in the Logic Analyzer window of the Keil debugger. This will show the generated waveform, including both magnitude and frequency.
For extra credit replace the triangular waveform with a sinusoidal waveform, oscillating between 0 and 4095.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started