Deutsch   English   Français   Italiano  
<uu3lsu$3i8u6$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: The Natural Philosopher <tnp@invalid.invalid>
Newsgroups: comp.sys.raspberry-pi
Subject: Re: Need help with PI PICO...
Date: Thu, 28 Mar 2024 11:56:14 +0000
Organization: A little, after lunch
Lines: 56
Message-ID: <uu3lsu$3i8u6$2@dont-email.me>
References: <utn4f2$3p985$1@dont-email.me>
 <20240323183723.b2902fb94d75422b924c1bc7@eircom.net>
 <utnkjj$3t5m0$1@dont-email.me>
 <20240324072346.81064ff46570e669982a1f4e@eircom.net>
 <utp1sm$acjh$1@dont-email.me> <utrna6$113rn$3@dont-email.me>
 <uts6t5$163q2$1@dont-email.me> <uu3a4r$3f1sd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 28 Mar 2024 11:56:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="819b81787524f0eaad2af0bae1bda731";
	logging-data="3744710"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+J07oHbE5tvi1G8lrTOXxZT8/tzKkx/jI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:RWgamj81NhCJKNisQbq+wMCaWEQ=
In-Reply-To: <uu3a4r$3f1sd$1@dont-email.me>
Content-Language: en-GB
Bytes: 3115

On 28/03/2024 08:35, Björn Lundin wrote:
> On 2024-03-25 16:57, The Natural Philosopher wrote:
>> That is, some asynchrounous event in this sequence
>>
>>      gpio_put(ULTRASONIC_OUT,1);
>>      sleep_us(10);
>>      gpio_put(ULTRASONIC_OUT,0); //reset the input
>> //if asynch event lasting more than 100uS occurs here...
>>      // wait for echo pulse start
>>      while(!gpio_get(ULTRASONIC_IN))
>>          ;
>> //then the low-high-low echo pulse will never be detected.
> 
> 
> if you change the wait body to include a counter then you could realize 
> that when the counter had reached a high number - you missed the pulse.
> Just try again then. Getting a reading is not that time sensitive - or?
> 
That will be the next strategy.

I need to isolate exactly which bit is failing, and can remove all the 
other debug code.
If it turns out to be a one in a thousand issue  it probably isn't worth 
trying to avoid it, as you say, simply take another sample


> :START
>        int cnt = 0;
>        gpio_put(ULTRASONIC_OUT,1);
>        sleep_us(10);
>        gpio_put(ULTRASONIC_OUT,0); //reset the input
>   //if asynch event lasting more than 100uS occurs here...
>        // wait for echo pulse start
>        while(TRUE) {
> 
>          if (! gpio_get(ULTRASONIC_IN)) {
>             cnt++
>          } else {
>            break;
>          }
> 
>          if (cnt >= TOO_HIGH_VALUE) {
>             goto START;
>          }
> 
> 
>        }
> 

-- 
“It is hard to imagine a more stupid decision or more dangerous way of 
making decisions than by putting those decisions in the hands of people 
who pay no price for being wrong.”

Thomas Sowell