ADC_MEASUREMENT_ADV: Methods

Modbus RTU XMC47

ADC_MEASUREMENT_ADV
Methods
DAVE_APP_VERSION_t ADC_MEASUREMENT_ADV_GetAppVersion (void)
 Get ADC_MEASUREMENT_ADV APP version.
void ADC_MEASUREMENT_ADV_StartADC (const ADC_MEASUREMENT_ADV_t *const handle_ptr)
 Starts the VADC request source.
void ADC_MEASUREMENT_ADV_SoftwareTrigger (const ADC_MEASUREMENT_ADV_t *const handle_ptr)
 Starts the conversion of the required channels.
ADC_MEASUREMENT_ADV_STATUS_t ADC_MEASUREMENT_ADV_Init (const ADC_MEASUREMENT_ADV_t *const handle_ptr)
 Initializes the ADC_MEASUREMENT_ADV APP Instance.
__STATIC_INLINE uint16_t ADC_MEASUREMENT_ADV_GetResult (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the conversion result.
__STATIC_INLINE
XMC_VADC_DETAILED_RESULT_t 
ADC_MEASUREMENT_ADV_GetDetailedResult (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the complete conversion result.
__STATIC_INLINE uint16_t ADC_MEASUREMENT_ADV_GetFifoResult (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the conversion result.
__STATIC_INLINE
XMC_VADC_DETAILED_RESULT_t 
ADC_MEASUREMENT_ADV_GetFifoDetailedResult (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the complete conversion result.
__STATIC_INLINE
ADC_MEASUREMENT_ADV_FAST_COMPARE_t 
ADC_MEASUREMENT_ADV_GetFastCompareResult (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the result of fast conversion.
ADC_MEASUREMENT_ADV_STATUS_t ADC_MEASUREMENT_ADV_SetFastCompareValue (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, uint16_t compare_value)
 Sets the fast conversion value.
void ADC_MEASUREMENT_ADV_SetSubtractionValue (const ADC_MEASUREMENT_ADV_t *const handle_ptr, ADC_MEASUREMENT_ADV_SUBTRATION_t subtraction_alignment, uint16_t subtraction_value)
 Set the subtraction value if a result difference mode is required.
void ADC_MEASUREMENT_ADV_ConfigureChannelClass (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, const XMC_VADC_GROUP_CLASS_t *config)
 Configures the input class (Resolution and Sampling time).
void ADC_MEASUREMENT_ADV_SetAlternateReference (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, const XMC_VADC_CHANNEL_REF_t reference_select)
 Selects alternate reference voltage for the channel.
void ADC_MEASUREMENT_ADV_SetChannelGain (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, const ADC_MEASUREMENT_ADV_GAIN_t gain_factor)
 Sets the channel gain.
void ADC_MEASUREMENT_ADV_SelectBoundary (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, XMC_VADC_BOUNDARY_SELECT_t boundary, XMC_VADC_CHANNEL_BOUNDARY_t boundary_selection)
 Select the boundary for the channel.
void ADC_MEASUREMENT_ADV_SetBoundaryUpper (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, uint32_t boundary_value)
 Sets the upper boundary value for the channel.
void ADC_MEASUREMENT_ADV_SetBoundaryLower (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr, uint32_t boundary_value)
 Sets the lower boundary value for the channel.
XMC_VADC_CHANNEL_ALIAS_t ADC_MEASUREMENT_ADV_GetAliasValue (const ADC_MEASUREMENT_ADV_CHANNEL_t *const handle_ptr)
 Returns the configured alias value.
void ADC_MEASUREMENT_ADV_SetIclass (const ADC_MEASUREMENT_ADV_t *const handle_ptr)
 Enables uniform conversion configurations across slaves.

Methods


Function Documentation

void ADC_MEASUREMENT_ADV_ConfigureChannelClass ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
const XMC_VADC_GROUP_CLASS_t *  config 
)

Configures the input class (Resolution and Sampling time).

Parameters:
iclass_selectionSelect the input class to be configured
Pass XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 to configure group input class 0. Pass XMC_VADC_CHANNEL_CONV_GROUP_CLASS1 to configure group input class 1.
configConstant pointer to the input class configuration.
group_numThe group number whose input class needs to be configured.
Returns:
None
Description:
Configures the input class for standard conversion ( GxICLASS[0] OR GxICLASS[1]). A call to this API would configure the Resolution and sampling time for standard conversion. The group-specific input class registers define the sample time and data conversion mode for each channel of the respective group. And each channel can use these by selecting the input class in GxCHCTRy.ICLSEL.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  // converted result will be of 8bit resolution.
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  XMC_VADC_GROUP_CLASS_t res_8bit = {
      .conversion_mode_standard = XMC_VADC_CONVMODE_8BIT,
      .sample_time_std_conv     = 10U
  };

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  ADC_MEASUREMENT_ADV_ConfigureChannelClass(&ADC_MEASUREMENT_ADV_0_Channel_A,&res_8bit);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 968 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

XMC_VADC_CHANNEL_ALIAS_t ADC_MEASUREMENT_ADV_GetAliasValue ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr)

Returns the configured alias value.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
XMC_VADC_CHANNEL_ALIAS_t returns XMC_VADC_CHANNEL_ALIAS_DISABLED if the alias is not applicable to the channel or if alias is not enabled
else it returns the alias value.
Description:
Return the alias value for the channel. If the alias feature is enabled then the channels CH-0 or CH-1 can convert any other channel's input signal. The API returns XMC_VADC_CHANNEL_ALIAS_DISABLED if the Channel is neither CH-0 nor CH-1. Also the value XMC_VADC_CHANNEL_ALIAS_DISABLED is returned when the CH-0 or CH-1 is not configured with alias. If either CH-0 or CH-1 is configured with alias then the appropriate aliased channel number is returned. A call to this API would access the register GxALIAS.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP as ADC_SCAN.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
uint16_t result[16];
uint16_t i = 0U;

void channel_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;
  XMC_VADC_CHANNEL_ALIAS_t alias_ch;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Check if the given channel is aliased.
  alias_ch = ADC_MEASUREMENT_ADV_GetAliasValue(&ADC_MEASUREMENT_ADV_0_Channel_A);

  if(XMC_VADC_CHANNEL_ALIAS_DISABLED == alias_ch)
  {
     // do something
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 1054 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_num, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

DAVE_APP_VERSION_t ADC_MEASUREMENT_ADV_GetAppVersion ( void  )

Get ADC_MEASUREMENT_ADV APP version.

Returns:
DAVE_APP_VERSION_t APP version information (major, minor and patch number)
Description:
The function can be used to check application software compatibility with a specific version of the APP.

Example Usage:

 #include <DAVE.h>

 int main(void) {
   DAVE_STATUS_t init_status;
   DAVE_APP_VERSION_t version;

   // Initialize ADC_MEASUREMENT_ADV APP:
   // ADC_MEASUREMENT_ADV_Init() is called from within DAVE_Init().
   init_status = DAVE_Init();

   version = ADC_MEASUREMENT_ADV_GetAppVersion();
   if (version.major != 1U) {
     // Probably, not the right version.
   }

   // More code here
   while(1) {

   }
   return (0);
 }

Definition at line 682 of file ADC_MEASUREMENT_ADV.c.

__STATIC_INLINE XMC_VADC_DETAILED_RESULT_t ADC_MEASUREMENT_ADV_GetDetailedResult ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr)

Returns the complete conversion result.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
XMC_VADC_DETAILED_RESULT_t returns the complete result register
Description:
Return the completely 32 bit result register (GxRESy). In the APP each channel is configured to a particular group result register (excluding FIFO). The result of conversion as well as other information is returned from this API. The detailed result contains result of the most recent conversion, the channel number requested the conversion, valid flag, converted request source, fast compare result, the result data reduction counter and the EMUX channel number (if GxRES[0] only). In polling mechanism the converted result can be read out after checking the valid flag bit. The result register is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).
Note:
This API is not Applicable for reading the result from the result FIFO registers Use ADC_MEASUREMENT_ADV_GetFifoDetailedResult in order to read the FIFO result.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)
#define QUEUE_SRC (0U)

XMC_VADC_DETAILED_RESULT_t result[2];
uint32_t queue_flag = 0U;

void adc_measurement_adv_callback(void)
{
  // Use the channel handle parameter in this format "<APP Name>_<CHANNEL Name>"
  result[0] = ADC_MEASUREMENT_ADV_GetDetailedResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetDetailedResult(&ADC_MEASUREMENT_ADV_0_Channel_B);

  if((result[0].converted_request_source == QUEUE_SRC) && (QUEUE_SRC == result[1].converted_request_source))
  {
    queue_flag++;
  }

}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

    // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(queue_flag != 0U);
  // do something

  while(1U)
  {
  }
}

