LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop runs too many times after update to Windows 10


@EdHarris wrote:

Data example

73.474350,0,1,14:52:56.670 04/02/2023, 2.4
73.475082,0,1,14:53:08.024 04/02/2023, 2.4
73.474564,0,1,14:53:19.374 04/02/2023, 2.1


Can you show us the data example for the system where you think it works correctly (after running it for a while)..

0 Kudos
Message 11 of 27
(772 Views)
@altenbach wrote:

Yes, it collects all the data with the various sequence steps, and they take a total of ~11 seconds. each iteration of the outer while loop creates one log entry. Why not put an indicator at the iteration terminal of the outer while loop to see how often it starts over.

 

Yes, I put an indicator and it iterated three times when the write to file was three lines. There are no errors in communication and the motor is stopped before the VI proceeds.


 

0 Kudos
Message 12 of 27
(763 Views)

For one entry, I would use “first call?”

Message 13 of 27
(751 Views)

Well, that's how it is programmed and I don't understand how it could have worked any differently before. Are you absolutely sure you did not change anything?

 

What good is a program that outputs once and then runs "forever" without producing any output? If you want to run it only once, just eliminate the outer while loop. 😄

 

It is really not clear what you want because this entire thread makes no sense!

0 Kudos
Message 14 of 27
(720 Views)

@altenbach wrote:

Well, that's how it is programmed and I don't understand how it could have worked any differently before. Are you absolutely sure you did not change anything?

 

What good is a program that outputs once and then runs "forever" without producing any output? If you want to run it only once, just eliminate the outer while loop. 😄

 

It is really not clear what you want because this entire thread makes no sense!


 

The program moves a sensor for an astronomy project into new position, collects data from the sensor, records position etc and writes it to file. This process repeats endlessly as the planet is rotating producing  new lines of data all the time.

But thanks, you have partly provided the solution because I reduced the central milisecond wait for testing and changing that back eliminated the problem. Sometimes, in the past, I have reduced that wait to nothing and it hasn't been a problem. 

0 Kudos
Message 15 of 27
(692 Views)

@GRCK5000 wrote:

For one entry, I would use “first call?”


How do you use that? I have had great difficulty finding a understandable example or explanation.

0 Kudos
Message 16 of 27
(689 Views)

@EdHarris wrote:

@GRCK5000 wrote:

For one entry, I would use “first call?”


How do you use that? I have had great difficulty finding a understandable example or explanation.


This is NOT a solution to your problem! To use "first call?", you could e.g. wire it to a case structure that is then guaranteed to only turn true exactly once when it is first encountered, but then never again during that run.

0 Kudos
Message 17 of 27
(683 Views)

@altenbach wrote:


This is NOT a solution to your problem! To use "first call?", you could e.g. wire it to a case structure that is then guaranteed to only turn true exactly once when it is first encountered, but then never again during that run.


 

Ok, and my problem is that the whole VI runs three times. You mentioned the number of processors in my hardware previously. This doesnt match the number of processors in my PC which is 4.

0 Kudos
Message 18 of 27
(637 Views)

Clearly, the code as written runs forever and adds one entry to the file with every iteration of the outer loop, so if it only added on entry previously, it did not behave as programmed originally. Maybe it got permanently stuck somewhere. If everything runs without error and hiccups, you should get one log entry every ~18+ seconds forever!

 

If it did not do that before, maybe the old setup was faulty.

Do you still have the old hardware so you can do some tests?

 

Do all visa sessions really have the same parameters? It is extremely confusing to constantly create new sessions and break them down. Are all communications really with the same device, just changing the starting address and quantity? This just screams for a simple state machine with code that fits on a postcard.

 

Can you explain in detail how all hardware is connected? Did you change any other hardware such as serial interfaces? Can you explain what should happen in sequence during the run? Does the hardware react as expected? Is the extra logging the only thing you don't like?

0 Kudos
Message 19 of 27
(608 Views)

Mr. Altenbach explained how to use it.

Below is an example. The true side of the case structure will only execute once even though it's in the while loop. The thing attached to the case structure is what you call "first call?"

GRCK5000_0-1675783979628.png

 

 

Message 20 of 27
(605 Views)