LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop executes before "period"

hi
I am using Timed loop in labview 8.0 , winxp
inside timed loop my application is to read a gpib port and write into file .Read , write , write to meas file is OK but each read write is not exactly 400 ms .but +- 40 , 60 . So i need to execute the timed loop in fixed time period =500ms.
but the time col is not consistant. because of inconsistant timed while loop.
I set the period of the loop "500"ms and periority 5000 or 500.
i dont know why this is happening in dedicated timed loop.
0 Kudos
Message 1 of 7
(3,075 Views)
A timed loop does not guarantee that the loo will execute in the period you specify. If your code takes 600 msec to execute, there is no way the timed loop can execute in less time than that. I suspect that one problem with your code is the file write. If you are opening and closing a reference to the file with each iteration, you are not doing the file write very effeciently. Using an Express VI such as Write to Measurement file is slow because of this overhead. Try using lower level file write functions or moving the file write out of the timed loop and passing data via a queue.
Message 2 of 7
(3,061 Views)
yes off course i am now using low level file i/o but the behaviour is same , my code takes nearly 400 ms +-30ms but <500ms .
and loop settins are dt=500ms which is enough for code to comlete in time.
so i need to write after exactly 500ms passes then what should we do. or on the other hand i need a deterministic time col write.
 
0 Kudos
Message 3 of 7
(3,044 Views)
objective is to write a file at fixed sample time ,
first frame varies the  400ms   +-30ms
but i am writing file at 500ms period , 
so my file should save at fixed 500ms difference
 
0 Kudos
Message 4 of 7
(3,031 Views)
objective is to write a file at fixed sample time ,
first frame varies the  400ms   +-30ms
but i am writing file at 500ms period , 
so my file should save at fixed 500ms difference
 
0 Kudos
Message 5 of 7
(3,031 Views)
Hi Haider,
 
Are you running your LabVIEW code on a controller with the Real-Time OS or on Windows? If you are running on Windows XP, you will not achieve complete determinism, since the Windows scheduler will not be fully controlled by LabVIEW, but also by other programs running on your PC. More information about this is detailed here. Just for the reference of other visitors to the forum, here is a document about configuring Timed Loops.
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments
Message 6 of 7
(3,010 Views)

So the luxury option and use of 1kHz clock is useless in labview , that is not consistant even for <=2Hz.

 

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