LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallax ultrasonic

All,

I'm attempting to use a Parallax Ping Ultrasonic sensor #28015 with a c-RIO robot for the FIRST program. Problem, the sensor sends and receives on the same 5v pin and the c-RIO wants two DIO ports, one receive one send. Can anyone assist with a programming solution to send and receive on the same DIO pin?

Thanks

0 Kudos
Message 1 of 3
(3,750 Views)

jdam,

 

I just happen to have used several Ping sensors, and while I didn't have the luxury of a cRIO (just a Freescale HS12 something-or-other) I think I may be able to help.  My first question is:  What DIO module are you using?

 

For anyone else reading who may be unfamiliar with the sensor:  

The sensor waits for a trigger on it's sole I/O line (why they didn't just use two lines, one for In and one for Out, I'll never know) and then starting 750us later returns a pulse who's width is proportional to the distance to the nearest object.

http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf

 

So you need to be able to tristate your output to the sensor and start reading back data in less than 750us.  I'm not an expert on cRio modules, but it looks like some of them are capable of being inputs or outputs, so you might be able to accomplish your goal by simply switching the pin to be an Input right after you give it a pulse.  Since the tHoldoff is specified starting when your output goes low, you'll probably have to place a weak pulldown on your IO pin so that when you turn it into an input the sensor sees a 0.  Again, I've never tried to do this with a crio module so you'll have to figure out if you can meet that timing.  I imagine that the code would look something like:

 

Configure Pin0 as an Output --> Output a 1 --> Wait for 5us (tOut typical) --> Configure Pin0 as an Input --> Start reading Pin0 until it goes to 1 --> Continue reading Pin0 until it goes to 0 

 

Another option (if your module doesn't support bidirectional ports) is to use an external buffer with a tristate pin like one of these ($0.40 for four) which can probably be ordered in DIP form from Mouser or your favorite distributor (I like Mouser because they can get things to Austin, TX in usually less than 24 hours).  This would require TWO outputs from your cRio (one to drive the Trigger pulse and one to control the tristate) and one Input.

 

Hugs,

memoryleak 

Message Edited by memoryleak on 09-07-2009 02:14 PM
Message 2 of 3
(3,739 Views)

Here is the website for FIRST, please use it for discussion forums.

 

http://decibel.ni.com/content/community/first

 

Thanks,

 

Anna K.

National Instruments
0 Kudos
Message 3 of 3
(3,699 Views)