P2 with Ping - Ping echo'd pulse not seen @ P2 pin, though appears @ Ping signal out
dgately
Posts: 1,630
Howdy,
Using John Abshier's PingDemo.spin2 code (https://github.com/parallaxinc/propeller/tree/master/examples/EZLib), I'm not able to receive the echo pulse from a Parallax Ping, though a logic probe does see the echo pulse returned. I'm using the schematic from the P1 C demo tutorial @ learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-devices/sense-distance-ping. I assumed that the schematic should work for P2 as well...
Set up this way, the logic analyzer displays:
If I connect the logic probe directly to the Ping signal pin:
The analyzer displays the proper echo pulse:
So, John Absheir's code appears to work (the echo pulse is emitted from the Ping), but I'm not sure why the signal does not appear at the P2 pin. I've tried several resistor values (3.3k, 1.2k, etc) with no change. Since I'm physically not seeing the echo pulse after the resistor, is there something on the P2 pin side that needs to be present (pull-up or pull-down resistors don't make sense, correct?).
Any help appreciated,
dgately
Using John Abshier's PingDemo.spin2 code (https://github.com/parallaxinc/propeller/tree/master/examples/EZLib), I'm not able to receive the echo pulse from a Parallax Ping, though a logic probe does see the echo pulse returned. I'm using the schematic from the P1 C demo tutorial @ learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-devices/sense-distance-ping. I assumed that the schematic should work for P2 as well...
Set up this way, the logic analyzer displays:
If I connect the logic probe directly to the Ping signal pin:
The analyzer displays the proper echo pulse:
So, John Absheir's code appears to work (the echo pulse is emitted from the Ping), but I'm not sure why the signal does not appear at the P2 pin. I've tried several resistor values (3.3k, 1.2k, etc) with no change. Since I'm physically not seeing the echo pulse after the resistor, is there something on the P2 pin side that needs to be present (pull-up or pull-down resistors don't make sense, correct?).
Any help appreciated,
dgately
Comments
-Phil
John Abshier
The main code calls a Ping Inches function: Then, the call chain goes like this. I have 3 questions embedded as UPPERCASE comments within: Sorry, my confusion is whether 'drvl _pin' sets the tri-state or if 'dirl _pin' is needed.
Thanks for responding,
dgately
This is the routine in pins2.spin2 that may need to be changed. I will try to check this out later.
John Abshier
This change allows the pulse to show up on the pin, but the Ticks function returns a really low value of microseconds for the width of that pulse. Logic is giving a value like: .324 ms when an object is about 80 millimeters from the Ping. The Ticks code is returning the number 3.
Thanks Phil and thanks John for taking a look,
dgately
John Abshier
I'm getting realistic results now... I'll test the other functions of Pins2.spin2 as well!
Thank you,
dgately