Shop OBEX P1 Docs P2 Docs Learn Events
execution time of the instruction — Parallax Forums

execution time of the instruction

Hello,
I would like to ask if I can find information about the execution time of particular statements anywhere? I mean, among others, the conditional if statement and assigning the pin state to a variable.

Thank you in advance for your answer.

Comments

  • ElectrodudeElectrodude Posts: 1,621
    edited 2021-05-25 21:01

    If you don't find the information you're looking for (and I suspect you won't), you can figure it out yourself using a logic analyzer, or any other device that can measure pulse widths (such as a second Basic Stamp). First make a program that does a HIGH immediately followed by LOW on the same pin and measure how long the resulting pulse is. Then, put various instructions between the HIGH and LOW and see how much time the additional instructions add to the baseline pulse width.

  • PublisonPublison Posts: 12,366
    edited 2021-05-25 21:20

    Welcome to the forums!

    You might want to start at Tracy's site:

    http://emesystems.com/OLDSITE/BS2speed.htm

    and then:

    http://emesystems.com/OLDSITE/BS2index.htm

  • Also remember that there are many instructions with variable execution times. For example, PULSIN is affected by the length of the incoming pulse, which can vary.

Sign In or Register to comment.