LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing Issue

I am working with a Vi that has to log data every sec.But with the way I coded, It can only log every 2 seconds.The way it works is kinda confusing,but I'll try to be clear here...
 
1) First I have to read a message A(1 Sec).Message A has information about how may messages follow it (here it is 9)
2) Then we need to read the set of 9 messages that follow.(50ms each and remaining time is empty)
3) Message A updates every 1 second and the 9 messages follow.
4) I am trying to capture the change in the 9 messages every second.
 
I am using Peak-adapters and its drivers purchased from KDI(Kasra Digital instumentation) to perform this operation.The way the read function works is,it tries to keep-reading untill it finds the desired Message. The innermost whileloop takes care of it.Once the meesage is found,the second while-loop keeps reading untill it fininshes reading all the 9 messages.The final while-loop makes sure it writes the data into a file and this process continues.
 
I'm Storing the set of 9 messages into Shift Registers and then Writing it to an text file.I am able to read the message every 2 seconds against the desired 1 sec.I have an impression the Looping is taking the extra second.
 
Can you guys give me some ideas ?
 
I cannot attach the entire set of sub vi's but I am attaching the Required Vi;s and the document it generates to get a better picture of what I am talking about.
 
Let me know if anything is unclear.
 
thanks
 
-Vamshi
 
 
 
 
 
 
 
 
 


Message Edited by Support on 05-15-2008 04:36 PM
0 Kudos
Message 1 of 2
(2,390 Views)

You've got several issues to clean up before you can figure out what the problem is.

1.  Race conditions, you read local variables of your SR values that go to the parse sub VI then to your save to file VI.  It is very likely they will get read before the data is put to them inside of your loops.

2.  Why do you write to an indicator and to the local variable of the indicator at the same time?  Get rid of those local variables.

3.  Your Stop button is read before your loops start, so if you hit the stop button you will have to wait for the loops to stop based on the other conditions, then wait for all the loops to begin again and run once before the outermost loop stops.

4.  You have while loops 3 layers deep (with a stacked sequence in between).  Nothing good is going to come of that and may very well be the reason for your delays.

0 Kudos
Message 2 of 2
(2,387 Views)