LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sensor


Hello,

I am working on proximity sensor... To get digital output I am using NI9403 daq system... After forming digital waveform graph I am not able to connect write to measurement file to get output data in excell sheet.... Can you please tell me how can I obtain entire output after digital waveform?!

0 Kudos
Message 1 of 7
(1,550 Views)

Can you please share the LabVIEW code you've written (attach the VI or VIs, not pictures, please)?

 

Bob Schor

0 Kudos
Message 2 of 7
(1,523 Views)

Please find the programming. 

0 Kudos
Message 3 of 7
(1,499 Views)

@Shre4071 wrote:

Please find the programming. 


Where?  Nothing was attached to your Post!  Please attach your VI (or your entire Project, after you compress it to create a .zip file).

 

Bob Schor

0 Kudos
Message 4 of 7
(1,478 Views)

Please FInd attached...

0 Kudos
Message 5 of 7
(1,456 Views)

Oh, dear -- you are using the Dreaded DAQ Assistant (my term -- I "fondly" call it the "DDA"), and in the code you attached, you apparently haven't configured it for anything (as no input devices are specified, no logging is specified, etc.).

 

In My Humble Opinion, the DAQ Assistant was "invented" by NI Marketing to show how easy it was to do simple Data Acquisition with LabVIEW -- "You don't even have to learn LabVIEW to collect data from devices", I imagine the Marketing Blurb trumpets.

 

On the other hand, DAQmx, the really brilliant series of VIs and functions that make the DDA "do its thing", is brilliant, relatively simple, and is What You Should Be Using.  There's a wonderful LabVIEW White Paper in the DAQmx Series called (approximately -- if you search the Web using the first 5 or 6 words of this title, you'll find it) "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of your Data Acquistion Applications".

 

Skip the first section, which mentions the DDA.  I'm going to summarize the rest of this for you (and give you my "personal spin" on getting started.

  • Always start by using MAX to "play with your DAQ device".  Hook your Proximity sensor up to your NI 9403 and plug it in (to a CompactDAQ?  CompactRIO?), and connect the latter to your PC.  Open MAX, let it find the CompactWhatever, and open the 9403. 
  • Configure some Test Panels for Digital Input, and connect your Proximity Sensor as recommended by the Manufacturer.  Figure out what you need to do to get the Proximity Sensor to "talk to" (and send data to) the 9403, and let MAX show you what it finds.
  • Note that the previous step involves knowledge of the Proximity Sensor (including how it needs to interface with the 9403, how it communicates with the 9403, what you do to configure it as far as timing, input/output, number of bits, whatever it needs).  You have the relevant manuals (I hope), and should be able to figure this out.  If not, see if there are colleagues or an Instrumentation Shop around with experience in digital I/O.
  • Once you know how to "hand-configure" MAX to get data from your Device, and you have a working Test Panel, you can do one of several things:
    • Save the Test Panel as a named MAX Task.
    • Remember the settings you used to create the Test Panel Tasks.  [No, don't "remember" them, write them down!]
  • If you saved a MAX Task, reproducing it in LabVIEW is probably as simple:
    1. Lay down Start Task, DAQmx Read, and Stop Task. 
    2. Connect their Task In/Out and Error In/Out lines.  Draw a While Loop around DAQmx Read.
    3. Task Input on Start Task and create a Constant.  Click the little Triangle on that Constant, which should expand and show you the Task you just created in MAX.  Accept that Task.
    4. Configure the DAQmx Read to output the Digital Samples in the format you want (which will depend on how you configured the Task.  Decide what you want to do with those data.  For the first attempt, I'd suggest simply wiring the output to a Digital Chart that you keep inside the While Loop so that it updates as the Loop runs.
    5. Now try it out.
  • If you didn't "try it out", you'll need a few more DAQmx functions to find your Device, configure its input channels, and any other settings.  If you are working in a LabVIEW Project, you can also go to your Target (either "My Computer" or your remote Target), right-click and choose "New", and get the ability to create, in your Project, a DAQmx Task just like you did with MAX.  As the "Learn 10 Functions" will show you, you can also use some DAQmx Functions to "build your own" Task setup, including searching for connected devices, setting clock rates, setting individual Channels at run time, etc.  But the basic principle is still the same:
    1. Do a few functions to define the Task.
    2. Start Task.
    3. Inside While Loop, do single Data Input or Data Output and immediately handle each sample.  [I'm assuming you are doing "Continuous" data input or output, for example, sampling 1000 samples at 1 kHz over and over, so you'll have 100,000 samples after 100 seconds].
    4. When you exit the Loop (sometimes because you pushed the Stop button), Stop Task.

This brings up another point -- continuous Data Acquisition (or Data Production).  How do you "time" the While Loop that takes each set of samples?  The answer is, you don't -- you let the DAQmx Hardware, which has basically an "uninterruptable clock" (unlike your PC's clock) that "guarantees" output of however much data you specify and at whatever time interval is specified by # Samples x Sampling Rate.  So if you say "1000 Samples at 1 kHz", the loop will run precisely once per second.  The amount of time it takes for a DAQmx Read to "read" the data is, in this case, 1 second, but it takes only (say)  a fraction of a millisecond to deliver it to you for further processing, say writing to a Chart.

 

The Principles of Data Flow says that since the output of the DAQmx Read is connect to, say, a Chart, the Read will go first, then the Chart.  So the first time into the Loop, the Read will take 1.000 second, and writing to the Chart we'll say takes 10 ms.  Now the first While is done, and you start the second While.  The second Read will occur 0.99 seconds later (because it started without interruption when it finished 10 ms earlier), and the second Chart will have 10 ms more time (that it doesn't need), so all the data are captured, and all are displayed.

 

But what happens if you need to do "more processing", say save to disk, or do some intensive processing that might take > 1 second?  The answer is you take the data and send it to another Loop, running in parallel, to do the time-consuming work.  This is something called the Producer/Consumer Design Pattern -- you probably don't need to worry about this now, but it is something that comes with LabVIEW "for free".

 

Bob Schor

 

0 Kudos
Message 6 of 7
(1,443 Views)

Dear sir,

Can you just provide me with a solution for that? I am not able to identify the mistakes in the circuit diagram? Please do one help, sir.

Thanks in advance.

0 Kudos
Message 7 of 7
(1,410 Views)