pin performance
-
hi,
i have tested pin read performance
and it is like this:
read 1000 times pin value:
20558
21this is my test file
from machine import Pin import time dht_pin=Pin('P9', mode=Pin.OPEN_DRAIN, pull=None) am = time.ticks_ms() au = time.ticks_us() #comment this line if you have not enabled this in firmware for i in range(1001): dht_pin() print(time.ticks_us()-au) #comment this line if you have not enabled this in firmware print(time.ticks_ms()-am)and i see that i can read one pin value in 21 us
but specification for e.g. dht11/22 is like this:Bit '0' : ~54uS Low and ~24uS High Bit '1' : ~54uS Low and ~70uS Highi see that i can miss high value because its duration is 24us
how can we improve pin read time?for test i enabled in firmware time_us()
but previously tested this without any change -
I see some possibilities in speed up things by batch read
I will try to write some code and back with results
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login