Re: Need API support to provide micro seconds delay
Posted: 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.
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.