LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get data with a unit out of DAQmx read?

Using DAQmx read, I want to read volts, and then convert those to Hz (or rpm if possible) with a DAQmx custom scale.
 
The scaling of the numerical value goes fine... but apparantly the DAQmx read doesn't add a unit to the ouput data.  Not even when I simply select Volt and no custom scaling.  I can't get a unit on the output.   And thus I get an error when I connect the data output to a indicator with a unit.
 
However, as the custom scaling allows me to set the unit, I assume that it is possible to get a unit included at the output data.   How do I do that??
0 Kudos
Message 1 of 6
(2,830 Views)
Hi Anthony,
You should be able to drop a channel property node and select the unit either from scale or select type of measurement and units.  I did not test this, but I do something similiar when I dynamically create tasks.  Hope this helps.
Chris
0 Kudos
Message 2 of 6
(2,817 Views)

Thanks for the response Chris.

I'm afraid your suggestion doesn't work...  I can set it via the property node, but the readout from 'DAQmx read' still is without unit.  (see the broken wire in the attachment).  I think the property node isn't different than the 'create channel' vi.  I can also set the unit there.  (Either to Volt, or to 'from custom scale')

Now... I could readout the scale with the property node, but that doesn't bring me much further.   I would need to make a case statement with that information, and manually type-cast the unit on the data that I've read.  That would be quite cumbersome with custom scales, as the unit is then set to 'from custom scale'.  Then I'd need to nest another case statement inside the previous one, going through my custom scales.   And the unit from the custome scale is hardcoded in that case...

That seems rather complicated, for something that would seem to have to be handled automatically...   (While else put a unit inside the custom scale?)

Message Edited by Anthony de Vries on 11-06-2006 06:51 PM

0 Kudos
Message 3 of 6
(2,809 Views)

You're right.  That is most annoying.  the property seems useless.  I programatically change the caption text... Torque(Nm)... with property nodes.  This method gets to be combersome as well because i cluster all of the unit values through the VI.  I hope someone knows this because it would be simpler to write.

If you open up the create scale VI, the reason becomes clear.  The prescaled and scaled values are appended to scale after the fact. it never gets updated, at least that is how i interpret it.

 

Chris

0 Kudos
Message 4 of 6
(2,800 Views)

Never mind, it was a reference and not a property node.  I'm not really sure how that reference works as far as data flow.

Maybe there is a way to programatically save a created scale into max, read scale from max, and when done delete from max. Just a thought.

Chris

0 Kudos
Message 5 of 6
(2,792 Views)
Anthony

As the automatic conversion of the data output of DAQmx VIs just isn't implemented, I think the best way to achieve what you want is to wrap up those unit assigned numeric VIs in SubVIs; thus you'd have to write the nested case statements only once.

Best regards

Philipp
0 Kudos
Message 6 of 6
(2,756 Views)