ADC INIT MK02

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC INIT MK02

604 Views
jackxu
Contributor III

Hi there,

I can init most adc channel like the following

   ADC16_GetDefaultConfig(&adc16ConfigStruct);
   ADC16_Init(DEMO_ADC16_BASE, &adc16ConfigStruct);
   ADC16_EnableHardwareTrigger(DEMO_ADC16_BASE, false);                /* Make sure the software trigger is used. */
#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
   if (kStatus_Success == ADC16_DoAutoCalibration(DEMO_ADC16_BASE))
   {
        PRINTF("ADC16_DoAutoCalibration() Done.\r\n");
   }
   else
   {
      PRINTF("ADC16_DoAutoCalibration() Failed.\r\n");
   }
#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */
   adc16ChannelConfigStruct.channelNumber = DEMO_ADC16_USER_CHANNEL;
   adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = false;
#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE
   adc16ChannelConfigStruct.enableDifferentialConversion = false;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */

but how to init the channel se4a, channel 4b,channel se5a, channel se5b etc

      how to init the channel DM0, channel DP0 etc (the same using as channel se0)

or how to init the temp sensor?

pastedImage_1.png

pastedImage_2.png

Thanks in advance!

-Jack

0 Kudos
Reply
1 Reply

492 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Jack,

I think You can call the following function in this way:

ADC16_SetChannelMuxMode(ADC0,kADC16_ChannelMuxA); or ADC16_SetChannelMuxMode(ADC0,kADC16_ChannelMuxB);

Hope it can help you.

BR

Xiangjun Rong

void ADC16_SetChannelMuxMode(ADC_Type *base, adc16_channel_mux_mode_t mode)
{
    if (kADC16_ChannelMuxA == mode)
    {
        base->CFG2 &= ~ADC_CFG2_MUXSEL_MASK;
    }
    else /* kADC16_ChannelMuxB. */
    {
        base->CFG2 |= ADC_CFG2_MUXSEL_MASK;
    }
}

0 Kudos
Reply