XMC Peripheral Library for XMC4000 Family
2.1.16
|
Data Structures | |
struct | XMC_DAC_CH_CONFIG_t |
struct | XMC_DAC_t |
Macros | |
#define | XMC_DAC0 ((XMC_DAC_t *)DAC_BASE) |
#define | XMC_DAC_NO_CHANNELS (2U) |
#define | XMC_DAC_PATTERN_RECTANGLE {31U, 31U, 31U, 31U, 31U, 31U, 31U, 31U, 31U} |
#define | XMC_DAC_PATTERN_SINE {0U, 6U, 12U, 17U, 22U, 26U, 29U, 30U, 31U} |
#define | XMC_DAC_PATTERN_TRIANGLE {0U, 4U, 8U, 12U, 16U, 19U, 23U, 27U, 31U} |
#define | XMC_DAC_SAMPLES_PER_PERIOD (32U) |
Enumerations |
Functions | |
void | XMC_DAC_CH_DisableEvent (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_DisableOutput (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_DisableOutputNegation (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_DisablePatternSignOutput (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_EnableEvent (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_EnableOutput (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_EnableOutputNegation (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_EnablePatternSignOutput (XMC_DAC_t *const dac, const uint8_t channel) |
XMC_DAC_CH_OUTPUT_SCALE_t | XMC_DAC_CH_GetOutputScale (XMC_DAC_t *const dac, const uint8_t channel) |
uint16_t | XMC_DAC_CH_GetRampStart (XMC_DAC_t *const dac, const uint8_t channel) |
uint16_t | XMC_DAC_CH_GetRampStop (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_Init (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_CONFIG_t *const config) |
bool | XMC_DAC_CH_IsFifoEmpty (const XMC_DAC_t *const dac, const uint8_t channel) |
bool | XMC_DAC_CH_IsFifoFull (const XMC_DAC_t *const dac, const uint8_t channel) |
bool | XMC_DAC_CH_IsOutputEnabled (const XMC_DAC_t *const dac, const uint8_t channel) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_SetFrequency (XMC_DAC_t *const dac, const uint8_t channel, const uint32_t frequency) |
void | XMC_DAC_CH_SetMode (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_MODE_t mode) |
void | XMC_DAC_CH_SetOutputOffset (XMC_DAC_t *const dac, const uint8_t channel, const uint8_t offset) |
void | XMC_DAC_CH_SetOutputScale (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_OUTPUT_SCALE_t scale) |
void | XMC_DAC_CH_SetPattern (XMC_DAC_t *const dac, const uint8_t channel, const uint8_t *const pattern) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_SetPatternFrequency (XMC_DAC_t *const dac, const uint8_t channel, const uint32_t frequency) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_SetRampFrequency (XMC_DAC_t *const dac, const uint8_t channel, const uint32_t frequency) |
void | XMC_DAC_CH_SetRampStart (XMC_DAC_t *const dac, const uint8_t channel, const uint16_t start) |
void | XMC_DAC_CH_SetRampStop (XMC_DAC_t *const dac, const uint8_t channel, const uint16_t stop) |
void | XMC_DAC_CH_SetSignedDataType (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_SetTrigger (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_TRIGGER_t trigger) |
void | XMC_DAC_CH_SetUnsignedDataType (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_SoftwareTrigger (XMC_DAC_t *const dac, const uint8_t channel) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_StartDataMode (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_TRIGGER_t trigger, const uint32_t frequency) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_StartNoiseMode (XMC_DAC_t *const dac, const uint8_t channel, const XMC_DAC_CH_TRIGGER_t trigger, const uint32_t frequency) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_StartPatternMode (XMC_DAC_t *const dac, const uint8_t channel, const uint8_t *const pattern, const XMC_DAC_CH_PATTERN_SIGN_OUTPUT_t sign_output, const XMC_DAC_CH_TRIGGER_t trigger, const uint32_t frequency) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_StartRampMode (XMC_DAC_t *const dac, const uint8_t channel, const uint16_t start, const uint16_t stop, const XMC_DAC_CH_TRIGGER_t trigger, const uint32_t frequency) |
XMC_DAC_CH_STATUS_t | XMC_DAC_CH_StartSingleValueMode (XMC_DAC_t *const dac, const uint8_t channel) |
void | XMC_DAC_CH_Write (XMC_DAC_t *const dac, const uint8_t channel, const uint16_t data) |
void | XMC_DAC_Disable (XMC_DAC_t *const dac) |
void | XMC_DAC_DisableSimultaneousDataMode (XMC_DAC_t *const dac) |
void | XMC_DAC_Enable (XMC_DAC_t *const dac) |
void | XMC_DAC_EnableSimultaneousDataMode (XMC_DAC_t *const dac) |
bool | XMC_DAC_IsEnabled (const XMC_DAC_t *const dac) |
void | XMC_DAC_SimultaneousWrite (XMC_DAC_t *const dac, const uint16_t data0, const uint16_t data1) |
Detailed Description
DAC driver uses DAC peripheral to convert digital value to analog value. XMC4000 microcontroller family has two DAC channels of 12-bit resolution and maximum conversion rate of 2MHz with full accuracy and 5MHz with reduced accuracy. It consists of inbuilt pattern generator, ramp generator and noise generator modes. Additionally, waveforms can be generated by configuring data registers in single value mode and in data mode. It has DMA handling capability to generate custom waveforms in data mode without CPU intervention.
DAC driver features:
- Configuration structure XMC_DAC_CH_CONFIG_t and initialization function XMC_DAC_CH_Init() to initialize DAC and configure channel settings
- Pattern Generator Mode:
- DAC is configured in pattern generator mode using XMC_DAC_CH_StartPatternMode()
- XMC_DAC_CH_SetPattern() is used to set the waveform pattern values in pattern register for one quarter
- Allows to change the trigger frequency using XMC_DAC_CH_SetPatternFrequency()
- Single Value Mode:
- DAC is configured in single value mode using XMC_DAC_CH_StartSingleValueMode()
- Allows to change the trigger frequency using XMC_DAC_CH_SetFrequency()
- Data Mode:
- DAC is configured in data mode using XMC_DAC_CH_StartDataMode()
- Allows to change the trigger frequency using XMC_DAC_CH_SetFrequency()
- Ramp Mode:
- DAC is configured in ramp generator mode using XMC_DAC_CH_StartRampMode()
- Allows to change the trigger frequency using XMC_DAC_CH_SetRampFrequency()
- Allows to set the start and stop values of the ramp using XMC_DAC_CH_SetRampStart() and XMC_DAC_CH_SetRampStop()
- Noise Mode:
- DAC is configured in noise mode using XMC_DAC_CH_StartNoiseMode()
- Allows to change the trigger frequency using XMC_DAC_CH_SetFrequency()
- Allows to change the scale, offset dynamically using XMC_DAC_CH_SetOutputScale() and XMC_DAC_CH_SetOutputOffset() respectively
- Allows to select one of the eight possible trigger sources using XMC_DAC_CH_SetTrigger()
- 2 DAC channels can be used in synchronization in single value mode and data mode to generate two analog outputs in sync. XMC_DAC_EnableSimultaneousDataMode()
Macro Definition Documentation
#define XMC_DAC0 ((XMC_DAC_t *)DAC_BASE) |
DAC module register base
#define XMC_DAC_NO_CHANNELS (2U) |
DAC maximum channels
#define XMC_DAC_PATTERN_RECTANGLE {31U, 31U, 31U, 31U, 31U, 31U, 31U, 31U, 31U} |
First quarter Rectangle waveform samples
#define XMC_DAC_PATTERN_SINE {0U, 6U, 12U, 17U, 22U, 26U, 29U, 30U, 31U} |
First quarter Sine waveform samples
#define XMC_DAC_PATTERN_TRIANGLE {0U, 4U, 8U, 12U, 16U, 19U, 23U, 27U, 31U} |
First quarter Triangle waveform samples
#define XMC_DAC_SAMPLES_PER_PERIOD (32U) |
DAC samples per period in pattern mode
Enumeration Type Documentation
enum XMC_DAC_CH_MODE_t |
Operating modes of DAC
Scaling of the input data
enum XMC_DAC_CH_STATUS_t |
Return types of the API's
enum XMC_DAC_CH_TRIGGER_t |
Trigger sources for the data update
Function Documentation
void XMC_DAC_CH_DisableEvent | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Disables service request by clearing SREN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_EnableEvent()
void XMC_DAC_CH_DisableOutput | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Channel channel output is disabled by clearing the ANAEN bit of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- A call to this API stops driving the converted digital input to its output.
- Related APIs:
- XMC_DAC_CH_EnableOutput(), XMC_DAC_CH_IsOutputEnabled()
void XMC_DAC_CH_DisableOutputNegation | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Description:
- Disables output negation.
- Negation is disabled by clearing NEGATE bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Note:
- Negation feature is not applicable for XMC45 devices. Calling this API in XMC45 devices doesn't have any effect.
- Related APIs:
- XMC_DAC_CH_EnableOutputNegation()
void XMC_DAC_CH_DisablePatternSignOutput | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Disables output sign information for Pattern Mode.
- Sign output is disabled by clearing SIGNEN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Note:
- Call this API if the channel is set to Pattern mode.
void XMC_DAC_CH_EnableEvent | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Enables service request by setting SREN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1). Trigger signal is generated upon conversion of each data.
- Note:
- The service request signal can be connected to NVIC, DMA.
- Related APIs:
- XMC_DAC_CH_DisableEvent()
void XMC_DAC_CH_EnableOutput | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Channel channel output is enabled by setting the ANAEN bit of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- Note:
- tSTARTUP time for DAC analog output starts after the ANAEN bit is set to one. After the expiry of the startup time the default value is driven to DAC output and a new value can be written.
- Related APIs:
- XMC_DAC_CH_DisableOutput(), XMC_DAC_CH_IsOutputEnabled()
void XMC_DAC_CH_EnableOutputNegation | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Description:
- Enables output negation.
- By negating the DAC value is converted to its two's complement values. Can be used in Ramp mode to generate negative ramp. Negation in enabled by setting NEGATE bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Note:
- Negation feature is not applicable for XMC45 devices. Calling this API in XMC45 devices doesn't have any effect.
- Related APIs:
- XMC_DAC_CH_DisableOutputNegation(), XMC_DAC_CH_StartRampMode()
void XMC_DAC_CH_EnablePatternSignOutput | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Enables the output sign information for Pattern Mode.
- Sign output is enabled by setting SIGNEN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Note:
- Call this API if the channel is set to Pattern mode.
XMC_DAC_CH_OUTPUT_SCALE_t XMC_DAC_CH_GetOutputScale | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- XMC_DAC_CH_OUTPUT_SCALE_t
- Description:
- Returns scaling information for the data. The input data could be either up-scaled (multiplied), down-scaled (divided) or without scaling (as is).
Scaling factor is determined by reading bit-fields MULDIV and SCALE of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_SetOutputScale()
uint16_t XMC_DAC_CH_GetRampStart | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- uint16_t
- Description:
- Gets the ramp start value by reading DATA0 bit-field of DAC0DATA register (for channel 0) / DATA1 bit-field of DAC1DATA register (for channel 1). If the ramp counter reaches its stop value, it restarts from the start value with the next trigger pulse.
- Note:
- Call this API if the channel is set to Ramp mode.
uint16_t XMC_DAC_CH_GetRampStop | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- uint16_t
- Description:
- Gets the ramp stop value by reading DATA0 bit-field of DAC01DATA register (for channel 0) / DATA1 bit-field of DAC01DATA register (for channel 1). If the ramp counter reaches its stop value, it restarts from the start value with the next trigger pulse.
- Note:
- Call this API if the channel is set to Ramp mode.
void XMC_DAC_CH_Init | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_CONFIG_t *const | config | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number config Pointer to the DAC channel configuration structure
- Returns
- None
- Description:
- Initialises and configures the DAC channel with the configuration date pointed by config.
- DAC channel is initialised by configuring the registers DAC0CFG0 and DAC0CFG1 registers (for channel 0) / DAC1CFG0 and DAC1CFG1 registers (for channel 1). It enables the channel output by calling XMC_DAC_CH_EnableOutput().
bool XMC_DAC_CH_IsFifoEmpty | ( | const XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- bool
true - if FIFO is empty
false - if FIFO is not empty
- Description:
- Returns FIFO status.
- FIFIO empty status is determined by reading FIFOEMP bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_IsFifoFull()
bool XMC_DAC_CH_IsFifoFull | ( | const XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- bool
true - if FIFO is full
false - if FIFO is not full
- Description:
- Returns FIFO status.
- FIFIO full status is determined by reading FIFOFUL bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_IsFifoEmpty()
bool XMC_DAC_CH_IsOutputEnabled | ( | const XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- bool
true - if analog output is enabled
false - if analog output is disabled
- Description:
- Returns the status of DAC analog output.
- Channel channel output enabled or disabled is determined by reading the ANAEN bit of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_EnableOutput(), XMC_DAC_CH_DisableOutput()
XMC_DAC_CH_STATUS_t XMC_DAC_CH_SetFrequency | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number frequency Waveform frequency in [Hz]
- Returns
- XMC_DAC_CH_STATUS_t
- Description:
- Sets the frequency of DAC channel.
- The value frequency acts as clock divider. The smallest frequency divider value is 16. A valid frequency value should be within the range XMC_DAC_MIN_FREQ_DIVIDER to XMC_DAC_MAX_FREQ_DIVIDER. A value outside this range is considered as in valid and API returns error. Frequency frequency is configured by setting FREQ bit-field of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1).
- Note:
- Call this API only for Single value mode, Data mode and Noise mode. Call XMC_DAC_CH_SetRampFrequency() in case of Ramp mode and XMC_DAC_CH_SetPatternFrequency() in case of Pattern mode.
void XMC_DAC_CH_SetMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_MODE_t | mode | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number mode DAC operation mode
- Returns
- None
- Description:
- Sets the operating mode for the channel by setting the MODE bit-field of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1). Different modes of DAC operation are defined by enum XMC_DAC_CH_MODE_t.
void XMC_DAC_CH_SetOutputOffset | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint8_t | offset | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number offset
- Returns
- None
- Description:
- Sets the offset value.
Offset range:0 - 255
interpreted as : -128 to 127 (twos complement) in signed mode and 0 to 255 in unsigned mode.
- Note:
- Scaling can be applied to the output data after adding the offset value.
- Channel channel offset value is loaded to the bit-field DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_SetOutputScale()
void XMC_DAC_CH_SetOutputScale | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_OUTPUT_SCALE_t | scale | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number scale Input data scaling
- Returns
- None
- Description:
- Data of the channel is scaled.
- The data can either be scaled up-scaled (multiplied), down-scaled (divided) or no scaling (as is) based on the value of scale. Scaling is configured by setting bit-fields MULDIV and SCALE of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1).
- Related APIs:
- XMC_DAC_CH_GetOutputScale()
void XMC_DAC_CH_SetPattern | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint8_t *const | pattern | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number pattern Pointer to the data table
- Returns
- None
- Description:
- The data for the Pattern mode is written to the DAC0PATL and DAC0PATH registers. The API is called by XMC_DAC_CH_StartPatternMode().
- Note:
- Call this API if the channel is set to Pattern mode.
XMC_DAC_CH_STATUS_t XMC_DAC_CH_SetPatternFrequency | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number frequency in [Hz]
- Returns
- XMC_DAC_CH_STATUS_t
- Description:
- Sets the frequency of DAC channel by calling XMC_DAC_CH_SetFrequency().
- For the Pattern mode, the frequency of operation depends on the total number of sample points XMC_DAC_SAMPLES_PER_PERIOD. Frequency frequency is multiplied by the total number of sample points, so that each trigger instance converts all the sample points of the pattern.
- Note:
- Call this API only if the channel is set to Pattern mode.
- Related APIs:
- XMC_DAC_CH_StartPatternMode()
< DAC samples per period in pattern mode
XMC_DAC_CH_STATUS_t XMC_DAC_CH_SetRampFrequency | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number frequency [Hz]
- Returns
- XMC_DAC_CH_STATUS_t
- Description:
- Sets the frequency of DAC channel by calling XMC_DAC_CH_SetFrequency().
- For the Ramp mode, the frequency of operation depends on the total number of sample points (stop - start). Frequency frequency is multiplied by the total number of sample points, so that each trigger instance converts all the sample points of ramp.
- Note:
- Call this API only if the channel is set to Ramp mode.
- Related APIs:
- XMC_DAC_CH_StartRampMode()
void XMC_DAC_CH_SetRampStart | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint16_t | start | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number start Ramp start point [0-4095]
- Returns
- None
- Description:
- Sets the ramp start value by writing to the register DAC0DATA (for channel 0) or DAC1DATA (for channel 1). If the ramp counter reaches its stop value, it restarts from the start value with the next trigger pulse. Ensure start value is lower than the stop value.
- Note:
- Call this API if the channel is set to Ramp mode. Start value is a 12 bit data.
void XMC_DAC_CH_SetRampStop | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint16_t | stop | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number stop Ramp stop point [0-4095]
- Returns
- None
- Description:
- Sets the ramp stop value by writing to the bit-field DATA0 (for channel 0) or DATA1 (for channel 1) of DAC01DATA register. If the ramp counter reaches its stop value, it restarts from the start value with the next trigger pulse. Ensure stop value is higher than the start value.
- Note:
- Call this API if the channel is set to Ramp mode. Stop value is a 12 bit data.
- Related APIs:
- XMC_DAC_CH_GetRampStop(), XMC_DAC_CH_SetRampStart()
void XMC_DAC_CH_SetSignedDataType | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Sets the channel's data to signed type by setting SIGN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1). The data for the conversion would then be treated as signed data type.
- Note:
- Offset and scaling can be applied to the data by calling XMC_DAC_CH_SetOutputOffset(), XMC_DAC_CH_SetOutputScale().
- Related APIs:
- XMC_DAC_CH_SetUnsignedDataType()
void XMC_DAC_CH_SetTrigger | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_TRIGGER_t | trigger | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number trigger Trigger source
- Returns
- None
- Description:
- Selects the trigger source for the channel by configuring the bits TRIGSEL & TRIGMOD of CFG register.
- Channel channel trigger source is selected by TRIGSEL bit-field of DAC0CFG1 register (for channel 0) / DAC1CFG1 register(for channel 1).
void XMC_DAC_CH_SetUnsignedDataType | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Sets the channel's data to unsigned type by clearing SIGN bit of DAC0CFG0 register (for channel 0) / DAC1CFG0 register (for channel 1). The data for the conversion would then be treated as unsigned data type.
- Note:
- Offset and scaling can be applied to the data by calling XMC_DAC_CH_SetOutputOffset(), XMC_DAC_CH_SetOutputScale().
- Related APIs:
- XMC_DAC_CH_SetSignedDataType()
void XMC_DAC_CH_SoftwareTrigger | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- A call to this API generates a trigger pulse by setting SWTRIG bit of DAC0CFG1 register (for channel 0) / DAC1CFG1 register (for channel 1), provided the TRIGMOD bit of CFG register is set to XMC_DAC_CH_TRIGGER_SOFTWARE.
- Note:
- If the channel is set to simultaneous data mode, SWTRIG bit of channel 1 is not valid. Only SWTRIG bit of channel 0 is used for channel 1.
- Related APIs:
- XMC_DAC_CH_SetTrigger(), XMC_DAC_CH_EnableEvent()
XMC_DAC_CH_STATUS_t XMC_DAC_CH_StartDataMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_TRIGGER_t | trigger, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number trigger Data points update trigger frequency Waveform frequency [Hz]
- Returns
- XMC_DAC_CH_STATUS_t status
- Description:
- Sets the channel to Data mode. Trigger and frequency are configured.
- Note:
- Call XMC_DAC_CH_Write() API to write the data. Call XMC_DAC_EnableSimultaneousDataMode() to switch to Simultaneous data mode.
XMC_DAC_CH_STATUS_t XMC_DAC_CH_StartNoiseMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const XMC_DAC_CH_TRIGGER_t | trigger, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number trigger Data points update trigger frequency Waveform frequency in [Hz]
- Returns
- XMC_DAC_CH_STATUS_t status
- Description:
- Sets the channel to Noise mode. Trigger and frequency are configured. On a trigger the DAC starts converting and drives to channel output.
- Related APIs:
- XMC_DAC_CH_Init()
XMC_DAC_CH_STATUS_t XMC_DAC_CH_StartPatternMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint8_t *const | pattern, | ||
const XMC_DAC_CH_PATTERN_SIGN_OUTPUT_t | sign_output, | ||
const XMC_DAC_CH_TRIGGER_t | trigger, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number pattern Data table of a pattern sign_output Sign information of the waveform trigger Data points update trigger frequency Waveform frequency in [Hz]
- Returns
- XMC_DAC_CH_STATUS_t status
- Description:
- Sets the channel to Pattern mode. Trigger, frequency, sign output and data are configured. On a trigger, the pattern values are converted and driven to channel output.
- Related APIs:
- XMC_DAC_CH_Init(), XMC_DAC_CH_DisablePatternSignOutput()
XMC_DAC_CH_STATUS_t XMC_DAC_CH_StartRampMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint16_t | start, | ||
const uint16_t | stop, | ||
const XMC_DAC_CH_TRIGGER_t | trigger, | ||
const uint32_t | frequency | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number start Start point of the ramp [0-4095] stop Stop point of the ramp [0-4095] trigger Data points update trigger frequency Ramp frequency in [Hz]
- Returns
- XMC_DAC_CH_STATUS_t status
- Description:
- Sets the channel to Ramp mode. Trigger, frequency, start and stop values are configured. On a trigger ramp values are converted and driven to channel output. Start and stop have the range of [0-4095]. Stop should be equal or greater than start.
- Note:
- If the ramp counter reaches its stop value, it restarts from the start value with the next trigger pulse.
- Related APIs:
- XMC_DAC_CH_Init(), XMC_DAC_CH_GetRampStart(), XMC_DAC_CH_GetRampStop()
XMC_DAC_CH_STATUS_t XMC_DAC_CH_StartSingleValueMode | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number
- Returns
- None
- Description:
- Sets the channel to Single Value Mode by calling XMC_DAC_CH_SetMode().
- Note:
- Call XMC_DAC_CH_Write() API to write the data.
- Related APIs:
- XMC_DAC_CH_Write()
void XMC_DAC_CH_Write | ( | XMC_DAC_t *const | dac, |
const uint8_t | channel, | ||
const uint16_t | data | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module channel DAC channel number data Data to be written [0-4095]
- Returns
- None
- Description:
- Writes the data to the channel's DATA register.
- The data is then converted and driven to the output. If the trigger is set, On a trigger event the data in DATA register is converted and driven to channel output. Data data is written to the channel by loading data to DATA0 bit-field of DAC0DATA (for channel 0) / DATA1 bit-field of DAC1DATA register (for channel 1). data has the range of [0-4095].
- Note:
- The API can be used for Single Value Mode, Data Mode (Individual) & Ramp Mode. Call XMC_DAC_CH_EnableOutput() API to enable analog output.
void XMC_DAC_Disable | ( | XMC_DAC_t *const | dac | ) |
- Parameters
-
dac Pointer to an instance of DAC module
- Returns
- None
- Description:
- Disables DAC clock and resets DAC.
- DAC clock is disabled by setting DAC bit of CGATSET1 register. DAC is reset by setting DACRS bit of PRSET1 register.
- Related APIs:
- XMC_DAC_IsEnabled(), XMC_DAC_Enable()
void XMC_DAC_DisableSimultaneousDataMode | ( | XMC_DAC_t *const | dac | ) |
- Parameters
-
dac Pointer to an instance of DAC module
- Returns
- None
- Description:
- DAC switches to independent data mode from simultaneous Data mode.
- Independent data mode is the default data mode. Simultaneous data mode is disabled by clearing DATMOD bit of DAC0CFG1 register.
void XMC_DAC_Enable | ( | XMC_DAC_t *const | dac | ) |
- Parameters
-
dac Pointer to an instance of DAC module
- Returns
- None
- Description:
- Enables DAC clock and releases DAC reset.
- Enabling DAC is the first step of DAC initialisation. This API is called by XMC_DAC_CH_Init(). DAC clock is enabled by setting DAC bit of CGATCLR1 register. DAC reset is released by setting DACRS bit of PRCLR1 register.
- Related APIs:
- XMC_DAC_IsEnabled(), XMC_DAC_Disable(), XMC_DAC_CH_Init()
void XMC_DAC_EnableSimultaneousDataMode | ( | XMC_DAC_t *const | dac | ) |
- Parameters
-
dac Pointer to an instance of DAC module
- Returns
- None
- Description:
- DAC switches to Simultaneous data mode from Independent data mode.
- Independent data mode is the default data mode. Simultaneous data mode is enabled by setting DATMOD bit of DAC0CFG1 register.
- Note:
- Set channel 0 and channel 1 to Data mode before calling this API.
bool XMC_DAC_IsEnabled | ( | const XMC_DAC_t *const | dac | ) |
- Parameters
-
dac Pointer to an instance of DAC module
- Returns
- bool
true - if DAC is enabled
false - if DAC is disabled
- Description:
- Returns the state of the DAC.
- DAC enabled status is determined by referring to DACRS bit of PRSTAT1 register.
- Related APIs:
- XMC_DAC_Enable(), XMC_DAC_Disable()
void XMC_DAC_SimultaneousWrite | ( | XMC_DAC_t *const | dac, |
const uint16_t | data0, | ||
const uint16_t | data1 | ||
) |
- Parameters
-
dac Pointer to an instance of DAC module data0 Data for DAC channel 0 [0-4095] data1 Data for DAC channel 1 [0-4095]
- Returns
- None
- Description:
- The data (data0 & data1) to be converted by channel 0 & channel 1 are updated to DATA1 bit-fields of DAC01DATA register. data0 and data1 have the range of [0-4095].
- Note:
- Channel 0 and Channel 1 should be set to simultaneous data mode before calling this API.
- Related APIs:
- XMC_DAC_EnableSimultaneousDataMode()
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by 1.8.11