Definition at line 731 of file ADC_MEASUREMENT_ADV.h.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

Returns the result of fast conversion.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
XMC_VADC_FAST_COMPARE_t fast conversion result.
Returns ::ADC_MEASUREMENT_ADV_FAST_COMPARE_HIGH if the sampled signal is greater than the compare value. Returns ::ADC_MEASUREMENT_ADV_FAST_COMPARE_LOW if the sampled signal is lower than the compare value. Returns ::ADC_MEASUREMENT_ADV_FAST_COMPARE_INVALID if there is no valid result available.
Description:
Returns the fast conversion result stored in the result register [GxRESy.FCR]. In the APP each channel is configured to a particular group result register (excluding FIFO). The result register is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).
Note:
This API is only applicable to read fast compare result of the particular channel.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and enable the refill.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable result event for Channel_A.
// Instantiate the interrupt APP.
// In the UI of the interrupt APP change the interrupt handler to "channel_event_callback"
// goto HW signal connectivity and connect event_result_Channel_A to interrupt APP.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
ADC_MEASUREMENT_ADV_FAST_COMPARE_t result[16];
uint16_t i = 0U;

void channel_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetFastCompareResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Set the threshold value as Vdd/2
  ADC_MEASUREMENT_ADV_SetFastCompareValue(&ADC_MEASUREMENT_ADV_0_Channel_A,512U);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  // Continuously trigger the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 1001 of file ADC_MEASUREMENT_ADV.h.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

