Shop OBEX P1 Docs P2 Docs Learn Events
Can PING be checked as often as you want? — Parallax Forums

Can PING be checked as often as you want?

patterson7019patterson7019 Posts: 25
edited 2008-08-04 19:51 in BASIC Stamp
Is there any problems with checking as often as you want, or do you want to limit it? ie: servos you only want to update every 20ms.

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--- -- - -
http://perfectaperture.com/robb

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-03 22:25
    You could trigger the PING))) shortly after the response comes in. Check the documentation for the exact timing.

    Keep in mind that the PING))) reports the first echo received. If the space is large with nice crisp echos from distant walls, there may be other later echos that the PING))) would not normally respond to. If you retrigger the PING))) too quickly, it might get confused with the distant echos.
  • patterson7019patterson7019 Posts: 25
    edited 2008-08-04 01:38
    Good point. Hadn't considered that.

    Looking at the manual, page 2 at bottom there is "Delay before next measurement" of 20 microseconds. There is also a 18.5ms "Echo Return Pulse Maximum". Would it be correct to assume it would be a good idea to keep my checks to >19ms?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --- -- - -
    http://perfectaperture.com/robb
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-04 01:48
    You could issue another trigger 20us after the response pulse negative edge, but there might be later echos that would come in as I suggested. How about waiting 50ms? What's the hurry?
  • patterson7019patterson7019 Posts: 25
    edited 2008-08-04 18:39
    20 times a second should be more then enough, quite right. My main concern was over checking and burning something out, as I don't know how long my main loop takes to complete at this point. Secondary was what the optimal rate would be.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --- -- - -
    http://perfectaperture.com/robb
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-04 19:51
    The rate at which you can trigger the PING))) will vary depending on how far away any detected object is. When you trigger the PING))), you won’t be able to do anything else until you receive the response pulse. This could take anywhere from 870us to as much as 2.6ms at which point you must wait 200us before retriggering. If no object is detected the maximum time will be 2.6ms, again with a 200us delay in addition to that. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.