LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

program working in debugging but not working normally

hi,

 

   I am facing a very peculiar problem in my project. I have written the code,thing is it is not working properly to the mark when i give that particular command to run. but it is working in debugging mode, if there is any timing problem, what is that i have to do to make it work normally when i run the program without debugging. Can anyone help me in doing this

0 Kudos
Message 1 of 10
(2,625 Views)

Hi samineni,

 

when the problem is within your "code" then you should show us that code to give help...

 

Well, it sounds like a typical race condition. You will find lots of threads regarding that topic!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,622 Views)

hello,

       Here is my vi just have a look at it. Unable to understand how to sort the problem

0 Kudos
Message 3 of 10
(2,617 Views)

hi,

   forgot to post my vi

0 Kudos
Message 4 of 10
(2,616 Views)

Hi Samineni,

 

sorry, I'm missing all the subVIs, so can't help.

 

I would suggest:

- enforce dataflow by use of error clusters

- use subVIs for the ever-repeated same functions in nearly every frame of your sequence(s) of building a file path and saving a file

- race condition can occure due to the reference characteristics of the IMAQ image control...

 

Btw:

Why use AppendString when you can do the formatting entirely with FormatDateTimeString?

 

And please, stick with your original thread next time...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(2,604 Views)

I fully agree with Gerd and says that with error in-outs on your sub-vi's you dont need those ugly sequence frames. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(2,600 Views)

You really need to give more detail.  You say it is not working properly unless you are in highlight mode.  But you never say what is going wrong versus what you expect it to do.  Are there problems with the images?  Are you getting an error message?  Does the computer crash and catch on fire?

0 Kudos
Message 7 of 10
(2,582 Views)

There are a couple of things really wrong with your VI. Let's have a look at frame 1 of the outer sequence:

 

  1. Why are you building an array from mostly empty arrays? Why can't you use a single output tunnel and keep it a 1D array?
  2. In almost all cases of the case structure you have (1) a flat sequence and (2) a FOR loop containing another flat sequence. Since there is no data dependency between the two, the FOR loop and the first flat sequence will run in parallel and there is no way to tell which one starts first and which one completes first. If the outcome depends on what happens first, we have a textbook race condition. (Since both code segments talk to the same instrument, things will be all over the place and not predictable at all).

I recommend clean, flat code with defined dataflow and your problems will go away.

0 Kudos
Message 8 of 10
(2,570 Views)

hi,

   Problem i am facing is my autofocus code is working perfectly in debugging. For suppose if i disturb my live image and if i want to have focussed image,it is working perfectly well if i disturb the image in clockwise direction(without debugging) and it is not working if i disturb the image in anticlockwise direction,it is getting stopped after few steps,without completing all the steps. I,myself feeling strange with this problem but it is very important for me to solve this. I have given a delay 0f half second,should there be any rectifications,can you guide me in doing this.

0 Kudos
Message 9 of 10
(2,536 Views)

You already said that it works under debugging, but not under regular execution, no need to repeat that.

 

Did you at least try to fix the existing race condition? I clearly identified the most likely problem in my point (2) above. Simply make sure that the two independent code fragments don't talk to the instrument in parallel.

 

Where did you add a delay? It is really difficult to understand what you are actually doing unless you show us some new code. Thanks!

0 Kudos
Message 10 of 10
(2,521 Views)