__STATIC_INLINE XMC_VADC_DETAILED_RESULT_t ADC_MEASUREMENT_ADV_GetFifoDetailedResult ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr)

Returns the complete conversion result.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
XMC_VADC_DETAILED_RESULT_t returns the complete result register
Description:
Return the completely 32 bit FIFO result register (GxRESy). If result FIFO is configured then the results are available in the FIFO tail register. The result of conversion as well as other information is returned from this API. The detailed result contains result of the most recent conversion, the channel number requested the conversion, valid flag, converted request source, fast compare result, the result data reduction counter and the EMUX channel number (if GxRES[0] only). In polling mechanism the converted result can be read out after checking the valid flag bit. The result register is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).
Note:
This API is not Applicable for reading the result from channels which done use FIFO. Use ADC_MEASUREMENT_ADV_GetDetailedResult in order to read from a single result register.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_FIFO (16U)
XMC_VADC_DETAILED_RESULT_t result[16];
uint16_t i = 0U;
void adc_measurement_adv_callback(void)
{
  // Use the channel handle parameter in this format "<APP Name>_<CHANNEL Name>"
  result[i++] = ADC_MEASUREMENT_ADV_GetFifoDetailedResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[i++] = ADC_MEASUREMENT_ADV_GetFifoDetailedResult(&ADC_MEASUREMENT_ADV_0_Channel_B);

  if(MAX_FIFO == i)
  {
    i = (uint32_t)0;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 908 of file ADC_MEASUREMENT_ADV.h.

References ADC_MEASUREMENT_ADV_CHANNEL::group_index, and ADC_MEASUREMENT_ADV_CHANNEL::result_fifo_tail_number.

__STATIC_INLINE uint16_t ADC_MEASUREMENT_ADV_GetFifoResult ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr)

Returns the conversion result.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
uint16_t conversion result.
Range: [ 0x0 to 0xFFF] without any filters/ accumulation/ subtraction enabled.
Description:
Returns the converted result stored in the result FIFO register [GxRESy.RESULT]. If result FIFO is configured then the results are available in the FIFO tail register. The result register can only be read at the tail of the FIFO, This result register number is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).
Note:
This API is not Applicable for reading the result from channels which done use FIFO. Use ADC_MEASUREMENT_ADV_GetResult in order to read from a single result register.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto postprocessing Tab and select 8 stages FIFO for both Channel_A and Channel_B
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_FIFO (16U)
uint16_t result[16];
uint16_t i;
void adc_measurement_adv_callback(void)
{
  // Use the channel handle parameter in this format "<APP Name>_<CHANNEL Name>"
  result[i++] = ADC_MEASUREMENT_ADV_GetFifoResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[i++] = ADC_MEASUREMENT_ADV_GetFifoResult(&ADC_MEASUREMENT_ADV_0_Channel_B);

  if(MAX_FIFO == i)
  {
    i = (uint32_t)0;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

    // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 821 of file ADC_MEASUREMENT_ADV.h.

References ADC_MEASUREMENT_ADV_CHANNEL::group_index, and ADC_MEASUREMENT_ADV_CHANNEL::result_fifo_tail_number.

__STATIC_INLINE uint16_t ADC_MEASUREMENT_ADV_GetResult ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr)

Returns the conversion result.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
uint16_t conversion result.
Range: [ 0x0 to 0xFFF] without any filters/ accumulation/ subtraction enabled.
Description:
Return the converted result stored in the result register [GxRESy.RESULT]. In the APP each channel is configured to a particular group result register (excluding FIFO). The result register is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).
Note:
This API is not Applicable for reading the result from the result FIFO registers Use ADC_MEASUREMENT_ADV_GetFifoResult in order to read the FIFO result.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  // Use the channel handle parameter in this format "<APP Name>_<CHANNEL Name>"
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 638 of file ADC_MEASUREMENT_ADV.h.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

