LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with timing in my data logger

Solved!
Go to solution

Hello.

 

Another one of my building blocks is causing me trouble. It works, sort of but not the way I want it.

 

As an example I have included a test VI.

 

I want to display two random numbers on my Front Panel and update them every 500ms. I can activate a boolean switch and start a logger. The logger interval has a different timing to the display. At present the display updates according to the logger interval when turned on. 

 

I know I have done something wrong but I need a pointer in the right direction.

 

Many thanks.

Mark.

0 Kudos
Message 1 of 6
(225 Views)

That's because you have a multi-second delay you've added to your execution data flow path when you start logging.

 

If you want the the display to update more frequently, don't put a delay in the logger.  Put the logging in a case that runs when Logging?=True and Elapsed Time>= the desired rate.

 

The Elapsed Time Express VI is one of the few good Express VI's and is appropriate for this.

 

(Why did you take a boolean value, convert to 1:0, then wire that to a case structure?  Just wire the boolean!)

0 Kudos
Message 2 of 6
(187 Views)

So I have tried to clean up my VI and implement Elapsed Time. I still have a mistake but cannot see it.

 

The display works with the update rate as required. When the Logger switch is turned on, firstly it should write the header information and data points should reset to zero (does). Then after the interval has been reached, the data should be written,the data points incremented by one and the elapsed time reset.

 

What happens is that the data is written every 500ms.

 

Best regards

Mark

0 Kudos
Message 3 of 6
(158 Views)

Hi vtiu,

 


@vtiu wrote:

So I have tried to clean up my VI…


Well, you could do better. (See attachment.)

 


@vtiu wrote:

When the Logger switch is turned on, firstly it should write the header information and data points should reset to zero (does).

Then after WHEN the interval has been reached, the data should be written,the data points incremented by one and the elapsed time reset.

What happens is that the data is written every 500ms.


Whenever you write "WHEN xyz THEN abc" you should use a case structure, with "xyz" connected to the case selector and "abc" in the TRUE case.

Right now you have not setup the cases and conditions as per your requirement…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 6
(152 Views)

This is indeed much neater but when I run it, it ask me for a filename to save?

 

Best regards

Mark

0 Kudos
Message 5 of 6
(144 Views)
Solution
Accepted by vtiu

Hi Mark,

 


@vtiu wrote:

This is indeed much neater but when I run it, it ask me for a filename to save?


This was just an example of how a VI may look like after "cleaning up"…

 

You still need to implement your requirements as written before.

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 6
(141 Views)