Posted: 12:47pm 23 Sep 2022 |
|
|
|
As an experiment to see how fast a Pico can read a pin in a FOR - NEXT loop I wrote a program to read a DHT11 temp / humidity sensor and found you can fill an array at 15uS per sample.
CPUSPEED = 378000 kHz, a one digit pin number and all on one line. Every character slows it down. Here is the relevant part.
'Data format - 80uS high start pulse, 50uS low + 25uS high = 0, 50uS low + 70uS high = 1 Dim integer n ' deliver 20 mS pulse to wake up DHT11 SetPin 1,dout,oc Pin(1)=1 Pulse 1,20 Pause 19 SetPin 1,off SetPin 1,din 'Get the samples For n=0 To 329:a(n)=Pin(1):Next SetPin 1, off 'Got the samples 'for max. speed the above 'for-next' must be on one line with fewest characters Edited 2022-09-24 09:01 by phil99 |