LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean not responding

Im trying to use a switch ( I named "BOOLEAN SWITCH") to switch in between placing datapoints into arrays, and using those arrays to run a stepper motor. Right now, Im using a case structure to send a "10" signal (motor stop) when the switch is set to false (measuring) and it sets the signal to the approriate direction based on the first values of the array when the switch is changed to true (running).

Unfortunately the switch is always outputting flase all the time. I have a property node to default it to false at the beginning of the program, and when I remove that, the switch will just be locked into whichever the last value was when it starts running. Any suggestions on what might be causing this?

Im sorry about the code, its probably a bit bloated and ugly, but im learning.

Labview 7.1 on XP
0 Kudos
Message 1 of 8
(2,889 Views)
The problem is with your Event structures. First of all, you should only have one event structure and handle all of the events in that same structure. You won't miss events because the event structure queues them up. This, though, isn't the cause of your problem. Your problem is that the loop does not iterate until your event structures have completed. You either need to put the event structure in a separate loop or add a timeout event to the event structure.

Also, there are no guarantees that your boolean will be set to true at the beginning of your code. Just because the property node is to the left of the main loop does not mean that it will execute first. LabVIEW executes code as soon as all of its inputs are available. In order to assure proper operation you should wire the error out from the property node to your main loop, forcing the main loop to wait for this node to execute.

I also recommend that you try to compact your code so that you do not have to scroll to see the entire diagram. This makes it much easier to follow the flow of the program. One way to do this is to put some of the code into subvis.
0 Kudos
Message 2 of 8
(2,880 Views)
You've got a decoration on top of the switch so you're unable to set it. Select the decoration and then move that to the back by selecting the Reorder button (top right of tool bar) and choosing Move to Back.
0 Kudos
Message 3 of 8
(2,879 Views)
Ok, Ive merged the events together and tried adding a timeout but the boolean is still just giving the same value.

Would it make more sense to put this in a sequence and running the measurement part in the first frame and using a boolean to jump to the next frame and run the rest?
0 Kudos
Message 4 of 8
(2,870 Views)
I forgot to mention the point that Dennis brought up that your decoration needs to be moved to the back. This should solve the remainder of your problem.
0 Kudos
Message 5 of 8
(2,865 Views)
I had actually put that in just before uploading it just to highlight that switch, it was never part of the problem in the program.

The updated copy that I had put up azo_project2.vi had this fixed. It is messed up because I had the time wired instead of the timeout.

Now that the timeout is wired it seems to be working great.

Thanks!

Message Edited by jworisek on 04-14-2005 03:07 PM

0 Kudos
Message 6 of 8
(2,862 Views)
I'm glad to be of help.

I still suggest that you clean up your code a bit. You have wires running the wrong way (LabVIEW style guidelines are left to right data flow) and the block diagram covers a large amount of area. I think that you could consolidate considerable portions of your code to subvis to save room on the screen.
0 Kudos
Message 7 of 8
(2,853 Views)
Yes, thanks for the suggestion. I was working to bring a whole bunch of parts together before going through and cleaning it up. I can shrink it up quite a bit though now using a couple sub VI's.

Again, thanks a lot!
0 Kudos
Message 8 of 8
(2,845 Views)