pin performance



  • hi,

    i have tested pin read performance
    and it is like this:
    read 1000 times pin value:
    20558
    21

    this 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 High
    

    i 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


Log in to reply
 

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.