LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem reading digital data from multiple lines

I have a task which includes the following channels:

 

Dev1/port0/line0
Dev1/port0/line1
Dev1/port0/line2:7

 

Line grouping is one channel for all lines.

I am using a simulated PCI 6259 card so data on port 0 is basically a counter that goes from 0 to 255.

 

Onces I read N channels and N samples and graph the data, the first channel goes from 0 to 1 (this is good) but the second channel goes from 0 to 2 and the third channel goes from 0 to 255. What could be causing this problem? First 2 channels should go from 0 to 1, and the last channel should go from 0 to 31.

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

Can you include your code, with a note as to which version of LabVIEW you are using? If it is being simulated (in MAX?) we should be able to run it as well as just look.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 7
(2,671 Views)

Sorry, there are multiple vis in my application and the code is not organized. I am attaching the two vis that setup the digital task and read the data. I am using Labview 8.6.

 

 To make the problem even simpler, I just used 3 channels as follows:

 

Channel 1: Dev1/port0/line0

Channel 2: Dev1/port0/line1

Channel 3: Dev1/port0/line2

 

 The output for each channel should be 0 or 1, but I'm getting the following results:

 

Channel 1: 0 or 1

Channel 2: 0 or 2

Channel 3: 0 or 4

 

What it looks like is reading line 2 will give me a 32-bit number with the 3rd bit's value changed. I only want it to change the 1st bit's value. So if I'm reading line 2-7, it should change bits 1-7 rather than 2-7 on the 32-bit returned value.

 

PS: is there any way to read 2D array of 8 bits rather than 32 bits? When I  try it, it gives me an error saying minimum number of bits is 32.

 

Is this the default behaviour or there is something going on with my own setup?

Download All
0 Kudos
Message 3 of 7
(2,657 Views)

What you are seeing is the right behaviour. TheDAQmx Digital read instance that you have selected is '32-bit port format'. This means that the a particular lines value is returned assuming that you have a 32-bit port. So if you opt to read 'line 2', your data will be 00000000000000000000000000000X00, which can be 0 or 4 based on value of X.

 

 

Message Edited by kikiduu on 01-25-2009 01:31 PM
------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 4 of 7
(2,632 Views)

abdel2 wrote:

PS: is there any way to read 2D array of 8 bits rather than 32 bits? When I  try it, it gives me an error saying minimum number of bits is 32.

 

Is this the default behaviour or there is something going on with my own setup?


Port 0 of 6259 has 32 lines. That will be the reason why you are not able to read it as 8-bit port.

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 5 of 7
(2,630 Views)

 Thank you both of you.

 

I just used "Logical shift" function to fix this issue. Now the problem is that I have to do it in real-time on every single data point I'm getting. I'm also sampling at a very high rate (25K/ch) so I think it will consume a lot of CPU power and memory. Althought the program seems to work, I haven't done any tests on memory and CPU power yet.

 

Would it be better if I acquire all the lines in one channel (read the whole port) and then discard the lines that I don't want to you? Essentially what I want to know is if I defined a physical channel as port0/line2, does the DAQ Read function still read data from the whole port (port0) and discards the lines that it doesn't need?

0 Kudos
Message 6 of 7
(2,614 Views)

You read the data using the Digital 1D Wfm NChan NSample instance.In this way each digital waveform channel will only include data of the lines that you have configured for that channel. You can use 'extract waveform components' function to get the digital data.

 

What exactly will you be doing with the acquired data?

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 7 of 7
(2,612 Views)