LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeated data.

Hi, I am developing an application to read in a voltage reading on a NI 9219 analogue input module, and also an encoder signal for measuring angular rotation. The encoder is being read in on a PCI card manufactured by DEVA Electronics and I am using the Sub VI's generated by them to read in the encoder to software.

 

The problem I am getting is that when I am logging the data to file, I get repeated values of data for both the voltage reading and the encoder reading. I am not sure why this is happening.

 

I thought that it coud be something to do with the timing of my loop but I've played around with them and nothing happend. Could someone look at the attached VI's and point me in the right direction.

 

Thankyou

Rhys

Download All
0 Kudos
Message 1 of 9
(2,787 Views)

Can you please convert it into 2011 format Smiley Embarassed

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 9
(2,740 Views)

Hi, Here's the 2011 converted VI's

 

Rhys

Download All
0 Kudos
Message 3 of 9
(2,726 Views)

Hi Rhys

 

I had a look at your program and extracted the write to TDMS part. I found that running only this part gave me one bit of data written for each input. However I may be mistaken, can you upload an example of both what the TDMS file should look like and what it does look like? Or upload the file and point out the specific parts where the data repeats? 

 

As well as this quite a few places in your code where it could do with some restructuring and neatening up as it does not follow good LabVIEW programming standards. Would you like me to make some recommendations about this? 

 

Many thanks 

 

Daniel Harryman

 

NI Applications Engineer 

Daniel Harryman MEng
CLA, CPI
0 Kudos
Message 4 of 9
(2,706 Views)

Hi Daniel,

 

Yes I am very open to recommendations on VI. Please advise.

 

I will post the data onto the forum when i get back into the office on Monday.

 

Rhys

0 Kudos
Message 5 of 9
(2,679 Views)

Hi Daniel,

 

Could you make any suggestions?

 

Rhys

0 Kudos
Message 6 of 9
(2,643 Views)

You should take a look at the producer/consumer architecture, this way you would enqueue data only when new values are generated. Your problem is probably that the loop that builds the X and Y data arrays is faster that the loop that generates the data so you get repeated values before new data is generated by the DAQmx tasks.

 

Ben64

0 Kudos
Message 7 of 9
(2,628 Views)

@ben64 wrote:

You should take a look at the producer/consumer architecture, this way you would enqueue data only when new values are generated. Your problem is probably that the loop that builds the X and Y data arrays is faster that the loop that generates the data so you get repeated values before new data is generated by the DAQmx tasks.

 

Ben64


Excellent point Ben!  Not only would queues help syncrhonize the acquisition loops but the potential for race conditions would greatly decrease.  And I'm thinking there is a potential for several race conditions in that code.

Another thing to fix is this un-initialized shift register on X.  That is not getting cleared between loops.

1!.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(2,625 Views)

Hi Rhys 

 

I was waiting for the two files I requested. I think what the others have said is correct and you should look into the producer consumer architecture. 

 

http://www.ni.com/white-paper/3023/en

 

You should also try limiting your use of sequence structures unless you absolutely have to use them. You can normally force things to execute in a certain order using data flow. Another point is that some of your while loops have been set as "continue if true" with a not gate before them. You can just set the terminal as "stop if true" and remove the not gate. 

 

If you send me those files. I'll have a better idea the problem you're getting. 

 

Many thanks 

 

Daniel Harryman

Daniel Harryman MEng
CLA, CPI
0 Kudos
Message 9 of 9
(2,599 Views)