Shop OBEX P1 Docs P2 Docs Learn Events
Determination of Code Execution Overhead Delay — Parallax Forums

Determination of Code Execution Overhead Delay

larryclarryc Posts: 2
edited 2006-09-27 13:06 in Robotics
I am currently testing the control of motor speed, pages 82 and 83 or Robotics with the Boe-Bot.· Both tests include in timing a "Code Overhead Delay" of 1.3 and 1.6 ms, which is a significant fraction of the total servo operating times.· How were these numbers arrived at?· Were·either estimated from the code execution times for the one and two loops or measured?

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-26 16:02
    On the BS2, each instruction takes about 300 uSec to execute. So yes, you can add those together.

    If you have a Logic Analyzer (the ANT-8 is a very nice, USB-based one) you can do a couple of 'PULSOUT' commands -- one before and one after the sequence you want to measure and get a 'hard' number for the 'overhead'.

    But I don't understand how 1.2 mSec is a "significant fraction of servo operating time". A servo can't move 1000 times a second. You COMMAND it every 20 mSec, but usually it takes several command cycles for the servo to move to the commanded position. And the Servo is pretty flexible in that 20 mSec too -- it can be as much as 50 mSec before it makes any difference to the servo movement.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-26 16:03
    The BS2 is rated at about 4000 instructions per second. Some statements (particularly complex I/O) have more than one instruction involved. It only takes 4 to 6 statements to come out to 1.3 to 1.6 ms. Try it yourself if you have access to a scope or frequency meter. Make up a loop with just a toggle statement and a goto and see what frequency you get. That's 2 instructions and you'd get a pulse train of about 2kHz. Change the loop to a nested FOR/NEXT with a TOGGLE and see what frequency you get.
  • larryclarryc Posts: 2
    edited 2006-09-27 13:06
    Thanks for the suggestions.

    Larry C.
Sign In or Register to comment.