LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My code (uses serial and GPIB) does not stops. Help..

Hello,
My code (uses serial and GPIB) does not stops. It is supposed to make photo diode image of sample. Photo diode is fixed while sample moves and hence I am generating 2 D images.

The main code is : Photo_Diode_N_Motors_Integrated.vi; all others are subvi.

I have made sure that all subvi's is there.

Because of this reason my stepper motor controller (ESP 300 by Newport.com) returns an error value that says:
"error: operation time out"
0 Kudos
Message 1 of 3
(2,379 Views)
Where exactly is it getting stuck? When you turn on highlight execution what is it dong?

From looking at the top level VI though I bet your problem is that you are using the equals function to stop the loops. Your I32 gets type cast as a dbl, and the chance that they are equal is very slim.

The reason is that doing an equal compare of doubles is never a good idea. The double may show up in your indicator as 1 but if you increase the digits of precision on that control you would see that is was actually something like 1.0000000000000001. So your math may lead to 1.000000000001 and the conversion of the I32 to dbl may lead to 1, therefore they are not equal and the loops will not finish.

Take a look at this KB Comparing Floating Points Does Not Seem to be Working Properly.
and this one: Why Do My Floating Point Numbers Lose Precision?
0 Kudos
Message 2 of 3
(2,349 Views)
Thanks Evan,
I guess that it will work. I replaced the while loop with a for loop and it worked. I did not test the whole big program as I am having some other issue with GPIB card, though I tested small program.
I appreciate ur suggestion.
Dushyant
0 Kudos
Message 3 of 3
(2,333 Views)