AnsweredAssumed Answered

ADC Function on NHS31xx

Question asked by ping mei on Jun 15, 2018
Latest reply on Jun 18, 2018 by dumitru-daniel.popa

I am trying to test ADC example on NHS3152. The code is from

 

Example 3 - Single-shot Analog-to-Digital Conversion without IRQ

-------------------------------

    int adcInput;

    Chip_ADCDAC_Init(NSS_ADCDAC0);

    Chip_ADCDAC_SetMuxADC(NSS_ADCDAC0, ADCDAC_IO_ANA0_5);

    Chip_ADCDAC_SetInputRangeADC(NSS_ADCDAC0, ADCDAC_INPUTRANGE_WIDE);

    Chip_ADCDAC_SetModeADC(NSS_ADCDAC0, ADCDAC_SINGLE_SHOT);

    Chip_ADCDAC_StartADC(NSS_ADCDAC0);

    while (!(Chip_ADCDAC_ReadStatus(NSS_ADCDAC0) & ADCDAC_STATUS_ADC_DONE)) {

        ; /* Wait until measurement completes. For single-shot mode only! */

    }

    adcInput = Chip_ADCDAC_GetValueADC(NSS_ADCDAC0);

---------------------------------

However, it seems that ReadStatus never gets out of while loop.  I wonder if I miss something here …

Outcomes