PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Conversion Functions
PDL API Reference » AUTONOMOUS ANALOG (Autonomous Analog Block) » SAR ADC (Successive-Approximation Register Analog to Digital Converter) » Functions

## General Description

## Functions
__STATIC_INLINE bool | Cy_AutAnalog_SAR_IsBusy (uint8_t sarIdx)
| Provides the status of the ADC conversion execution at the time of the request. More...
__STATIC_INLINE int32_t | Cy_AutAnalog_SAR_ReadResult (uint8_t sarIdx, cy_en_autanalog_sar_input_t input, uint8_t channel)
| Provides the conversion data for the dedicated channel. More...
float32_t | Cy_AutAnalog_SAR_CountsTo_Volts (uint8_t sarIdx, bool sarLP, uint8_t sarSequencer, cy_en_autanalog_sar_input_t sarInput, uint8_t sarChannel, uint32_t VrefmV, int32_t sarCounts)
| Converts the ADC output to Volts. More...
int16_t | Cy_AutAnalog_SAR_CountsTo_mVolts (uint8_t sarIdx, bool sarLP, uint8_t sarSequencer, cy_en_autanalog_sar_input_t sarInput, uint8_t sarChannel, uint32_t VrefmV, int32_t sarCounts)
| Converts the ADC output to milliVolts. More...
int32_t | Cy_AutAnalog_SAR_CountsTo_uVolts (uint8_t sarIdx, bool sarLP, uint8_t sarSequencer, cy_en_autanalog_sar_input_t sarInput, uint8_t sarChannel, uint32_t VrefmV, int32_t sarCounts)
| Converts the ADC output to microVolts. More...
int16_t | Cy_AutAnalog_SAR_CountsTo_degreeC (uint8_t sarIdx, bool sarLP, uint8_t sarSequencer, uint8_t sarChannel, int32_t sarCounts)
| Converts the ADC output to degrees Celsius. More...

## Function Documentation

## ◆ Cy_AutAnalog_SAR_IsBusy()

__STATIC_INLINE bool Cy_AutAnalog_SAR_IsBusy | ( | uint8_t | sarIdx | ) |

Provides the status of the ADC conversion execution at the time of the request.

Note
  This bit is always high in Continuous mode. (i.e. the next state in a scan is set to cy_en_autanalog_sar_next_act_t::CY_AUTANALOG_SAR_NEXT_ACTION_GO_TO_ENTRY_ADDR). Except for Continuous mode, the firmware waits for this bit to be low before powering down the ADC (cy_stc_autanalog_stt_sar_t::enable = FALSE).

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.

Returns
  The status of the ADC conversion.

Note
  Under invalid ADC index, "false" returns in the result.

## ◆ Cy_AutAnalog_SAR_ReadResult()

__STATIC_INLINE int32_t Cy_AutAnalog_SAR_ReadResult | ( | uint8_t | sarIdx,
|  | cy_en_autanalog_sar_input_t | input,
|  | uint8_t | channel
| ) |  |

Provides the conversion data for the dedicated channel.

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.
  input | The ADC input type is either GPIO or MUX.
  channel | The ADC channel for conversion valid range for the GPIO: 0...7; valid range for the MUX: 0...15;

Returns
  The result of the ADC.

Note
  Under invalid ADC index, "zero" returns in the result.

## ◆ Cy_AutAnalog_SAR_CountsTo_Volts()

float32_t Cy_AutAnalog_SAR_CountsTo_Volts | ( | uint8_t | sarIdx,
|  | bool | sarLP,
|  | uint8_t | sarSequencer,
|  | cy_en_autanalog_sar_input_t | sarInput,
|  | uint8_t | sarChannel,
|  | uint32_t | VrefmV,
|  | int32_t | sarCounts
| ) |  |

Converts the ADC output to Volts.

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.
  sarLP | The operating mode of the ADC FALSE - High Speed; TRUE - Low Power;
  sarSequencer | The ADC sequencer to convert the output data to Volts, valid range 0...31.
  sarInput | The ADC input type is either GPIO or MUX.
  sarChannel | The ADC channel for conversion valid range for the GPIO: 0...7; valid range for the MUX: 0...15;
  VrefmV | The ADC reference voltage in mV.
  sarCounts | The conversion result, see Cy_AutAnalog_SAR_ReadResult. If conversion data is received from FIFO, see Cy_AutAnalog_FIFO_ReadWord (Cy_AutAnalog_FIFO_ReadAllData, Cy_AutAnalog_FIFO_ReadDataChanId).

