LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single virtual channel with multiple digital ports

Solved!
Go to solution

Hi all,

I have created a program that creates a task to read continuously from 3 digital port lines from the same device (PXI-6133). I am trying to figure out how I can retrieve the data from each port line to put into a waveform graph. Currently, I am using the DAQmx Read instance with "1 Channel N Samples" but I get a waveform with all values at the same time or a waveform graph with all three lines transposed.

 

 

I am using Windows XP and LabVIEW 8.6.

 

Appreciate any help!

0 Kudos
Message 1 of 5
(1,551 Views)
Highlighted

Hi,

 

There should be an example that ships with LabVIEW, which is very similar to what you are looking to do. Open the LabVIEW Example Finder (Help >>Find Examples...) and navigate to the Cont Read Dig Chan-Int Clk.vi example (Browse >>Hardware input and Output >>DAQmx >>Digital Measurements >>Cont Read Dig Chan-Int Clk.vi)

 

You will likely need to modify this code, but it should be a very good jumping off point for you. You will also need to make sure that your task is reading from all three of the lines. If you have not used DAQmx for digital inputs in the past, this Building a Digital Input VI in NI-DAQmx video tutorial will likely be very helpful for you.

 

I hope that helps!

 

 

 

 

Matt
NI Community Team
National Instruments
0 Kudos
Message 2 of 5
(1,532 Views)
Highlighted

Hi Matt,

Thanks for your reply. Unfortunately thats not quite I am looking for. I am sending the DAQmx task the 3 port lines that I want therefore as I have read it bundles them all into one channel by default. What I want to do is take that one channel and parse out the data of each of the 3 port lines to create 3 new waveforms to work with individually.

 

After fumbling around a little bit, I was able to sort of get what I wanted. I've attached a screen shot of that portion of the program. The red circle in the bottom right hand corner is how I want to end up. I only did it for one of the pieces of data just to try it out and the conversion to string is just for me to print out what I'm working with. Unfortunately, when I look at the waveform it seems like maybe some extra 0's are being thrown in because its not the same graph that appears from the beginning (when all 3 pieces of data are transposed on each other). Let me know what you think.

 

Thanks,

julissa

0 Kudos
Message 3 of 5
(1,522 Views)
Highlighted
Solution
Accepted by topic author JCampos

Matt,

Sorry to have brought this upon you but I figured it out. I misread the description of the DAQmx Create Task vi for Digital Input. I thought that multiple port lines could not be divided into multiple channels but it was entire physical ports.

 

For anyone else looking for the answer: I was able to specify "one channel for every line" in the Create Task then during the DAQmx Read task I indicated "N Channels N Samples" and finally parsed out the 1D array to get the data for each port.

 

Thank you for your time!

0 Kudos
Message 4 of 5
(1,510 Views)
Highlighted

Glad to hear you got things working, Julissa. Feel free to post if you run into more issues!

Matt
NI Community Team
National Instruments
0 Kudos
Message 5 of 5
(1,497 Views)