LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to save data every 5 ms


@dave97 wrote:

However my problem remains the same, i don't understand how to save my data every 5 ms. I am sure that it is not a problem of speeding up my code, because i succeeded in saving my stream of data with the original frequency that is much higher than 200 Hz. 


So, what changed? Get the working version from your source code control and spot the difference(s).

 

Note that we can't run your code as we don't have the HW...

 

Try to change the serial DAQ with a simulation (random number or time, etc.). Does that make a difference?

 

Try to dot save to file and put a timing probe or some debug code there instead. Do you get 5ms updates?

0 Kudos
Message 11 of 12
(142 Views)

@dave97 wrote:

However my problem remains the same, i don't understand how to save my data every 5 ms. I am sure that it is not a problem of speeding up my code, because i succeeded in saving my stream of data with the original frequency that is much higher than 200 Hz. 


You have a free-running loop without any timing where the speed is fully determined by the speed of the serial IO. Do you know the loop time? Is it relatively constant? (e.g. if it is determined by the device on the other end?).

 

This also means that 5ms is not necessarily a multiple of the native loop time. Also, the logging itself could interfere with the loop time, right?

 

If the native loop time (clocked by the serial data arrival) is constant and known, maybe a better choice would be to save every Nth iteration, where N is calculated to cause an approximate 5ms pacing. You could even log the exact timing in a second column and later interpolate for an exact 5ms deltaT in post processing.

 

Is this running on an RT system or a multipurpose OS? (There will be no guarantees on e.g. windows.)

0 Kudos
Message 12 of 12
(134 Views)