Configuration Parameter |
Selectable Option/Value |
Description |
Select DAC output pins |
GPIO 25--GPIO 26 |
Select the output pin/pins |
Sample time (sec) |
-1 (inherited) or specify |
Specify sample time for the block |
Port Name |
Port Type |
Date Type |
Description |
GPIOxx |
Scaler |
Double |
DAC value for the GPIO pin(it should be in a range of 0 - 255) |
Use the Digital to Analog Convertor (DAC) Block to generate analog signals.
The DAC block takes inputs as raw data (between 0 - 255) and generated output analog signals according to the following equation.
Analog output voltage = VREF x INPUT / 255
Currently, this block is only support for ESP32 & ESP32S2 families. ESP32S3 & ESP32C3 does not have hardware built-in DAC.
Demo file : esp32_dac_demo.slx
This demo shows how to use the DAC module with DAC_block . The DAC pin (GPIO25) generates a Sinusoidal Waveform with 0 - 2.56v with a frequency of 10 rad/sec.
Connect the DAC pin (GPIO25) to an oscilloscope to observe the wave form.
The generated waveform should be as below