LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital waveform channel names are incorrect

I create a task at runtime where the user selects which physical digital input channels to use and the names for each.  I then sample these digital inputs and write the waveforms to a TDMS file.  The file has the correct data, but only the first channel has the correct name.  Attached is example code that shows the problem.  What am I doing wrong?  I do a similar setup for analog inputs and it works fine.
0 Kudos
Message 1 of 12
(3,729 Views)

Hi knicewar,

where is the wrong name? Can you explain what you expect and what you get? Do you mean the groupname? You can set it with the "TDMS Write" function.

 

Mike

0 Kudos
Message 2 of 12
(3,707 Views)

Hey knicewar,

 

I agree with Mike, a little more information on what you are getting and what you expect would be helpful. In the example that I opened there is simple one channel and the name seems to match whatever I enter in 'name to assign'. What are you seeing if you use multiple channels?

 

-Ben

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 3 of 12
(3,687 Views)

You need to use more than one channel to see the problem.  What I'm seeing is that only the first channel has the name I assigned and all the others do not have the names I assigned.  I can work around this by assigning the names in the TDMS Write call but IMHO I shouldn't need to do this because the channel name attributes are in the waveform.

 

 

0 Kudos
Message 4 of 12
(3,674 Views)
I am a little confused by your example code.  You are creating an array of digital waveforms.  Then you are extracting one waveform from the array and writing it to a file.  This should only write one waveform to the TDMS file.  Also is there a reason you are using a timed loop instead of a normal while loop?
Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 5 of 12
(3,655 Views)

Plese post the code that reads the file. The issue may be at the other end (assuming you are changing the name after the first run).

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 12
(3,650 Views)

knicewar,

 

You should create an array of Channel Names (strings) and wire that into the Channel Names input of the TDMS write. 

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 7 of 12
(3,649 Views)

Yes, like I said, I found this work-around.  But why do I have to use it?  The waveform has all the information it needs to assign names to channels, and from the docs it says that if I don't wire the names input to the TDMS Write VI, it will use the waveform attributes. 

 

As for the other questions, I'm using the digital waveform acquire VI which returns an array of waveforms but for whatever reason, it only returns an array of one waveform.  This waveform has multiple channels (although internally I'm sure it uses a single integer to represent all channels).  Perhaps this is what is confusing the TDMS Write.  With the AI acquire function, I get a single waveform per channel. So perhaps it's thinking there is only one channel to name.  But it obviously can tell there is more than one channel because the TDMS viewer (built-in -- I didn't write it) shows the separate channels.

 
0 Kudos
Message 8 of 12
(3,642 Views)

How are you entering the names?  Here is text straight from the LabVIEW Help

 

name to assign specifies a name to assign to the virtual
channel this VI creates. If you do not wire a value to this input, NI-DAQmx uses
the physical channel name as the virtual channel name. If you use this input to
provide your own names for the virtual channels, you must use the names when you
refer to these channels in other NI-DAQmx VIs and Property Nodes, such as the
source input of the DAQmx Trigger
VI.

If you create multiple virtual channels with one DAQmx Create
Virtual Channel VI, you can specify a comma-separated list of names to assign to
the virtual channels. If you provide fewer names than the number of virtual
channels you create, NI-DAQmx automatically
assigns names to the virtual channels. 

 

 

Are you entering multiple names seperated by a comma?

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 9 of 12
(3,632 Views)
Yes, I was using a string with comma-seperated names.
0 Kudos
Message 10 of 12
(3,616 Views)