- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Utsavi,
Thank you for your contribution.
Regards
Soledad