6.8.1.2.2 Workflow

  1. Create a temporary variable to track the current DAC output value.
    uint16_t i = 0;
    
  2. Enter an infinite loop to continuously output new conversion values to the DAC.
    while (1) {
    
  3. Write the next conversion value to the DAC, so that it will be output on the device's DAC analog output pin.
    dac_chan_write(&dac_instance, DAC_CHANNEL_0, i);
    
  4. Increment and wrap the DAC output conversion value, so that a ramp pattern will be generated.
    if (++i == 0x3FF) {
        i = 0;
    }