Initializes the ADC_MEASUREMENT_ADV APP Instance.

Parameters:
handle_ptrconstant pointer to the APP handle structure
Returns:
None
Description:
Initialize the ADC and all the required configurations. A call to this API would initialize the queue request source or the scan request source depending on the GUI selection. The initialization is taken up by calling ADC_QUEUE_Init() or ADC_SCAN_Init(). Following this the synchronous conversion related initializations are taken up. In the sync initialization the slave groups and the master group are powered down and either GxSYNCTR.STSEL (if Slave) or GxSYNCTR.EVALRy (if master) are configured. After the sync related configurations are completed the master group alone is powered on. Following this the result event or channel event related service request node configurations are done (if required). Then the GxCHCTR configurations are completed. After the channel initialization the result handling initializations are done. This entails configuring the GxRCR registers for result filtering, accumulation, subtraction and FIFO. After all these initialization are completed the channels configured in the GUI is inserted into the appropriate ADC_QUEUE or ADC_SCAN APP buffer. If the GUI check box "Insert channels at initialization" is enable then these entries is pushed to the Hardware.

Example Usage:

 #include <DAVE.h>
 int main(void)
 {
    DAVE_Init(); //ADC_MEASUREMENT_ADV_Init is called within DAVE_Init
    return 0;
 }

Definition at line 796 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_StartADC(), ADC_MEASUREMENT_ADV_STATUS_UNINITIALIZED, ADC_MEASUREMENT_ADV_CHANNEL::analog_io_config, ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, ADC_MEASUREMENT_ADV_CHANNEL::ch_num, ADC_MEASUREMENT_ADV::channel_array, ADC_MEASUREMENT_ADV::event_config, ADC_MEASUREMENT_ADV_CHANNEL::group_index, ADC_MEASUREMENT_ADV::init_state, ADC_MEASUREMENT_ADV::req_src, ADC_MEASUREMENT_ADV_CHANNEL::shs_gain_factor, ADC_MEASUREMENT_ADV::start_at_initialization, ADC_MEASUREMENT_ADV::total_number_of_channels, and ADC_MEASUREMENT_ADV::total_number_of_entries.

void ADC_MEASUREMENT_ADV_SelectBoundary ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
XMC_VADC_BOUNDARY_SELECT_t  boundary,
XMC_VADC_CHANNEL_BOUNDARY_t  boundary_selection 
)

Select the boundary for the channel.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
boundaryThe lower boundary or upper boundary of the channel to be configured.
boundary_selectionBoundary register selection for the particular channel.
Returns:
None
Description:
Select the boundary for the channel. This API will select either lower boundary or the upper boundary depending on boundary and configures the boundary_selection value into the GxCHCTRy.BNDSELL or GxCHCTRy.BNDSELU accordingly.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and enable the refill.
// Enable Wait for trigger for the Channel_A.
// Goto the Boundary Settings tab and select the channel name as Channel_A.
// Change the channel event from No to "If Result Inside Band".
// Change the "Generate boundary flag" to Yes/Non-Inverted.
// Instantiate the interrupt APP.
// In the UI of the interrupt APP change the interrupt handler to "channel_event_callback"
// goto HW signal connectivity and connect event_channel_Channel_A to interrupt APP.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
uint16_t result[16];
uint16_t i = 0U;

