PSoC 6 Peripheral Driver Library
Global Variables

General Description

Variables

volatile int16_t Cy_SAR_offset [CY_SAR_MAX_NUM_CHANNELS]
 This array is used to calibrate the offset for each channel. More...
 
volatile int32_t Cy_SAR_countsPer10Volt [CY_SAR_MAX_NUM_CHANNELS]
 This array is used to calibrate the gain for each channel. More...
 

Variable Documentation

◆ Cy_SAR_offset

volatile int16_t Cy_SAR_offset[CY_SAR_MAX_NUM_CHANNELS]

This array is used to calibrate the offset for each channel.

At initialization, channels that are single-ended, signed, and with Vneg = Vref have an offset of -(2^12)/2 = -2048. All other channels have an offset of 0. The offset can be overridden using Cy_SAR_SetOffset.

The channel offsets are used by the Cy_SAR_CountsTo_Volts, Cy_SAR_CountsTo_mVolts, and Cy_SAR_CountsTo_uVolts functions to convert counts to voltage.

◆ Cy_SAR_countsPer10Volt

volatile int32_t Cy_SAR_countsPer10Volt[CY_SAR_MAX_NUM_CHANNELS]

This array is used to calibrate the gain for each channel.

It is set at initialization and the value depends on the SARADC resolution and voltage reference, 10*(2^12)/(2*Vref). The gain can be overridden using Cy_SAR_SetGain.

The channel gains are used by the Cy_SAR_CountsTo_Volts, Cy_SAR_CountsTo_mVolts, and Cy_SAR_CountsTo_uVolts functions to convert counts to voltage.