LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop button not functioning. Event structure - state machine architecture

Hi,

 

 

I am not able to stop the execution of this program by using the stop boolean control. I am using Event structure to act according to user input.

 

I am not able to figure out what could have gone wrong.

 

 

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 1 of 9
(2,168 Views)

just 'or' compund the stop control and error to the stop terminalMotor-UNI_Directional(SubVI)_BD.png

0 Kudos
Message 2 of 9
(2,158 Views)

My Stop control is in the cluster. So since everything is in a while loop, should'n the program stop once there is a Value change in the Event Structure ?

 

CLUSTER

EVENT STRUCTURE

EXIT CONDITION -> TRUE TO STOP

 

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 3 of 9
(2,150 Views)

Well, the problem is data flow..., but that still will not give you control because you passed the event case..Use 'highlight execution' to see the data flow of sequences Smiley Wink

 

usually put the event structure in a 'wait/idle' case, but since you have a timeout case pointing to another case..It will always go there

 

I suggest writing down the sequence of events (data flow) and transitions to get there, whether by user interface or timed/finished events. 

 

And also suggest replacing the incremental shift register with an ENUM command pointing to your next case, this is not intuitive to someone else. type def the enum incase you add more cases to the state machine in the future...

0 Kudos
Message 4 of 9
(2,144 Views)

Could you please explain what exactly does it mean by a problem in the data flow ?

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 5 of 9
(2,141 Views)

What will happen if I want an state machine inside another state machine ??? 

 

Just like the attached VI

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 6 of 9
(2,090 Views)

Your sequence executes 0, 1, 2, 3, 3, 3, 3, 3, 3,... forever 3.

 

Your event structure is in 1, which never executes after the initial time, so you never handle the stop-button event.

0 Kudos
Message 7 of 9
(2,058 Views)

Hi,

 

I have found two errors regarding the stop button. 

1) Avoid splitting the items in a button cluster into different events. Try keeping the event button inside the event case.

 

2) The time out on your code was 0. remember -1 means no time out and rest means in millisecond. you put 0 that means everytime your code is executing timeout event and repeating the same state again and again.

 

The modified solution code is attached with this reply. And it works perfectly.

 

I have developed many applications using advanced programming techniques and recently sat a CLD exam.

 

Kind Regards

Ram Gurung,

Certified LabVIEW Associate Developer.

LabVIEW_Cert_Asso_Developer.jpg

157+ CLDs & 9 CLA Trained
LabVIEW Training resources
0 Kudos
Message 8 of 9
(2,040 Views)

Thank you. yeah I got that figured out. But now I am facing with the problem of looping it endlessly.

 

Please take a look here: http://forums.ni.com/t5/LabVIEW/Nested-State-machine-Loops-continuously/td-p/2454710

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 9 of 9
(2,037 Views)