PSoC 6 Peripheral Driver Library
Sample and Hold Functions

General Description

This function enables sample and hold of the CTDAC output.


void Cy_CTB_DACSampleAndHold (CTBM_Type *base, cy_en_ctb_sample_hold_mode_t mode)
 Perform sampling and holding of the CTDAC output. More...

Function Documentation

◆ Cy_CTB_DACSampleAndHold()

void Cy_CTB_DACSampleAndHold ( CTBM_Type base,
cy_en_ctb_sample_hold_mode_t  mode 

Perform sampling and holding of the CTDAC output.

To perform a sample or a hold, a preparation step must first be executed to open the required switches. Because of this, each sample or hold requires three function calls:

  1. Call this function to prepare for a sample or hold
  2. Enable or disable the CTDAC output
  3. Call this function again to perform a sample or hold

It takes 10 us to perform a sample of the CTDAC output to provide time for the capacitor to settle to the new value.

basePointer to structure describing registers
modeMode to prepare or perform a sample or hold, or disable the ability
Function Usage
/* Scenario: Opamp0 has been configured as a buffer for the CTDAC output
* with the sample and hold (S/H) capacitor connected.
* This code samples the CTDAC output once. */
/* Prepare for sample. */
/* Turn on DAC output. */
/* Sample DAC output. */
/* Allow time for voltage to settle across the hold capacitor. */
Function Usage
/* Scenario: Turn off the CTDAC output to save power and
* hold the output voltage across the S/H capcitor.
* The DAC output needs to be turned on and sampled periodically.
* See the device datasheet for the hold duration. */
/* Prepare for hold. */
/* Turn off DAC output. */
/* Hold voltage. */