Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Parallax Ping))) Ultrasonic Range Sensor with DAQmx

Overview
This example explains how to use a Parallax Ping))) Ultrasonic Range Sensor with a DAQmx device and a small bit of external circuitry to complete a range measurement.

Description:
The circuit used in this example allows one counter generate a accurate pulse while the other can make an accurate pulse width reading.  The function of the diode is to keep the CNTR 0 output (while it is holding the signal to ground) from draining the response from the PING))) sensor.  The added 10k resistor to ground keeps the signal from floating since the CNTR 0 drain is removed.  The CNTR 1 gate can then freely monitor the signal line for a pulse width.

Steps to implement or execute code
To implement this example:
  1. Define the Physical channels for counter input and output to be used
  2. (optional) Set the rest of the parameters as needed
  3. Run the VI
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI

 

To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the counter features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

Hardware
cDAQ with C series Counter Module

 

fp.JPG

 

bd.JPG

 

**This document has been updated to meet the current required format for the NI Code Exchange.**
Dustin D

Comments
Justin__D
NI Employee

This example may not work if the DAQmx read starts after the pulse is generated.  To make sure the read is ready, a DAQmx start VI should be placed before the DAQmx read.  This start must also begin before the DAQmx start of the pulse output task, so an additional sequence frame may need to be used.  The frame should be placed at the beginning of the structure and the DAQmx start for the read task should be placed in this frame.  This will ensure that the read task is started before the pulse task.

Justin D.

Applications Engineer
National Instruments
Active Participant Dustin_D
Active Participant

Fixed.

Dustin D

Member Escadi
Member

I tried running this VI with my usb 6211 and received the following error message when I have 1 pulse per channel:

Error -200474 occurred at Ping Sensor85.vi

Possible reason(s):

Specified operation did not complete, because the specified timeout expired.

Device:  Dev1

Task Name: _unnamedTask<28>

I'm certain that I have the circuitry right, refer to the image below if I happen to have something wrong. Also, this program is set to run just once correct? How can I have this run continuously? I know how to do this from a microcontroller stand point but not so much from LabVIEW.

https://lh6.googleusercontent.com/mM0OFwDdBSocUPImHBsRn0ThBuVs6DljoM-A1cPL_9PtHg2ptxeoVU4Ve1WzTtX-i_Km5bXshdY