Returns
  The ADC result in Volts.

Note
  Under invalid ADC index, "zero" returns in the result.

## ◆ Cy_AutAnalog_SAR_CountsTo_mVolts()

int16_t Cy_AutAnalog_SAR_CountsTo_mVolts | ( | uint8_t | sarIdx,
|  | bool | sarLP,
|  | uint8_t | sarSequencer,
|  | cy_en_autanalog_sar_input_t | sarInput,
|  | uint8_t | sarChannel,
|  | uint32_t | VrefmV,
|  | int32_t | sarCounts
| ) |  |

Converts the ADC output to milliVolts.

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.
  sarLP | The operating mode of the ADC FALSE - High Speed; TRUE - Low Power;
  sarSequencer | The ADC sequencer to convert the output data to milliVolts, valid range 0...31.
  sarInput | The ADC input type is either GPIO or MUX.
  sarChannel | The ADC channel for conversion valid range for the GPIO: 0...7; valid range for the MUX: 0...15;
  VrefmV | The ADC reference voltage in mV.
  sarCounts | The conversion result, see Cy_AutAnalog_SAR_ReadResult. If conversion data is received from FIFO, see Cy_AutAnalog_FIFO_ReadWord (Cy_AutAnalog_FIFO_ReadAllData, Cy_AutAnalog_FIFO_ReadDataChanId).

Returns
  The ADC result in milliVolts.

Note
  Under invalid ADC index, "zero" returns in the result.

## ◆ Cy_AutAnalog_SAR_CountsTo_uVolts()

int32_t Cy_AutAnalog_SAR_CountsTo_uVolts | ( | uint8_t | sarIdx,
|  | bool | sarLP,
|  | uint8_t | sarSequencer,
|  | cy_en_autanalog_sar_input_t | sarInput,
|  | uint8_t | sarChannel,
|  | uint32_t | VrefmV,
|  | int32_t | sarCounts
| ) |  |

Converts the ADC output to microVolts.

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.
  sarLP | The operating mode of the ADC FALSE - High Speed; TRUE - Low Power;
  sarSequencer | The ADC sequencer to convert the output data to microVolts, valid range 0...31.
  sarInput | The ADC input type is either GPIO or MUX.
  sarChannel | The ADC channel for conversion valid range for the GPIO: 0...7; valid range for the MUX: 0...15;
  VrefmV | The ADC reference voltage in mV.
  sarCounts | The conversion result, see Cy_AutAnalog_SAR_ReadResult. If conversion data is received from FIFO, see Cy_AutAnalog_FIFO_ReadWord (Cy_AutAnalog_FIFO_ReadAllData, Cy_AutAnalog_FIFO_ReadDataChanId).

Returns
  The ADC result in microVolts.

Note
  Under invalid ADC index, "zero" returns in the result.

## ◆ Cy_AutAnalog_SAR_CountsTo_degreeC()

int16_t Cy_AutAnalog_SAR_CountsTo_degreeC | ( | uint8_t | sarIdx,
|  | bool | sarLP,
|  | uint8_t | sarSequencer,
|  | uint8_t | sarChannel,
|  | int32_t | sarCounts
| ) |  |

Converts the ADC output to degrees Celsius.

Warning
  Vbgr should be used as reference voltage when measuring the die temperature.
  The first reading of the die temperature in HS mode may be incorrect.

Note
  The die temperature measurement only works for MUX channels in differential configuration for LP mode and pseudo differential configuration for HS mode.
  The averaging can be activated to reduce noise.

Parameters

  sarIdx | The index of the ADC subsystem within the Autonomous Analog, see cy_stc_autanalog_cfg_t::sar.
  sarLP | The operating mode of the ADC FALSE - High Speed; TRUE - Low Power;
  sarSequencer | The ADC sequencer to convert the output data to degrees Celsius, valid range 0...31.
  sarChannel | The ADC channel for conversion, valid range: 0...15.
  sarCounts | The conversion result, see Cy_AutAnalog_SAR_ReadResult. If conversion data is received from FIFO, see Cy_AutAnalog_FIFO_ReadWord (Cy_AutAnalog_FIFO_ReadAllData, Cy_AutAnalog_FIFO_ReadDataChanId).

Returns
  The ADC result in degrees Celsius.

Note
  The function returns 0 on invalid parameters or incorrect averaging configuration.