void channel_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Set the boundary selection for Channel_A lower Bound as Group Bound-1
  ADC_MEASUREMENT_ADV_SelectBoundary(&ADC_MEASUREMENT_ADV_0_Channel_A, XMC_VADC_BOUNDARY_SELECT_LOWER_BOUND,
                                      XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1);

  // Set the boundary selection for Channel_A upper Bound as Group Bound-0 and also the value as 2048U
  ADC_MEASUREMENT_ADV_SetBoundaryUpper(&ADC_MEASUREMENT_ADV_0_Channel_A, 2048U);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  // Continuously trigger the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 1014 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_num, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

void ADC_MEASUREMENT_ADV_SetAlternateReference ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
const XMC_VADC_CHANNEL_REF_t  reference_select 
)

Selects alternate reference voltage for the channel.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
reference_selectVoltage reference for the channel.
Returns:
None
Description:
Select the reference voltage for conversion. For XMC4000 series, an internal voltage reference (VARef) or an external voltage reference fed to Ch-0 can serve as a voltage reference for conversions. For XMC1000 series, an internal ground reference (Vss) or an external reference ground from CH-0 can serve as an alternate reference. A call to this API would configure the register bit field GxCHCTR.REFSEL.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_SCAN APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  // connect the alternate reference to the channel-0 pin of Channel_A's group.
  ADC_MEASUREMENT_ADV_SetAlternateReference(&ADC_MEASUREMENT_ADV_0_Channel_A, XMC_VADC_CHANNEL_REF_ALT_CH0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 979 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_num, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

void ADC_MEASUREMENT_ADV_SetBoundaryLower ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
uint32_t  boundary_value 
)

Sets the lower boundary value for the channel.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
boundary_valueThe boundary value that needs to be configured in the lower boundary register.
Returns:
None
Description:
Sets the lower boundary value for the channel. This API will set the lower boundary value depending on boundary selected for the channel in the GUI of the APP. Thus also configured in the API is either the register GLOBBOUND or GxBOUND.
Note:
This API will configure the lower boundary for the channel according to the selection done in the GUI. Runtime change of the lower boundary selection will not be handled by this API.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP as ADC_SCAN.
// Goto the Boundary Settings tab and select the channel name as Channel_A.
// Select the Upper boundary as Group boundary 1.
// Change the channel event from No to "If Result Inside Band".
// Change the "Generate boundary flag" to Yes/Non-Inverted.
// Instantiate the interrupt APP.
// In the UI of the interrupt APP change the interrupt handler to "channel_event_callback"
// goto HW signal connectivity and connect event_channel_Channel_A to interrupt APP.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
uint16_t result[16];
uint16_t i = 0U;

void channel_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Set the boundary selection for Channel_A lower Bound as Group Bound-1
  ADC_MEASUREMENT_ADV_SetBoundaryLower(&ADC_MEASUREMENT_ADV_0_Channel_A,1024);

  // Set the boundary selection for Channel_A upper Bound as Group Bound-0 and also the value as 2048U
  ADC_MEASUREMENT_ADV_SetBoundaryUpper(&ADC_MEASUREMENT_ADV_0_Channel_A,2048);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 1040 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle.

void ADC_MEASUREMENT_ADV_SetBoundaryUpper ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
uint32_t  boundary_value 
)

Sets the upper boundary value for the channel.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
boundary_valueThe boundary value that needs to be configured in the upper boundary register.
Returns:
None
Description:
Sets the upper boundary value for the channel. This API will set the upper boundary value depending on boundary selected for the channel in the GUI of the APP. Thus also configured in the API is either the register GLOBBOUND or GxBOUND.
Note:
This API will configure the upper boundary for the channel according to the selection done in the GUI. Runtime change of the Upper boundary selection will not be handled by this API.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP as ADC_SCAN.
// Goto the Boundary Settings tab and select the channel name as Channel_A.
// Select the Upper boundary as Group boundary 1.
// Change the channel event from No to "If Result Inside Band".
// Change the "Generate boundary flag" to Yes/Non-Inverted.
// Instantiate the interrupt APP.
// In the UI of the interrupt APP change the interrupt handler to "channel_event_callback"
// goto HW signal connectivity and connect event_channel_Channel_A to interrupt APP.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
uint16_t result[16];
uint16_t i = 0U;

