Skip to content

A Digital-to-Analog Converter (DAC) transforms digital signals into analog signals by mapping digital values to specific voltages. This process effectively creates continuous analog waveforms from discrete digital data. DACs play a vital role in electronic systems by enabling the generation of diverse waveforms.

Initialization sequence

Note

1. First start by calling the initialization function of the DAC spin.dac.initConsValue(DAC_NUM).
2. Second enter the integer value to send to the DAC spin.dac.setConstValue(DAC_NUM, DAC_CHAN, DAC_VALUE)

Example

spin.dac.initConstValue(2); // DAC 2 initialization
spin.dac.setConstValue(2, 1, 2048);

Conversion from numerical to analog value

The value we can send to the DAC is an integer between 0 and 4096, this value is then converted to voltage between 0 and 2.048V. For example :

spin.dac.setConstValue(2, 1, 2048);
Generate a 1.024V signal.

dac value

Example

For a pratical example of the DAC see the example : - Signal generation

API Reference

Class DacHAL

ClassList > DacHAL

Public Functions

Type Name
void currentModeInit (uint8_t dac_number, hrtim_tu_t tu_src)
void initConstValue (uint8_t dac_number)
void setConstValue (uint8_t dac_number, uint8_t channel, uint32_t const_value)
void slopeCompensation (uint8_t dac_number, float32_t peak_voltage, float32_t low_voltage)

Public Functions Documentation

function currentModeInit

void DacHAL::currentModeInit (
    uint8_t dac_number,
    hrtim_tu_t tu_src
) 

function initConstValue

void DacHAL::initConstValue (
    uint8_t dac_number
) 

function setConstValue

void DacHAL::setConstValue (
    uint8_t dac_number,
    uint8_t channel,
    uint32_t const_value
) 

function slopeCompensation

void DacHAL::slopeCompensation (
    uint8_t dac_number,
    float32_t peak_voltage,
    float32_t low_voltage
) 


The documentation for this class was generated from the following file docs/core/zephyr/modules/owntech_spin_api/zephyr/src/DacHAL.h