Need API support to provide micro seconds delay

peterglen
Posts: 27
Joined: Thu Mar 22, 2018 5:55 pm

Re: Need API support to provide micro seconds delay

Postby peterglen » Tue Oct 06, 2020 7:46 pm

This will take about 30 microseconds to execute:

int samp = adc1_get_raw((adc1_channel_t)channel2);

So for a hundred microsecond delay do:
for(int loop = 0; loop < 3; loop++)
{
int samp = adc1_get_raw((adc1_channel_t)channel2);
}

It goes without saying that this a workaround for a systematic solution; This delay is jittery, as the higher priority processes will interfere. However, this is a good trick to waste time while waiting for an event to happen. Remember to initialize the A2D (ADC) subsystem.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need API support to provide micro seconds delay

Postby Ritesh » Fri Oct 09, 2020 6:39 am

kearins wrote:
Mon Aug 21, 2017 8:23 pm
Ritesh wrote: Yes. We have ported that stuff using RMT Interface and it works fine without any issue.
Hi, Ritech, could I put an eye on your ported version of onewire.c?
Hello,

Sorry we can not share as it is for company related product and proprietary as well.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need API support to provide micro seconds delay

Postby Ritesh » Fri Oct 09, 2020 6:41 am

peterglen wrote:
Tue Oct 06, 2020 7:46 pm
This will take about 30 microseconds to execute:

int samp = adc1_get_raw((adc1_channel_t)channel2);

So for a hundred microsecond delay do:
for(int loop = 0; loop < 3; loop++)
{
int samp = adc1_get_raw((adc1_channel_t)channel2);
}

It goes without saying that this a workaround for a systematic solution; This delay is jittery, as the higher priority processes will interfere. However, this is a good trick to waste time while waiting for an event to happen. Remember to initialize the A2D (ADC) subsystem.
Yes. I agree that it will work for microseconds delay but again you need to enable ADC for that in which ADC is not actually used as per product requirement.
But We can use it if really works with all priorities related tasks without any issue.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Bing [Bot] and 128 guests