ADC Conversation time related query

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

ADC Conversation time related query

Jump to solution
530 Views
utsavikalpesh
Contributor V

Hi,

I am working with CodeWarrior v10.3 and of MQX v4.0 (TWRK60D100M)

I am running ADC demo and is working perfectly.

What my purpose is to get approximately 1200 adc outputs within a 500ms.

My Bus frequency is 48 Mz(seen from bsp_cmp.h) and my ADC Conversation frequency is 5 Mz (seen from _adc_hw_init() in adc_kadc.c)

Now From ADC Calculator, I found My Conversion Time is 4.8us.

But I am seeing when I am trying to reduce _time_delay(100) in  adc_demo.c file then number of  ADC output reading is very less.

Why?? If conversation rate is fast (in us..!!)  then why only _time_delay(100) is sufficient for reading output?? the delay should be in us not in ms

But when I am putting _time_delay(100) , number of ADC output reading is more.

Here is snippet to calculate numbers of ADC output reading and Time taken for it :

(I measured that to complete 1200 reading it takes appx 121 sec and 9 ms....!!)

for(i = 0; ; i++)

    {   

        /* channel 1 sample ready? */

        if (read(f_ch1, &data, sizeof(data) ))

        {

            printf("ADC ch 1: %4d \n ", data.result);

            count++;

        }

        else

            printf("               \n");

        if (i == 1200) {

      

        _time_get(&RequiredTime);

        printf("<--------------EndTIme MILISEC : %d \n",RequiredTime.MILLISECONDS);

        printf("***************EndTIme SEC : %d \n",RequiredTime.SECONDS);

        printf("Count: %d",count);

      

      

            printf("Pausing channel #1...");

            if (IO_OK == ioctl (f_ch1, ADC_IOCTL_PAUSE_CHANNEL, NULL))

              printf("stopped!\n");

            else

              printf("failed!\n");

        }

        if (i == 1200) {

        i = 0;

        count = 0;

            printf("Resuming channel #1...");

            if (IO_OK == ioctl (f_ch1, ADC_IOCTL_RESUME_CHANNEL, NULL))

              printf("resumed!\n");

            else

              printf("failed!\n");

        }

        _time_delay(100);

    }

0 Kudos
1 Solution
362 Views
utsavikalpesh
Contributor V

Hi..

I am sorry but I found later that by reducing time_period of ADC_INIT_CHANNEL_STRUCT, I am able to read 1200 adc outputs within a 29ms..!! Thats great.

View solution in original post

0 Kudos
2 Replies
363 Views
utsavikalpesh
Contributor V

Hi..

I am sorry but I found later that by reducing time_period of ADC_INIT_CHANNEL_STRUCT, I am able to read 1200 adc outputs within a 29ms..!! Thats great.

0 Kudos
362 Views
soledad
NXP Employee
NXP Employee

Hello Utsavi,

Thank you for your contribution.

Regards

Soledad

0 Kudos