Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    pin performance

    Scheduled Pinned Locked Moved WiPy 2&3
    2 Posts 1 Posters 812 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      livius
      last edited by

      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

      think about people first, then computers

      1 Reply Last reply Reply Quote 0
      • L Offline
        livius
        last edited by

        I see some possibilities in speed up things by batch read
        I will try to write some code and back with results

        think about people first, then computers

        1 Reply Last reply Reply Quote 0

        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
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom