Having a little problem with PULSIN...any thought on this Mike Green
Here is what I am doing...I am triggering with PULSOUT (BS2) to a ultrasonic transducer (for range measurements...similar to the PING))) but not a PING))) device.· The PULSOUT is on a different I/O pin then the PULSIN command that I am using to try and measure the TOF (time of flight).· The PULSIN command is the next line of code after the PULSOUT trigger.· I know for a fact that the PULSOUT trigger is working, because I can hear the click of the transducer, and the onboard LED's of the transducer are working.· However, I cannot get the stamp to see the incomming pulse and measure the pulse width.· I can see the pulse clearly on the scope, but the stamp does not.
The incomming pulse according to the documentation starts low AT the trigger, then goes high until the echo is received then goes low.· I have tried every combiniation of "states" for the PULSIN command, and always get a 0 returned for the variable.
Now, I know using the PING))) device, the PULSOUT and PULSIN command uses the same I/O pin, where I am using one I/O for the PULSOUT trigger, and another different I/O for the PULSIN command.
Has anyone had the same problem?· Any work arounds, as I really would like to be able to measure the length of the incomming pulse to determine the range.· BTW, according to the scope, the amplitude of the incomming pulse is a full 5 volts.· Easy to see on the scope.
I would appreciate any thoughts on this.· And, the transducer I am using is from Senscomp...Mini-SE.
Deno
Post Edited (deno) : 5/28/2008 10:19:01 PM GMT
The incomming pulse according to the documentation starts low AT the trigger, then goes high until the echo is received then goes low.· I have tried every combiniation of "states" for the PULSIN command, and always get a 0 returned for the variable.
Now, I know using the PING))) device, the PULSOUT and PULSIN command uses the same I/O pin, where I am using one I/O for the PULSOUT trigger, and another different I/O for the PULSIN command.
Has anyone had the same problem?· Any work arounds, as I really would like to be able to measure the length of the incomming pulse to determine the range.· BTW, according to the scope, the amplitude of the incomming pulse is a full 5 volts.· Easy to see on the scope.
I would appreciate any thoughts on this.· And, the transducer I am using is from Senscomp...Mini-SE.
Deno
Post Edited (deno) : 5/28/2008 10:19:01 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
-Phil
center_trigger···· PIN······ 2
senter_sensor·····PIN······ 3
Trigger······· CON······ 10
islow·········· CON········ 0
isHIGH········ CON·········1
target········· VAR········ Word
check_center_sensor:
···PULSOUT center_trigger, Trigger······················ '* activate sensor by pulsing HIGH
· ·PULSIN· center_sensor, islow, target················ ·'* measure echo pulse
·RETURN
Trigger works, I can hear the tranducer "click".
Scope pulse width is about 20 mSec., varies with TOF (time of flight) connected to stamp at P3 with transducer also connected to P3.
Any "trick" way for PULSIN to see both edges of pulse?
Deno
Post Edited (deno) : 5/29/2008 12:37:29 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
You could also invert the sensor trigger pulse and use that to trigger the timer if you wanted to use the leading edge of the sensor trigger pulse as your time reference point.
There is a workaround. The Mini S has a self triggering mode. use the Trigger Enable pin ( pin 4 on the sensecomp) instead of the trigger. It will fire continuously when you hold the enable pin high and stop when you pull it low. That gives you more than one shot to see a rising and falling edge for PULSIN.
It would look something like this in your program.
Here's the datasheet. The datasheet is unclear as to whether the enable pin has an internal pullup. I'd try just making the Stamp pin an input instead of pulling the enable pin high .
www.senscomp.com/specs/Mini-S%20PB%20spec.pdf
Post Edited (Larry) : 5/29/2008 3:18:56 AM GMT
Do you have PIN 5 and PIN 6 tied together?
Thank you Mike for your input, but I was hoping not to have to build alot more circuits to make it work.· I will be using 3 of these devices.· That would be alot of extra components.
Larry, thank you aswell, and I will try your software advice and let you know.
deno
Post Edited (deno) : 5/29/2008 2:38:14 AM GMT
check_center_sensor:
PULSOUT center_trigger, Trigger '* activate sensor by pulsing HIGH
RCTIME center_sensor,1, target '* measure echo pulse
RETURN
If it misses the rising edge of the pulse, the RCTIME will measure the time until the pin goes back low. On the other hand, if center_sensor is low when it comes to RCTIME, then it will return target=1. The results from RCTIME might be nearly as good as the PULSIN would have been.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
When it is finished, I will post a movie on U TUBE of the follow me golf·caddy that I am building.· A pull cart with brains. Getting tired of carrying my golf clubs.
Deno