LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

differential analog inputs

Actually I am going to have differnt max and min values for better accuracy. But if you see the express VI properties than also I am getting only 16 rows.

0 Kudos
Message 11 of 26
(1,658 Views)

@andy_kennaugh wrote:

Actually I am going to have differnt max and min values for better accuracy. But if you see the express VI properties than also I am getting only 16 rows.


Oh you're right I think you can add more tasks as long as it hasn't started yet which yours hasn't.  Could it be because you are trying to reserve the hardware in two places?  Do you only run the express VI or only run the top code?  Attached is one that I think should get all your analog signals and return them as a waveform to be displayed.

 

Oh and a project is a great thing for organization.  It's strange how other programming languages a developer would never start coding without a project.

Message 12 of 26
(1,651 Views)
As long as you use the same task, you can set the min and max for each channel differently. The easiest, in my opinion, is to have the Create Channel inside a for loop with a shift register for the task and pass in arrays of channel numbers and limits.
Message 13 of 26
(1,640 Views)

Hmm...I am able to get all the voltages in the waveform chart but not as cluster elements. Is there any limit to number of elements in a cluster.

And I am not a programmer I am a 2nd year mechanical engineer working on a model gas turbine testing rig. 

0 Kudos
Message 14 of 26
(1,636 Views)

When you go from an array to a cluster you must define the size of the cluster to make.  You right click the array to cluster and pick the size.  Yours is set to 16.  But a better solution is to not deal with clusters at all but instead use arrays, like the waveform, or 2D array of data.  It scales better.

Message 15 of 26
(1,632 Views)

how will I pass physical channels in a for loop for differential input, my card is PCI 6255 having 80 AI channels.

0 Kudos
Message 16 of 26
(1,627 Views)

How do I get rows seperated assuming each channel is a row the only way I figured out is using clusters. You seem to suggest making rows as 1D arrays. How can I do that?

0 Kudos
Message 17 of 26
(1,623 Views)
If you use the 1D waveform data type, each row in the array is a channel.
0 Kudos
Message 18 of 26
(1,614 Views)

@Hooovahh wrote:

@andy_kennaugh wrote:

Actually I am going to have differnt max and min values for better accuracy. But if you see the express VI properties than also I am getting only 16 rows.


Oh you're right I think you can add more tasks as long as it hasn't started yet which yours hasn't.  Could it be because you are trying to reserve the hardware in two places?  Do you only run the express VI or only run the top code?  Attached is one that I think should get all your analog signals and return them as a waveform to be displayed.

 

Oh and a project is a great thing for organization.  It's strange how other programming languages a developer would never start coding without a project.


I see nothing inherantly wrong with the disabled code in Hooovahs edit.  OK the Channel List could easilly be "Dev1/ai0:7, Dev1/ai16:23, Dev1/ai32:39"

 

Now lets get some terminology corrected here about DAQmx Stuff:

  •  "Tasks" contain "Channels."  
  • Channels have properties like that can be set per channel:
    • Terminal configuration
    • Input Range 
    • Scale
    • Units
    • Name (I Recommend Naming your channels by the signal they are attached to. see below re: log file type)
  • When a Channel(s) is added to a Task DAQmx Or any Task/Channel Property is set DAQmx "Verifies" the Task.  Essentially it checks to make sure that Yes, The Channel exists on that device and the properties are within the hardware capabilities.  If not DAQmx throws an error (Example: adding My6255AI8, Differential would throw an error since AI8 is AI0- when configured as differential)
  • Tasks Also contain Timing and Trigger properties.  Setting these also causes DAQmx to "Verify" the Task.

BUT! you can't "Use" a "Verified" Task.  Verfied simply means the hardware can be found with those capabilities even if someone else is currently using those hardware resources.  So before we can go any farther the Task must be "Reserved"  Again, We know the hardware exists so Reserving simply obtains an exclusive lock on the needed hardware resources.  If some other Task has any needed resource reserved DAQmx throws an error.

 

So you think the Task is good to go at this point? We have Hardware Capabilities and a lock on the harware we need right?  Not quite.  Just because we have exclusive access to existing hardware doesn't meen the Hardware is "Spun up"  There may be some things needed yet (Clocks started, Gains set...etc) So the next step is to "Commit".  If Some fault occurs spinning up, DAQmx throws an error (And you are probably sending the device in for repair)

 

Now we are good to go! "Start" the Task and it transitions to the "Run" state and starts doing its job.  In the case of a AI Contioneous Task it will run until either: It is Stopped or an error occurs.  Errors like Buffer Overflow, or Timeout happen when your sample rate and reads don't make any sense.  Occasionally, some engineer screws up and applies a signal that causes the device to catastophically fail (Try to avoid that OK?)

 

All of these State transitions have to occur!  You CAN set them explicitly using DAQmx Control Task.vi or, DAQmx is smart enough to implicitly transition through the states as needed.  HOWEVER, lets walk though a brief example: You have a "Verified" AI Task (Finite) and call DAQmx Read.vi;  DAQmx Reserves, Commits and Runs the Task,  The Task completes, becasuse the last explicit state request was "Verified" DAQmx Uncommits, and Unreserves the Task Resources leaving Hardware in the same condition as when DAQmx Read.vi was called (Think it through its the only correct behavior)  This is why "We hate" the DAQ Assistant and yell at programmers that Create and Clear Tasks in loops - way too much overhead.  Its also why I like Tasks in MAX or the project These Tasks are Verified when saved ensuring that the verification is trouble free if the hardware hasn't been removed.

 

 

SO: Despite my lengthy rambling the only real thing Andy needs to do is drop a Task Property node and read the "Channels" property then use an auto indexed loop to set the Name and Range properties of each channel.

 

NOTE on File Type.  Dump the *.csv and use *.TDMS instead.  You will thank me for that.  There is a free TDMS Excel addon that not only gives you all the data in a very nice spreadsheet but, lists all the DAQmx Properties as well.  You can even use DAQmx file logging and just write the TDMS file "Under the hood" and avoid the whole logging loop.


"Should be" isn't "Is" -Jay
Message 19 of 26
(1,594 Views)

Jeff·Þ·Bohrer wrote:

 

Now lets get some terminology corrected here about DAQmx Stuff:


Thanks for your clairification.  My terms were incorrect.

 

I also vote TDMS, and the Excel conversion is nice.  Here is my wrapper I wrote a while ago.

Message 20 of 26
(1,584 Views)