void channel_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Set the boundary selection for Channel_A lower Bound as Group Bound-1
  ADC_MEASUREMENT_ADV_SetBoundaryLower(&ADC_MEASUREMENT_ADV_0_Channel_A,1024);

  // Set the boundary selection for Channel_A upper Bound as Group Bound-0 and also the value as 2048U
  ADC_MEASUREMENT_ADV_SetBoundaryUpper(&ADC_MEASUREMENT_ADV_0_Channel_A,2048);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 1027 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle.

void ADC_MEASUREMENT_ADV_SetChannelGain ( const ADC_MEASUREMENT_ADV_CHANNEL_t *const  handle_ptr,
const ADC_MEASUREMENT_ADV_GAIN_t  gain_factor 
)

Sets the channel gain.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
gain_factorThe gain factor value.
Returns:
None
Description:
Set the gain value for the particular channel. This API would set the SHS gain factor for the channel. The input voltage will get a gain proportional to the selected gain_factor then will be converted by the ADC.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_SCAN APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  // select the gain value of 12
  ADC_MEASUREMENT_ADV_SetChannelGain(&ADC_MEASUREMENT_ADV_0_Channel_A, ADC_MEASUREMENT_ADV_GAIN_12);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 992 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, ADC_MEASUREMENT_ADV_CHANNEL::ch_num, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

Sets the fast conversion value.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
compare_valueconstant pointer to the channel handle structure.
Returns:
None
Description:
Returns the converted result stored in the result register [GxRESy.RESULT]. In the APP each channel is configured to a particular group result register. If FIFO is enabled for the particular channel this reads the fast compare result from the FIFO tail register. The result register is defined in the channel handle structure ADC_MEASUREMENT_ADV_CHANNEL_t. Hence this API shall call be called with a pointer to the channel handle of type ADC_MEASUREMENT_ADV_CHANNEL_t (Directly use the channel handle related macros which are defined in adc_measure_adv_conf.h).

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and enable the refill.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable result event for Channel_A.
// Instantiate the interrupt APP.
// In the UI of the interrupt APP change the interrupt handler to "result_event_callback"
// goto HW signal connectivity and connect event_result_Channel_A to interrupt APP.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
ADC_MEASUREMENT_ADV_FAST_COMPARE_t result[16];
uint16_t i = 0U;

void result_event_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetFastCompareResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Set the threshold value as Vdd/2
  ADC_MEASUREMENT_ADV_SetFastCompareValue(&ADC_MEASUREMENT_ADV_0_Channel_A,512U);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  // Continuously trigger the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 921 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV_STATUS_FAILURE, ADC_MEASUREMENT_ADV_STATUS_SUCCESS, ADC_MEASUREMENT_ADV_CHANNEL::ch_handle, and ADC_MEASUREMENT_ADV_CHANNEL::group_index.

void ADC_MEASUREMENT_ADV_SetIclass ( const ADC_MEASUREMENT_ADV_t *const  handle_ptr)

Enables uniform conversion configurations across slaves.

Parameters:
handle_ptrconstant pointer to the channel handle structure. (Use the channel handle related macros which are defined in adc_measure_adv_conf.h)
Returns:
None
Description:
Enables uniform conversion configurations across slaves. The ADC_QUEUE configures the input class settings for the master group. When slaves need to convert the input signals at the same configuration as the master group then a call to this API is needed. A call to this API will ensure that the master and the slave channels are converting the input signals at the same resolution and sampling time.
Note:
  • ADC_ADVANCE_MEASURE APP will configure the input class used by ADC_QUEUE or ADC_SCAN in the channel configuration. Thus the input class is either GxICLASS[0] or GxICLASS[1]. The slaves channels are also configured by the same input class number in the GxCHCTR.ICLSEL. A call to this API will copy the configurations from the master groups input class(GxICLASS[z]) to the slaves groups input class (GyICLASS[z], where in x is the master group, y is the slave group and z is the input class number which is common across master and slave).

  • The channel iclass can be changed to global iclass at any time by calling runtime APIs. This API cannot support such a situation.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 1.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and enable the refill.
// Enable Wait for trigger for the Channel_A.
// Goto the Sync. Conversion tab and select the synchronized groups as 1 slave.
// Goto the Sync Master check box for the Channel_A and enable it.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define MAX_LOCAL_BUFFER (16U)
uint16_t result[16],sync_result[16];
uint16_t i = 0U;

