LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI only runs in "lightbulb mode"

I'm trying to run a VI that interfaces with a couple of external devices [one connected over a serial port (via a USB-to-Serial Port converter) and the other using GPIB (via a USB-to-GPIB converter].  I'm using the converters because my [newer] laptop (running Vista) only has USB connections.
 
The VI runs just fine when the "Highlight Execution" button is pressed on the Block Diagram (i.e. the lightbulb is on), but it doesn't run when this button is not pressed.  Seems it may be attempting to run too quickly without enough time for communication with the external devices.  Anybody had and solved this problem?
 
Thanks for the help.
Andrew
 
0 Kudos
Message 1 of 14
(4,775 Views)
Do you make use of local variables in your code?
0 Kudos
Message 2 of 14
(4,765 Views)
Yes, I did.
0 Kudos
Message 3 of 14
(4,762 Views)

Without seeing your code, I would guess that the reason it works in debug mode and not in real time is because you have race conditions being caused by your local variables.  Check this link out as well.  Read those through and see if you think you have a race condition. 

Good Luck

 
0 Kudos
Message 4 of 14
(4,760 Views)

So I don't think it's a race condition.  I did have a case where a Local Variable was referenced before the variable was read for the first time, so I corrected that.  But the program still doesn't talk to the external device when Highlight Execution is off.  I get no error messages, though.  Wander if it's a timing issue.  I don't know if adding a time delay at some (specific) point along the wire would help or not.  Other ideas?  Thanks again.

Andrew

0 Kudos
Message 5 of 14
(4,748 Views)
I think at this point it would be helpful if you could post your vi so that I, and others, can take a look at it and give you feedback.

Cheers
0 Kudos
Message 6 of 14
(4,746 Views)
Sure thing.  Fairly new to this.  The VI references SR400*.*, which are subVIs that control a photon counter.  No problem with that.  The problem is with the stepper motor, which I select from the VISA Resource I/O menu on the Front Panel.  On the block diagram you see a Case Structure labeled "Repositioning of the Stepper Motor Without Running Loop"; it's controlled by the box with the green border on the Front Panel.  It writes just a couple of simple commands to the motor.  If I can get that section to work, I'll be in good shape.
0 Kudos
Message 7 of 14
(4,741 Views)
The first thing I see is that you dont have the baud rate, data bits or parity wired up, they are just set to default.  Make sure that these settings are correct for communicating to your motor controller.  I would suggest using the shipping example "Basic Serial Write and Read.vi (Under Help>>Find Examples..., and search for this VI title).  Use this VI to establish communication with you motor.  Let me know if you have success.

Cheers
0 Kudos
Message 8 of 14
(4,739 Views)
The default settings for Configure Serial Port seem to be the right settings.  I went ahead and typed them in and still get no movement of the motor.  Although, of course, it does move when Highlight Execution is "on", which is odd.
0 Kudos
Message 9 of 14
(4,731 Views)
Try putting a wait in between your first VISA write and the case structure (the one that is controlled by the error wire).  It may be the case that the first write is sent, and before the motor can respond the second write that is within the case structure is sent.  Just use a flat sequence with the Wait(ms) function to force the VI to pause.  It is the only reason I can think of that the motor would turn in debug mode but not in real time.

Good Luck





Message Edited by jmcbee on 06-05-2008 04:38 PM
0 Kudos
Message 10 of 14
(4,727 Views)