# ADC Module

The analog to digital converter (ADC) API provides a set of functions for programming the digital circuits of the converter, referred to as the ADC wrapper. Functions are provided to configure the conversions, read the data conversion result registers, configure the post-processing blocks (PPB), and set up and handle interrupts and events.

group `adc_api`

  Defines

  `ADC_NUM_INTERRUPTS` 4U
  `ADC_SOCxCTL_OFFSET_BASE` ADC_O_SOC0CTL
  `ADC_RESULTx_OFFSET_BASE` ADC_O_RESULT0
  `ADC_INTSELxNy_OFFSET_BASE` ADC_O_INTSEL1N2
  `ADC_PPBxRESULT_OFFSET_BASE` ADC_O_PPB1RESULT
  `ADC_PPBxCONFIG_STEP` (ADC_O_PPB2CONFIG - ADC_O_PPB1CONFIG)
  `ADC_PPBxTRIPHI_STEP` (ADC_O_PPB2TRIPHI - ADC_O_PPB1TRIPHI)
  `ADC_PPBxTRIPLO_STEP` (ADC_O_PPB2TRIPLO - ADC_O_PPB1TRIPLO)
  `ADC_PPBxSTAMP_STEP` (ADC_O_PPB2STAMP - ADC_O_PPB1STAMP)
  `ADC_PPBxOFFCAL_STEP` (ADC_O_PPB2OFFCAL - ADC_O_PPB1OFFCAL)
  `ADC_PPBxOFFREF_STEP` (ADC_O_PPB2OFFREF - ADC_O_PPB1OFFREF)
  `ADC_PPBTRIP_MASK` ((uint32_t)ADC_PPB1TRIPHI_LIMITHI_M

  | \

  (uint32_t)

  ADC_PPB1TRIPHI_HSIGN)
  `ADC_getTempSlope`() (*(int16_t (*)(void))0x7036E)()
  `ADC_getTempOffset`() (*(int16_t (*)(void))0x70372)()
  `ADC_EVT_TRIPHI` 0x0001U

    Trip High Event.

  `ADC_EVT_TRIPLO` 0x0002U

    Trip Low Event.

  `ADC_EVT_ZERO` 0x0004U

    Zero Crossing Event.

  `ADC_FORCE_SOC0` 0x0001U

    SW trigger ADC SOC 0.

  `ADC_FORCE_SOC1` 0x0002U

    SW trigger ADC SOC 1.

  `ADC_FORCE_SOC2` 0x0004U

    SW trigger ADC SOC 2.

  `ADC_FORCE_SOC3` 0x0008U

    SW trigger ADC SOC 3.

  `ADC_FORCE_SOC4` 0x0010U

    SW trigger ADC SOC 4.

  `ADC_FORCE_SOC5` 0x0020U

    SW trigger ADC SOC 5.

  `ADC_FORCE_SOC6` 0x0040U

    SW trigger ADC SOC 6.

  `ADC_FORCE_SOC7` 0x0080U

    SW trigger ADC SOC 7.

  `ADC_FORCE_SOC8` 0x0100U

    SW trigger ADC SOC 8.

  `ADC_FORCE_SOC9` 0x0200U

    SW trigger ADC SOC 9.

  `ADC_FORCE_SOC10` 0x0400U

    SW trigger ADC SOC 10.

  `ADC_FORCE_SOC11` 0x0800U

    SW trigger ADC SOC 11.

  `ADC_FORCE_SOC12` 0x1000U

    SW trigger ADC SOC 12.

  `ADC_FORCE_SOC13` 0x2000U

    SW trigger ADC SOC 13.

  `ADC_FORCE_SOC14` 0x4000U

    SW trigger ADC SOC 14.

  `ADC_FORCE_SOC15` 0x8000U

    SW trigger ADC SOC 15.

  Enums

  enum `ADC_ClkPrescale`

    Values that can be passed to ADC_setPrescaler() as the clkPrescale parameter.

    Values:

    enumerator `ADC_CLK_DIV_1_0` = 0U

      ADCCLK = (input clock) / 1.0.

    enumerator `ADC_CLK_DIV_2_0` = 2U

      ADCCLK = (input clock) / 2.0.

    enumerator `ADC_CLK_DIV_2_5` = 3U

      ADCCLK = (input clock) / 2.5.

    enumerator `ADC_CLK_DIV_3_0` = 4U

      ADCCLK = (input clock) / 3.0.

    enumerator `ADC_CLK_DIV_3_5` = 5U

      ADCCLK = (input clock) / 3.5.

    enumerator `ADC_CLK_DIV_4_0` = 6U

      ADCCLK = (input clock) / 4.0.

    enumerator `ADC_CLK_DIV_4_5` = 7U

      ADCCLK = (input clock) / 4.5.

    enumerator `ADC_CLK_DIV_5_0` = 8U

      ADCCLK = (input clock) / 5.0.

    enumerator `ADC_CLK_DIV_5_5` = 9U

      ADCCLK = (input clock) / 5.5.

    enumerator `ADC_CLK_DIV_6_0` = 10U

      ADCCLK = (input clock) / 6.0.

    enumerator `ADC_CLK_DIV_6_5` = 11U

      ADCCLK = (input clock) / 6.5.

    enumerator `ADC_CLK_DIV_7_0` = 12U

      ADCCLK = (input clock) / 7.0.

    enumerator `ADC_CLK_DIV_7_5` = 13U

      ADCCLK = (input clock) / 7.5.

    enumerator `ADC_CLK_DIV_8_0` = 14U

      ADCCLK = (input clock) / 8.0.

    enumerator `ADC_CLK_DIV_8_5` = 15U

      ADCCLK = (input clock) / 8.5.

  enum `ADC_Resolution`

    Values that can be passed to ADC_setMode() as the resolution parameter.

    Values:

    enumerator `ADC_RESOLUTION_12BIT` = 0x00U

      12-bit conversion resolution

    enumerator `ADC_RESOLUTION_16BIT` = 0x40U

      16-bit conversion resolution

  enum `ADC_SignalMode`

    Values that can be passed to ADC_setMode() as the signalMode parameter.

    Values:

    enumerator `ADC_MODE_SINGLE_ENDED` = 0x00U

      Sample on single pin with VREFLO.

    enumerator `ADC_MODE_DIFFERENTIAL` = 0x80U

      Sample on pair of pins.

  enum `ADC_Trigger`

    Values that can be passed to ADC_setupSOC() as the trigger parameter to specify the event that will trigger a conversion to start. It is also used with ADC_setBurstModeConfig().

    Values:

    enumerator `ADC_TRIGGER_SW_ONLY` = 0U

      Software only.

    enumerator `ADC_TRIGGER_CPU1_TINT0` = 1U

      CPU1 Timer 0, TINT0.

    enumerator `ADC_TRIGGER_CPU1_TINT1` = 2U

      CPU1 Timer 1, TINT1.

    enumerator `ADC_TRIGGER_CPU1_TINT2` = 3U

      CPU1 Timer 2, TINT2.

    enumerator `ADC_TRIGGER_GPIO` = 4U

      GPIO, ADCEXTSOC.

    enumerator `ADC_TRIGGER_EPWM1_SOCA` = 5U

      ePWM1, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM1_SOCB` = 6U

      ePWM1, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM2_SOCA` = 7U

      ePWM2, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM2_SOCB` = 8U

      ePWM2, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM3_SOCA` = 9U

      ePWM3, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM3_SOCB` = 10U

      ePWM3, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM4_SOCA` = 11U

      ePWM4, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM4_SOCB` = 12U

      ePWM4, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM5_SOCA` = 13U

      ePWM5, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM5_SOCB` = 14U

      ePWM5, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM6_SOCA` = 15U

      ePWM6, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM6_SOCB` = 16U

      ePWM6, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM7_SOCA` = 17U

      ePWM7, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM7_SOCB` = 18U

      ePWM7, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM8_SOCA` = 19U

      ePWM8, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM8_SOCB` = 20U

      ePWM8, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM9_SOCA` = 21U

      ePWM9, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM9_SOCB` = 22U

      ePWM9, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM10_SOCA` = 23U

      ePWM10, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM10_SOCB` = 24U

      ePWM10, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM11_SOCA` = 25U

      ePWM11, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM11_SOCB` = 26U

      ePWM11, ADCSOCB

    enumerator `ADC_TRIGGER_EPWM12_SOCA` = 27U

      ePWM12, ADCSOCA

    enumerator `ADC_TRIGGER_EPWM12_SOCB` = 28U

      ePWM12, ADCSOCB

  enum `ADC_Channel`

    Values that can be passed to ADC_setupSOC() as the channel parameter. This is the input pin on which the signal to be converted is located.

    Values:

    enumerator `ADC_CH_ADCIN0` = 0U

      single-ended, ADCIN0

    enumerator `ADC_CH_ADCIN1` = 1U

      single-ended, ADCIN1

    enumerator `ADC_CH_ADCIN2` = 2U

      single-ended, ADCIN2

    enumerator `ADC_CH_ADCIN3` = 3U

      single-ended, ADCIN3

    enumerator `ADC_CH_ADCIN4` = 4U

      single-ended, ADCIN4

    enumerator `ADC_CH_ADCIN5` = 5U

      single-ended, ADCIN5

    enumerator `ADC_CH_ADCIN6` = 6U

      single-ended, ADCIN6

    enumerator `ADC_CH_ADCIN7` = 7U

      single-ended, ADCIN7

    enumerator `ADC_CH_ADCIN8` = 8U

      single-ended, ADCIN8

    enumerator `ADC_CH_ADCIN9` = 9U

      single-ended, ADCIN9

    enumerator `ADC_CH_ADCIN10` = 10U

      single-ended, ADCIN10

    enumerator `ADC_CH_ADCIN11` = 11U

      single-ended, ADCIN11

    enumerator `ADC_CH_ADCIN12` = 12U

      single-ended, ADCIN12

    enumerator `ADC_CH_ADCIN13` = 13U

      single-ended, ADCIN13

    enumerator `ADC_CH_ADCIN14` = 14U

      single-ended, ADCIN14

    enumerator `ADC_CH_ADCIN15` = 15U

      single-ended, ADCIN15

    enumerator `ADC_CH_ADCIN0_ADCIN1` = 0U

      differential, ADCIN0 and ADCIN1

    enumerator `ADC_CH_ADCIN2_ADCIN3` = 2U

      differential, ADCIN2 and ADCIN3

    enumerator `ADC_CH_ADCIN4_ADCIN5` = 4U

      differential, ADCIN4 and ADCIN5

    enumerator `ADC_CH_ADCIN6_ADCIN7` = 6U

      differential, ADCIN6 and ADCIN7

    enumerator `ADC_CH_ADCIN8_ADCIN9` = 8U

      differential, ADCIN8 and ADCIN9

    enumerator `ADC_CH_ADCIN10_ADCIN11` = 10U

      differential, ADCIN10 and ADCIN11

    enumerator `ADC_CH_ADCIN12_ADCIN13` = 12U

      differential, ADCIN12 and ADCIN13

    enumerator `ADC_CH_ADCIN14_ADCIN15` = 14U

      differential, ADCIN14 and ADCIN15

  enum `ADC_PulseMode`

    Values that can be passed to ADC_setInterruptPulseMode() as the pulseMode parameter.

    Values:

    enumerator `ADC_PULSE_END_OF_ACQ_WIN` = 0x00U

      Occurs at the end of the acquisition window.

    enumerator `ADC_PULSE_END_OF_CONV` = 0x04U

      Occurs at the end of the conversion.

  enum `ADC_IntNumber`

    Values that can be passed to ADC_enableInterrupt(), ADC_disableInterrupt(), and ADC_getInterruptStatus() as the adcIntNum parameter.

    Values:

    enumerator `ADC_INT_NUMBER1` = 0U

      ADCINT1 Interrupt.

    enumerator `ADC_INT_NUMBER2` = 1U

      ADCINT2 Interrupt.

    enumerator `ADC_INT_NUMBER3` = 2U

      ADCINT3 Interrupt.

    enumerator `ADC_INT_NUMBER4` = 3U

      ADCINT4 Interrupt.

  enum `ADC_PPBNumber`

    Values that can be passed in as the ppbNumber parameter for several functions.

    Values:

    enumerator `ADC_PPB_NUMBER1` = 0U

      Post-processing block 1.

    enumerator `ADC_PPB_NUMBER2` = 1U

      Post-processing block 2.

    enumerator `ADC_PPB_NUMBER3` = 2U

      Post-processing block 3.

    enumerator `ADC_PPB_NUMBER4` = 3U

      Post-processing block 4.

  enum `ADC_SOCNumber`

    Values that can be passed in as the socNumber parameter for several functions. This value identifies the start-of-conversion (SOC) that a function is configuring or accessing. Note that in some cases (for example, ADC_setInterruptSource()) socNumber is used to refer to the corresponding end-of-conversion (EOC).

    Values:

    enumerator `ADC_SOC_NUMBER0` = 0U

      SOC/EOC number 0.

    enumerator `ADC_SOC_NUMBER1` = 1U

      SOC/EOC number 1.

    enumerator `ADC_SOC_NUMBER2` = 2U

      SOC/EOC number 2.

    enumerator `ADC_SOC_NUMBER3` = 3U

      SOC/EOC number 3.

    enumerator `ADC_SOC_NUMBER4` = 4U

      SOC/EOC number 4.

    enumerator `ADC_SOC_NUMBER5` = 5U

      SOC/EOC number 5.

    enumerator `ADC_SOC_NUMBER6` = 6U

      SOC/EOC number 6.

    enumerator `ADC_SOC_NUMBER7` = 7U

      SOC/EOC number 7.

    enumerator `ADC_SOC_NUMBER8` = 8U

      SOC/EOC number 8.

    enumerator `ADC_SOC_NUMBER9` = 9U

      SOC/EOC number 9.

    enumerator `ADC_SOC_NUMBER10` = 10U

      SOC/EOC number 10.

    enumerator `ADC_SOC_NUMBER11` = 11U

      SOC/EOC number 11.

    enumerator `ADC_SOC_NUMBER12` = 12U

      SOC/EOC number 12.

    enumerator `ADC_SOC_NUMBER13` = 13U

      SOC/EOC number 13.

    enumerator `ADC_SOC_NUMBER14` = 14U

      SOC/EOC number 14.

    enumerator `ADC_SOC_NUMBER15` = 15U

      SOC/EOC number 15.

  enum `ADC_IntSOCTrigger`

    Values that can be passed in as the trigger parameter for the ADC_setInterruptSOCTrigger() function.

    Values:

    enumerator `ADC_INT_SOC_TRIGGER_NONE` = 0U

      No ADCINT will trigger the SOC.

    enumerator `ADC_INT_SOC_TRIGGER_ADCINT1` = 1U

      ADCINT1 will trigger the SOC.

    enumerator `ADC_INT_SOC_TRIGGER_ADCINT2` = 2U

      ADCINT2 will trigger the SOC.

  enum `ADC_PriorityMode`

    Values that can be passed to ADC_setSOCPriority() as the priMode parameter.

    Values:

    enumerator `ADC_PRI_ALL_ROUND_ROBIN` = 0U

      Round robin mode is used for all.

    enumerator `ADC_PRI_SOC0_HIPRI` = 1U

      SOC 0 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC1_HIPRI` = 2U

      SOC 0-1 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC2_HIPRI` = 3U

      SOC 0-2 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC3_HIPRI` = 4U

      SOC 0-3 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC4_HIPRI` = 5U

      SOC 0-4 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC5_HIPRI` = 6U

      SOC 0-5 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC6_HIPRI` = 7U

      SOC 0-6 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC7_HIPRI` = 8U

      SOC 0-7 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC8_HIPRI` = 9U

      SOC 0-8 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC9_HIPRI` = 10U

      SOC 0-9 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC10_HIPRI` = 11U

      SOC 0-10 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC11_HIPRI` = 12U

      SOC 0-11 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC12_HIPRI` = 13U

      SOC 0-12 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC13_HIPRI` = 14U

      SOC 0-13 hi pri, others in round robin.

    enumerator `ADC_PRI_THRU_SOC14_HIPRI` = 15U

      SOC 0-14 hi pri, SOC15 in round robin.

    enumerator `ADC_PRI_ALL_HIPRI` = 16U

      All priorities based on SOC number.

  enum `ADC_OSDetectMode`

    Values that can be passed to ADC_configOSDetectMode() as the modeVal parameter.

    Values:

    enumerator `ADC_OSDETECT_MODE_DISABLED` = 0x0U

      Open/Shorts detection cir- cuit(O/S DC) is disabled

    enumerator `ADC_OSDETECT_MODE_VSSA` = 0x1U

      O/S DC is enabled at zero scale

    enumerator `ADC_OSDETECT_MODE_VDDA` = 0x2U

      O/S DC is enabled at full scale

    enumerator `ADC_OSDETECT_MODE_5BY12_VDDA` = 0x3U

      O/S DC is enabled at 5/12 scale

    enumerator `ADC_OSDETECT_MODE_7BY12_VDDA` = 0x4U

      O/S DC is enabled at 7/12 scale

    enumerator `ADC_OSDETECT_MODE_5K_PULLDOWN_TO_VSSA` = 0x5U

      O/S DC is enabled at 5K pulldown to VSSA

    enumerator `ADC_OSDETECT_MODE_5K_PULLUP_TO_VDDA` = 0x6U

      O/S DC is enabled at 5K pullup to VDDA

    enumerator `ADC_OSDETECT_MODE_7K_PULLDOWN_TO_VSSA` = 0x7U

      O/S DC is enabled at 7K pulldown to VSSA

  Functions

  void `ADC_setPrescaler`(uint32_t base, ADC_ClkPrescale clkPrescale)

    Configures the analog-to-digital converter module prescaler.

    This function configures the ADC module’s ADCCLK.

    Parameters

      - `base`: is the base address of the ADC module.

      - `clkPrescale`: is the ADC clock prescaler.

    The clkPrescale parameter specifies the value by which the input clock is divided to make the ADCCLK. The clkPrescale value can be specified with any of the following enum values: ADC_CLK_DIV_1_0, ADC_CLK_DIV_2_0, ADC_CLK_DIV_2_5, …, ADC_CLK_DIV_7_5, ADC_CLK_DIV_8_0, or ADC_CLK_DIV_8_5.

    Return

      None.

  void `ADC_setupSOC`(uint32_t base, ADC_SOCNumber socNumber, ADC_Trigger trigger, ADC_Channel channel, uint32_t sampleWindow)

    Configures a start-of-conversion (SOC) in the ADC.

    This function configures the a start-of-conversion (SOC) in the ADC module.

    Parameters

      - `base`: is the base address of the ADC module.

      - `socNumber`: is the number of the start-of-conversion.

      - `trigger`: the source that will cause the SOC.

      - `channel`: is the number associated with the input signal.

      - `sampleWindow`: is the acquisition window duration.

    The socNumber number is a value ADC_SOC_NUMBERX where X is a number from 0 to 15 specifying which SOC is to be configured on the ADC module specified by base.

    The trigger specifies the event that causes the SOC such as software, a timer interrupt, an ePWM event, or an ADC interrupt. It should be a value in the format of ADC_TRIGGER_XXXX where XXXX is the event such as ADC_TRIGGER_SW_ONLY, ADC_TRIGGER_CPU1_TINT0, ADC_TRIGGER_GPIO, ADC_TRIGGER_EPWM1_SOCA, and so on.

    The channel parameter specifies the channel to be converted. In single-ended mode this is a single pin given by ADC_CH_ADCINx where x is the number identifying the pin between 0 and 15 inclusive. In differential mode, two pins are used as inputs and are passed in the channel parameter as ADC_CH_ADCIN0_ADCIN1, ADC_CH_ADCIN2_ADCIN3, …, or ADC_CH_ADCIN14_ADCIN15.

    The sampleWindow parameter is the acquisition window duration in SYSCLK cycles. It should be a value between 1 and 512 cycles inclusive. The selected duration must be at least as long as one ADCCLK cycle. Also, the datasheet will specify a minimum window duration requirement in nanoseconds.

    Return

      None.

  void `ADC_setInterruptSOCTrigger`(uint32_t base, ADC_SOCNumber socNumber, ADC_IntSOCTrigger trigger)

    Configures the interrupt SOC trigger of an SOC.

    This function configures the interrupt start-of-conversion trigger in the ADC module.

    Parameters

      - `base`: is the base address of the ADC module.

      - `socNumber`: is the number of the start-of-conversion.

      - `trigger`: the interrupt source that will cause the SOC.

    The socNumber number is a value ADC_SOC_NUMBERX where X is a number from 0 to 15 specifying which SOC is to be configured on the ADC module specified by base.

    The trigger specifies the interrupt that causes a start of conversion or none. It should be one of the following values.

    - ADC_INT_SOC_TRIGGER_NONE

    - ADC_INT_SOC_TRIGGER_ADCINT1

    - ADC_INT_SOC_TRIGGER_ADCINT2

    This functionality is useful for creating continuous conversions.

    Return

      None.

  void `ADC_setInterruptPulseMode`(uint32_t base, ADC_PulseMode pulseMode)

    Sets the timing of the end-of-conversion pulse

    This function configures the end-of-conversion (EOC) pulse generated by ADC. This pulse will be generated either at the end of the acquisition window (pass

    ADC_PULSE_END_OF_ACQ_WIN into pulseMode) or at the end of the voltage conversion, one cycle prior to the ADC result latching into it’s result register (pass ADC_PULSE_END_OF_CONV into pulseMode).
    Parameters

      - `base`: is the base address of the ADC module.

      - `pulseMode`: is the generation mode of the EOC pulse.

    Return

      None.

  void `ADC_enableConverter`(uint32_t base)

    Powers up the analog-to-digital converter core.

    This function powers up the analog circuitry inside the analog core.

    Parameters

      - `base`: is the base address of the ADC module.

    Note

      Allow at least a 500us delay before sampling after calling this API. If you enable multiple ADCs, you can delay after they all have begun powering up.

    Return

      None.

  void `ADC_disableConverter`(uint32_t base)

    Powers down the analog-to-digital converter module.

    This function powers down the analog circuitry inside the analog core.

    Parameters

      - `base`: is the base address of the ADC module.

    Return

      None.

  void `ADC_forceSOC`(uint32_t base, ADC_SOCNumber socNumber)

    Forces a SOC flag to a 1 in the analog-to-digital converter.

    This function forces the SOC flag associated with the SOC specified by

    socNumber. This initiates a conversion once that SOC is given priority. This software trigger can be used whether or not the SOC has been configured to accept some other specific trigger.
    Parameters

      - `base`: is the base address of the ADC module.

      - `socNumber`: is the number of the start-of-conversion.

    Return

      None.

  void `ADC_forceMultipleSOC`(uint32_t base, uint16_t socMask)

    Forces multiple SOC flags to 1 in the analog-to-digital converter.

    This function forces the SOCFRC1 flags associated with the SOCs specified by

    socMask. This initiates a conversion once the desired SOCs are given priority. This software trigger can be used whether or not the SOC has been configured to accept some other specific trigger. Valid values for socMask parameter can be any of the individual ADC_FORCE_SOCx values or any of their OR’d combination to trigger multiple SOCs.
    Parameters

      - `base`: is the base address of the ADC module.

      - `socMask`: is the SOCs to be forced through software

    Note

      To trigger SOC0, SOC1 and SOC2, value (ADC_FORCE_SOC0 | ADC_FORCE_SOC1 | ADC_FORCE_SOC2) should be passed as socMask.

    Return

      None.

  bool `ADC_getInterruptStatus`(uint32_t base, ADC_IntNumber adcIntNum)

    Gets the current ADC interrupt status.

    This function returns the interrupt status for the analog-to-digital converter.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum takes a one of the values ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be cleared.

    Return

      true if the interrupt flag for the specified interrupt number is set and false if it is not.

  void `ADC_clearInterruptStatus`(uint32_t base, ADC_IntNumber adcIntNum)

    Clears ADC interrupt sources.

    This function clears the specified ADC interrupt sources so that they no longer assert. If not in continuous mode, this function must be called before any further interrupt pulses may occur.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum takes a one of the values ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be cleared.

    Return

      None.

  bool `ADC_getInterruptOverflowStatus`(uint32_t base, ADC_IntNumber adcIntNum)

    Gets the current ADC interrupt overflow status.

    This function returns the interrupt overflow status for the analog-to-digital converter. An overflow condition is generated irrespective of the continuous mode.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum takes a one of the values ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be cleared.

    Return

      true if the interrupt overflow flag for the specified interrupt number is set and false if it is not.

  void `ADC_clearInterruptOverflowStatus`(uint32_t base, ADC_IntNumber adcIntNum)

    Clears ADC interrupt overflow sources.

    This function clears the specified ADC interrupt overflow sources so that they no longer assert. If software tries to clear the overflow in the same cycle that hardware tries to set the overflow, then hardware has priority.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum takes a one of the values ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be cleared.

    Return

      None.

  uint16_t `ADC_readResult`(uint32_t resultBase, ADC_SOCNumber socNumber)

    Reads the conversion result.

    This function returns the conversion result that corresponds to the base address passed into

    resultBase and the SOC passed into socNumber.
    Parameters

      - `resultBase`: is the base address of the ADC results.

      - `socNumber`: is the number of the start-of-conversion.

    The socNumber number is a value ADC_SOC_NUMBERX where X is a number from 0 to 15 specifying which SOC’s result is to be read.

    Note

      Take care that you are using a base address for the result registers (ADCxRESULT_BASE) and not a base address for the control registers.

    Return

      Returns the conversion result.

  bool `ADC_isBusy`(uint32_t base)

    Determines whether the ADC is busy or not.

    This function allows the caller to determine whether or not the ADC is busy and can sample another channel.

    Parameters

      - `base`: is the base address of the ADC.

    Return

      Returns true if the ADC is sampling or false if all samples are complete.

  void `ADC_setBurstModeConfig`(uint32_t base, ADC_Trigger trigger, uint16_t burstSize)

    Set SOC burst mode.

    This function configures the burst trigger and burstSize of an ADC module. Burst mode allows a single trigger to walk through the round-robin SOCs one or more at a time. When burst mode is enabled, the trigger selected by the

    ADC_setupSOC() API will no longer have an effect on the SOCs in round-robin mode. Instead, the source specified through the trigger parameter will cause a burst of burstSize conversions to occur.
    Parameters

      - `base`: is the base address of the ADC.

      - `trigger`: the source that will cause the burst conversion sequence.

      - `burstSize`: is the number of SOCs converted during a burst sequence.

    The trigger parameter takes the same values as the ADC_setupSOC() API The burstSize parameter should be a value between 1 and 16 inclusive.

    Return

      None.

  void `ADC_enableBurstMode`(uint32_t base)

    Enables SOC burst mode.

    This function enables SOC burst mode operation of the ADC. Burst mode allows a single trigger to walk through the round-robin SOCs one or more at a time. When burst mode is enabled, the trigger selected by the

    ADC_setupSOC() API will no longer have an effect on the SOCs in round-robin mode. Use ADC_setBurstMode() to configure the burst trigger and size.
    Parameters

      - `base`: is the base address of the ADC.

    Return

      None.

  void `ADC_disableBurstMode`(uint32_t base)

    Disables SOC burst mode.

    This function disables SOC burst mode operation of the ADC. SOCs in round-robin mode will be triggered by the trigger configured using the

    ADC_setupSOC() API.
    Parameters

      - `base`: is the base address of the ADC.

    Return

      None.

  void `ADC_setSOCPriority`(uint32_t base, ADC_PriorityMode priMode)

    Sets the priority mode of the SOCs.

    This function sets the priority mode of the SOCs. There are three main modes that can be passed in the

    priMode parameter
    Parameters

      - `base`: is the base address of the ADC.

      - `priMode`: is the priority mode of the SOCs.

    - All SOCs are in round-robin mode. This means no SOC has an inherent higher priority over another. This is selected by passing in the value ADC_PRI_ALL_ROUND_ROBIN.

    - All priorities are in high priority mode. This means that the priority of the SOC is determined by its SOC number. This option is selected by passing in the value ADC_PRI_ALL_HIPRI.

    - A range of SOCs are assigned high priority, with all others in round robin mode. High priority mode means that an SOC with high priority will interrupt the round robin wheel and insert itself as the next conversion. Passing in the value ADC_PRI_SOC0_HIPRI will make SOC0 highest priority, ADC_PRI_THRU_SOC1_HIPRI will put SOC0 and SOC 1 in high priority, and so on up to ADC_PRI_THRU_SOC14_HIPRI where SOCs 0 through 14 are in high priority.

    Return

      None.

  void `ADC_configOSDetectMode`(uint32_t base, ADC_OSDetectMode modeVal)

    Configures Open/Shorts Detection Circuit Mode.

    This function configures the open/shorts detection circuit mode of the ADC.

    Parameters

      - `base`: is the base address of the ADC.

      - `modeVal`: is the desired open/shorts detection circuit mode.

    Return

      None.

  void `ADC_setupPPB`(uint32_t base, ADC_PPBNumber ppbNumber, ADC_SOCNumber socNumber)

    Configures a post-processing block (PPB) in the ADC.

    This function associates a post-processing block with a SOC.

    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `socNumber`: is the number of the start-of-conversion.

    The ppbNumber is a value ADC_PPB_NUMBERX where X is a value from 1 to 4 inclusive that identifies a PPB to be configured. The socNumber number is a value ADC_SOC_NUMBERX where X is a number from 0 to 15 specifying which SOC is to be configured on the ADC module specified by base.

    Note

      You can have more that one PPB associated with the same SOC, but a PPB can only be configured to correspond to one SOC at a time. Also note that when you have multiple PPBs for the same SOC, the calibration offset that actually gets applied will be that of the PPB with the highest number. Since SOC0 is the default for all PPBs, look out for unintentional overwriting of a lower numbered PPB’s offset.

    Return

      None.

  void `ADC_enablePPBEvent`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags)

    Enables individual ADC PPB event sources.

    This function enables the indicated ADC PPB event sources. This will allow the specified events to propagate through the X-BAR to a pin or to an ePWM module. The

    evtFlags parameter can be any of the ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, or ADC_EVT_ZERO values.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `evtFlags`: is a bit mask of the event sources to be enabled.

    Return

      None.

  void `ADC_disablePPBEvent`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags)

    Disables individual ADC PPB event sources.

    This function disables the indicated ADC PPB event sources. This will stop the specified events from propagating through the X-BAR to other modules. The

    evtFlags parameter can be any of the ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, or ADC_EVT_ZERO values.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `evtFlags`: is a bit mask of the event sources to be enabled.

    Return

      None.

  void `ADC_enablePPBEventInterrupt`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t intFlags)

    Enables individual ADC PPB event interrupt sources.

    This function enables the indicated ADC PPB interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor. The

    intFlags parameter can be any of the ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, or ADC_EVT_ZERO values.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `intFlags`: is a bit mask of the interrupt sources to be enabled.

    Return

      None.

  void `ADC_disablePPBEventInterrupt`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t intFlags)

    Disables individual ADC PPB event interrupt sources.

    This function disables the indicated ADC PPB interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor. The

    intFlags parameter can be any of the ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, or ADC_EVT_ZERO values.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `intFlags`: is a bit mask of the interrupt source to be disabled.

    Return

      None.

  uint16_t `ADC_getPPBEventStatus`(uint32_t base, ADC_PPBNumber ppbNumber)

    Gets the current ADC event status.

    This function returns the event status for the analog-to-digital converter.

    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

    Return

      Returns the current event status, enumerated as a bit field of ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, and ADC_EVT_ZERO.

  void `ADC_clearPPBEventStatus`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags)

    Clears ADC event flags.

    This function clears the indicated ADC PPB event flags. After an event occurs this function must be called to allow additional events to be produced. The

    evtFlags parameter can be any of the ADC_EVT_TRIPHI, ADC_EVT_TRIPLO, or ADC_EVT_ZERO values.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `evtFlags`: is a bit mask of the event source to be cleared.

    Return

      None.

  int32_t `ADC_readPPBResult`(uint32_t resultBase, ADC_PPBNumber ppbNumber)

    Reads the processed conversion result from the PPB.

    This function returns the processed conversion result that corresponds to the base address passed into

    resultBase and the PPB passed into ppbNumber.
    Parameters

      - `resultBase`: is the base address of the ADC results.

      - `ppbNumber`: is the number of the post-processing block.

    Note

      Take care that you are using a base address for the result registers (ADCxRESULT_BASE) and not a base address for the control registers.

    Return

      Returns the signed 32-bit conversion result.

  uint16_t `ADC_getPPBDelayTimeStamp`(uint32_t base, ADC_PPBNumber ppbNumber)

    Reads sample delay time stamp from a PPB.

    This function returns the sample delay time stamp. This delay is the number of system clock cycles between the SOC being triggered and when it began converting.

    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

    Return

      Returns the delay time stamp.

  void `ADC_setPPBCalibrationOffset`(uint32_t base, ADC_PPBNumber ppbNumber, int16_t offset)

    Sets the post processing block offset correction.

    This function sets the PPB offset correction value. This value can be used to digitally remove any system-level offset inherent in the ADCIN circuit before it is stored in the appropriate result register. The

    offset parameter is subtracted from the ADC output and is a signed value from -512 to 511 inclusive. For example, when offset = 1, ADCRESULT = ADC output - 1. When offset = -512, ADCRESULT = ADC output - (-512) or ADC output + 512.
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `offset`: is the 10-bit signed value subtracted from ADC the output.

    Passing a zero in to the offset parameter will effectively disable the calculation, allowing the raw ADC result to be passed unchanged into the result register.

    Note

      If multiple PPBs are applied to the same SOC, the offset that will be applied will be that of the PPB with the highest number.

    Return

      None

  void `ADC_setPPBReferenceOffset`(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t offset)

    Sets the post processing block reference offset.

    This function sets the PPB reference offset value. This can be used to either calculate the feedback error or convert a unipolar signal to bipolar by subtracting a reference value. The result will be stored in the appropriate PPB result register which can be read using

    ADC_readPPBResult().
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `offset`: is the 16-bit unsigned value subtracted from ADC the output.

    Passing a zero in to the offset parameter will effectively disable the calculation and will pass the ADC result to the PPB result register unchanged.

    Note

      If in 12-bit mode, you may only pass a 12-bit value into the offset parameter.

    Return

      None

  void `ADC_enablePPBTwosComplement`(uint32_t base, ADC_PPBNumber ppbNumber)

    Enables two’s complement capability in the PPB.

    This function enables two’s complement in the post-processing block specified by the

    ppbNumber parameter. When enabled, a two’s complement will be performed on the output of the offset subtraction before it is stored in the appropriate PPB result register. In other words, the PPB result will be the reference offset value minus the the ADC result value (ADCPPBxRESULT = ADCSOCxOFFREF - ADCRESULTx).
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

    Return

      None

  void `ADC_disablePPBTwosComplement`(uint32_t base, ADC_PPBNumber ppbNumber)

    Disables two’s complement capability in the PPB.

    This function disables two’s complement in the post-processing block specified by the

    ppbNumber parameter. When disabled, a two’s complement will NOT be performed on the output of the offset subtraction before it is stored in the appropriate PPB result register. In other words, the PPB result will be the ADC result value minus the reference offset value (ADCPPBxRESULT = ADCRESULTx - ADCSOCxOFFREF).
    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

    Return

      None

  void `ADC_enableInterrupt`(uint32_t base, ADC_IntNumber adcIntNum)

    Enables an ADC interrupt source.

    This function enables the indicated ADC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum can take the value ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be enabled.

    Return

      None.

  void `ADC_disableInterrupt`(uint32_t base, ADC_IntNumber adcIntNum)

    Disables an ADC interrupt source.

    This function disables the indicated ADC interrupt source. Only the sources that are enabled can be reflected to the processor interrupt. Disabled sources have no effect on the processor.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum can take the value ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module should be disabled.

    Return

      None.

  void `ADC_setInterruptSource`(uint32_t base, ADC_IntNumber adcIntNum, ADC_SOCNumber socNumber)

    Sets the source EOC for an analog-to-digital converter interrupt.

    This function sets which conversion is the source of an ADC interrupt.

    Parameters

      - `base`: is the base address of the ADC module.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

      - `socNumber`: is the number of the start-of-conversion.

    The socNumber number is a value ADC_SOC_NUMBERX where X is a number from 0 to 15 specifying which EOC is to be configured on the ADC module specified by base.

    adcIntNum can take the value ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module is being configured.

    Return

      None.

  void `ADC_enableContinuousMode`(uint32_t base, ADC_IntNumber adcIntNum)

    Enables continuous mode for an ADC interrupt.

    This function enables continuous mode for the ADC interrupt passed into

    adcIntNum. This means that pulses will be generated for the specified ADC interrupt whenever an EOC pulse is generated irrespective of whether or not the flag bit is set.
    Parameters

      - `base`: is the base address of the ADC.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum can take the value ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module is being configured.

    Return

      None.

  void `ADC_disableContinuousMode`(uint32_t base, ADC_IntNumber adcIntNum)

    Disables continuous mode for an ADC interrupt.

    This function disables continuous mode for the ADC interrupt passed into

    adcIntNum. This means that pulses will not be generated for the specified ADC interrupt until the corresponding interrupt flag for the previous interrupt occurrence has been cleared using ADC_clearInterruptStatus().
    Parameters

      - `base`: is the base address of the ADC.

      - `adcIntNum`: is interrupt number within the ADC wrapper.

    adcIntNum can take the value ADC_INT_NUMBER1, ADC_INT_NUMBER2, ADC_INT_NUMBER3, or ADC_INT_NUMBER4 to express which of the four interrupts of the ADC module is being configured.

    Return

      None.

  int16_t `ADC_getTemperatureC`(uint16_t tempResult, float32_t vref)

    Converts temperature from sensor reading to degrees C

    This function converts temperature from temp sensor reading to degrees C. Temp sensor values in production test are derived with 2.5V reference. The

    vref argument in the function is used to scale the temp sensor reading accordingly if temp sensor value is read at a different VREF setting.
    Parameters

      - `tempResult`: is the raw ADC A conversion result from the temp sensor.

      - `vref`: is the reference voltage being used (for example 3.3 for 3.3V).

    Return

      Returns the temperature sensor reading converted to degrees C.

  int16_t `ADC_getTemperatureK`(uint16_t tempResult, float32_t vref)

    Converts temperature from sensor reading to degrees K

    This function converts temperature from temp sensor reading to degrees K. Temp sensor values in production test are derived with 2.5V reference. The

    vref argument in the function is used to scale the temp sensor reading accordingly if temp sensor value is read at a different VREF setting.
    Parameters

      - `tempResult`: is the raw ADC A conversion result from the temp sensor.

      - `vref`: is the reference voltage being used (for example 3.3 for 3.3V).

    Return

      Returns the temperature sensor reading converted to degrees K.

  void `ADC_setMode`(uint32_t base, ADC_Resolution resolution, ADC_SignalMode signalMode)

    Configures the analog-to-digital converter resolution and signal mode.

    This function configures the ADC module’s conversion resolution and input signal mode and ensures that the corresponding trims are loaded.

    Parameters

      - `base`: is the base address of the ADC module.

      - `resolution`: is the resolution of the converter (12 or 16 bits).

      - `signalMode`: is the input signal mode of the converter.

    The resolution parameter specifies the resolution of the conversion. It can be 12-bit or 16-bit specified by ADC_RESOLUTION_12BIT or ADC_RESOLUTION_16BIT.

    The signalMode parameter specifies the signal mode. In single-ended mode, which is indicated by ADC_MODE_SINGLE_ENDED, the input voltage is sampled on a single pin referenced to VREFLO. In differential mode, which is indicated by ADC_MODE_DIFFERENTIAL, the input voltage to the converter is sampled on a pair of input pins, a positive and a negative.

    Note: In this device, single-ended signal conversions are supported only in 12-bit resolution mode and differential signal conversions are supported only in 16-bit resolution mode.

    Return

      None.

  void `ADC_setOffsetTrim`(uint32_t base)

    Configures the offset trim for the desired ADC instance

    This function loads the offset trims for the desired ADC instance.

    Parameters

      - `base`: is the base address of the ADC module.

    Return

      None.

  void `ADC_setINLTrim`(uint32_t base)

    Configures the INL trim for the desired ADC instance

    This function loads the INL trims for the desired ADC instance.

    Parameters

      - `base`: is the base address of the ADC module.

    Return

      None.

  void `ADC_setPPBTripLimits`(uint32_t base, ADC_PPBNumber ppbNumber, int32_t tripHiLimit, int32_t tripLoLimit)

    Sets the windowed trip limits for a PPB.

    This function sets the windowed trip limits for a PPB. These values set the digital comparator so that when one of the values is exceeded, either a high or low trip event will occur.

    Parameters

      - `base`: is the base address of the ADC module.

      - `ppbNumber`: is the number of the post-processing block.

      - `tripHiLimit`: is the value is the digital comparator trip high limit.

      - `tripLoLimit`: is the value is the digital comparator trip low limit.

    The ppbNumber is a value ADC_PPB_NUMBERX where X is a value from 1 to 4 inclusive that identifies a PPB to be configured.

    If using 16-bit mode, you may pass a 17-bit number into the tripHiLimit and tripLoLimit parameters where the 17th bit is the sign bit (that is a value from -65536 and 65535). In 12-bit mode, only bits 12:0 will be compared against bits 12:0 of the PPB result.

    Note

      On some devices, signed trip values do not work properly. See the silicon errata for details.

    Return

      None.

The code for this module is contained in driverlib/adc.c, with driverlib/adc.h containing the API declarations for use by applications.