This application note provides a short description of how to use the STM8L-DISCOVERY as a basic wave generator for various waveforms such as sine, sinc (sin(x)/x), square, ramp and sawtooth signals. More generally, this document describes STM8L on-chip DAC (digital-to-analog converter) peripheral settings when used with the DMA (direct memory access) controller.
This document explains how to configure the STM8L-DISCOVERY evaluation board to generate various periodic waveforms such as sine, sinc (sin(x)/x), square, ramp, and sawtooth signals. The application utilizes the microcontroller's on-chip Digital-to-Analog Converter (DAC) peripheral in conjunction with the Direct Memory Access (DMA) controller.
| Supported Waveforms | Ramp, Square, SineC (sin(x)/x), Sine, Sawtooth |
|---|---|
| Frequency Range | 30 Hz to 22.5 kHz |
| Resolution Tables | 65 and 130 samples |
| Output Voltage Range | 0 to 3 V |
The STM8L-DISCOVERY evaluation board, specifically using its on-board LEDs, LCD display, and USER push-button.
Waveforms are generated by storing sample tables in Flash memory and sending them cyclically to the DAC using a DMA transaction synchronized by TIM4 timer.
The DAC output is calculated as Vout = 3V * (DOR / 4096), where DOR is the 12-bit digital sample value.