Shop OBEX P1 Docs P2 Docs Learn Events
Modified Ping Pasm attachment corrected — Parallax Forums

Modified Ping Pasm attachment corrected

RS_JimRS_Jim Posts: 1,753
edited 2015-11-03 16:05 in Propeller 1
Hi,
Thanks to another thread, I discovered Ping PASM in Obex. When I downloaded it I found that it was just a demo program to demonstrate using a counter to run a Ping in a cog. I modified the PASM portion of the program to permit the use of both timers thus 2 Pings and global VARS. My thanks to Wm Dygon (pogertt@wi.rr.com) the original author of the program and JonnyMac for teaching me how to use Global Vars.

I will attach the Archive file to this post when I figure out how to do it!

Comments

  • Great! Looking forward to it
  • Go Jim GO!
  • Ok, So I had Java Script disabled in Firefox and it would not let me attach a file,
    lets try to attach that archive file.

    Let me know what you think?
    Jim
  • Wow! I had no idea these ping sensors were so easy to use. Trying it now :)
  • Well that didn't go over well. I have one of the cheap 4-pin gadgets from ebay but it doesn't seem to be working. Writing on the trigger pin and reading from the echo pin, but i just get a consistent 206 centimeters every time. Which means it is giving a pulse on the echo line... just not a meaningful pulse :(
  • Yeah this was written for and tested on genuine Parallax Ping. The program uses a single communication pin, not 2. I was running 3 pings and using them to control the color of ws2814B LEDs . Works great!
    Jim
  • What would be the possibilitys with a For and Aft ping setup?
  • MikeDYur wrote: »
    What would be the possibilitys with a For and Aft ping setup?

    Pings are really easy to use. The Propeller waitpxx are very precise so you don't really need to use PASM to read the sensor (nor does it hurt to use PASM).

    I modified the Ping program which comes with the Propeller Tool to compensate for temperature.

    Here's a link to my version.

    http://forums.parallax.com/discussion/158541/ping-object-with-temperature-compensation-and-more

    The main thing to keep mind is not to trigger multiple Pings at the same time. If more than one Ping is triggered, the echo from one sensor will interfere with the other.
  • RS_Jim wrote: »
    Let me know what you think?

    Jim,

    If you're still monitoring the forum I'm curious about the program you posted. I the top post you mention using a PASM version of the code but when I downloaded the version attached above, it looks a lot like the code in the Propeller Library. Did you decide not to use the PASM version?

  • Thanks Duane, I still need to replace my revision A board. But I would like to do ping))dar in one sweep.
  • Duane,
    I am still around. Can't get to a windows computer for several days to check the code I posted. What I did was take the Obex version of PingPasm and added a second counter. Using the Pings in this way allows two pings to be run together in 1 cog and not interfere with each other. With the Spin version of Ping, the code uses waitPNE, waitPEQ and will hang if one ping fails to respond. My version is a very subtile modification of the PingPasm from obex that uses the second counter and either Ping can be disconnected without hanging up the program. Check my program and compare it with Ping Pasm from Obex and I believe that you will find less than ten lines of code different.

    If you run the comparison and find no difference, let me know and I will look at it first opportunity I can get on my WIN computer. Can't check it from the iPad. Ran the Pings close together, pointed in different directions, and did not observe any interference problems.

    Jim
  • Hi Jim,

    I think you may have uploaded the wrong demo code. The code you attached above using the normal Ping object with the waitpeq statement.

    If you can find your PASM demo, I'm interested in seeing it.
  • oops!
  • RS_JimRS_Jim Posts: 1,753
    edited 2015-10-29 14:17
    text deleted as redundant
    Jim
  • RS_JimRS_Jim Posts: 1,753
    edited 2015-10-29 14:16
    Lets try and attach the correct file this time! Ok it seems to be right now, now if I could only figure out how to delete a post!
    Jim
  • Duane
    Is it right this time?
    Jim
  • Has anyone had an opportunity to test the code in the new attachment? I like using it because if a Ping gets detached the code will not hang because it is not using waitPEQ,PNE.
    jim
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-11-09 17:38
    I haven't used it yet but I'm a bit concerned about using it with two Pings because the code triggers both sensors at the same time. If the two sensors are close enough to receive echoes from each other, the sensor readings could be off.

    The original Eddie firmware triggered all the Ping sensors at once. I noticed the two Ping sensors I used to test the code had a lot of interference from each other. I modified the Eddie code to trigger the Pings one after the other which eliminated the noise issue.

    I really like the idea of not worrying about Ping code getting hung up waiting for a pin change but I think the code, as it is, will cause interference if the two Ping sensors are close to each other.
Sign In or Register to comment.