void adc_measurement_adv_callback(void)
{
  result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  sync_result[i++] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A_SLAVE_A);
  if(MAX_LOCAL_BUFFER == i)
  {
    i = 0U;
  }
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  //Set the same conversion characteristics for the slave groups channels as well
  ADC_MEASUREMENT_ADV_SetIclass(&ADC_MEASUREMENT_ADV_0);

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 1090 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV::group_index.

void ADC_MEASUREMENT_ADV_SetSubtractionValue ( const ADC_MEASUREMENT_ADV_t *const  handle_ptr,
ADC_MEASUREMENT_ADV_SUBTRATION_t  subtraction_alignment,
uint16_t  subtraction_value 
)

Set the subtraction value if a result difference mode is required.

Parameters:
handle_ptrconstant pointer to the APP handle structure
subtraction_alignmentThe result alignment in the result register.
subtraction_valueconstant value that is used for subtraction.
Returns:
None
Description:
Set the subtraction value in the result register 0 [GxRES[0].RESULT]. In the subtraction mode the result register 0 is used as the subtrahend. Any channel in the GUI which has selected the subtraction mode will have its converted value subtracted from the value stored in the result register-0. This can be used as an offset for the converted values.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Select the request source APP from ADC_SCAN to ADC_QUEUE.
// Goto the sequence plan and select Channel_A at position-0 and Channel_B at position-1.
// Enable Wait for trigger for the Channel_A.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

#define VOLTAGE_OFFSET (50U)
uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  ADC_MEASUREMENT_ADV_SetSubtractionValue(&ADC_MEASUREMENT_ADV_0,ADC_MEASUREMENT_ADV_SUBTRATION_12BIT_RIGHT_ALIGN,
                                           VOLTAGE_OFFSET);

  // Start the queue conversion sequence
  ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
  }
}

Definition at line 941 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV::group_index.

Starts the conversion of the required channels.

Parameters:
handle_ptrconstant pointer to the APP handle structure
Returns:
None
Description:
Trigger a load event for the required channels thus starting the conversion of the ADC channels. If scan request source is selected then this API would write to GxASMR.LDEV bit, causing the conversion to start. If queue request source is selected then this API would write to GxQMR0.TREV bit. At the time of writing to TREV bit for the queue. If there was queue entry waiting in the queue buffer for a hardware trigger, writing to TREV bit triggers the conversion for that entry.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_SCAN/ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 718 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV::group_index, and ADC_MEASUREMENT_ADV::req_src.

void ADC_MEASUREMENT_ADV_StartADC ( const ADC_MEASUREMENT_ADV_t *const  handle_ptr)

Starts the VADC request source.

Parameters:
handle_ptrconstant pointer to the APP handle structure
Returns:
None
Description:
This API would start the request source of the VADC. After this API is invoked the ADC is ready for accepting conversion requests. If scan request source is selected then this API would write to GxARBPR.ASEN1 bit. If queue request source is selected then this API would write to GxARBPR.ASEN0 bit. At the time of writing to ASEN0 bit for the queue, If there was queue entry waiting in the queue buffer without waiting for a hardware trigger, this API would start the conversion of such a queue.

Example Usage:

// Initialize the ADC_MEASUREMENT_ADV APP. Set the number of required channels to 2.
// Goto interrupts tab enable request source interrupt.
// Goto the ADC_SCAN/ADC_QUEUE APP and enable the request source interrupt.
// Generate the code and build.
// Replace this in the main.c.
#include <DAVE.h>                 //Declarations from DAVE Code Generation (includes SFR declaration)

uint16_t result[2];
void adc_measurement_adv_callback(void)
{
  result[0] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_A);
  result[1] = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel_B);
}

int main(void)
{
  DAVE_STATUS_t status;

  status = DAVE_Init();           // Initialization of DAVE APPs

  if(status == DAVE_STATUS_FAILURE)
  {
    // Placeholder for error handler code. The while loop below can be replaced with an user error handler.
    XMC_DEBUG("DAVE APPs initialization failed\n");

    while(1U)
    {

    }
  }

  // Start the selected request source
  ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);

  while(1U)
  {
    // Continuously re-trigger the scan conversion sequence
    ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);
  }
}

Definition at line 695 of file ADC_MEASUREMENT_ADV.c.

References ADC_MEASUREMENT_ADV::group_index, and ADC_MEASUREMENT_ADV::req_src.

Referenced by ADC_MEASUREMENT_ADV_Init().