Shop OBEX P1 Docs P2 Docs Learn Events
Debug statements effect on servos — Parallax Forums

Debug statements effect on servos

vla7vla7 Posts: 79
edited 2008-12-22 18:28 in Robotics
I notice that whenever I have Debug statements on my program that it effects my servo performance so that having several debug commands will result in my servos running very "choppy" and as I remove each statment the smoother they will run.· Can someone explain why this is happening?

Comments

  • LarryLarry Posts: 212
    edited 2008-12-21 21:08
    The Debug statement take time to transmit the serial information. each one in your program delays the amount of time between servo refreshes.

    Ordinarily, you want to refresh the servo command 50 times per second. Try shortening or removing any PAUSE command yo have in your servo loop.
  • vla7vla7 Posts: 79
    edited 2008-12-21 21:54
    Is there a way to figure out how long the statements are taking or calculating how many times per second the servo command is being refreshed?
  • FranklinFranklin Posts: 4,747
    edited 2008-12-21 22:38
    www.emesystems.com/BS2index.htm Has info on instruction timing among other useful topics.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-12-22 18:28
    You sure can…you’re transmitting 9600 bits per second when using debug. 10 bits equals 1 byte (after start /stop bits) and you have to factor in any control characters you send as well. Based on how much data you’re sending you can calculate the total amount of time, minus instruction loading, which was linked above. The correct solution is to remove other delays temporarily to compensate, though I have to admit, DEBUF statements at the servo refresh rate would be pretty hard to follow. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.