LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why i cannot stop my while-loop vi in the sequence serial dataong?

Pls see the attached folder!I am programming a sequence serial datalog. That means i will carry on data log one set by one set. So i need to input the serial number of every set. My main vi named "serial read data.vi", when i run this vi, i find that i cannot stop it by the "Sequence Run/Stop"control in my front panel. Pls help me ! And if you have good suggestion to my vi and this system, your warm suggestion is welcomed ! Thanks!
0 Kudos
Message 1 of 12
(3,685 Views)
Hi

As it stands your code is stuck in the event loop waiting for something to happen.
You can either set the event timeout in the top left corner of the event structure. This value is in milliseconds and means that it will leave the event structure repeatedly after this timeout period to action other code in your while loop, like the "Sequence Run/Stop".
Or, you can add an event handler for your Sequence Run/Stop in your event structure and pass the "NewVal" result out and use it to stop your while loop.

Hope that helps
Neil

See attached example.

Message Edited by NeilR on 04-20-2005 06:14 AM

0 Kudos
Message 2 of 12
(3,683 Views)
And this example ...
0 Kudos
Message 3 of 12
(3,680 Views)
Dear Neilr:
I have modified my main vi ,see the attached updated project folder,but another problem occurs : that is i cannot control the front panel control of "Data Log" in the TAB Control such as "Manual Stop logging". How to solve it ? Thanks!
0 Kudos
Message 4 of 12
(3,667 Views)
Check that the 'Lock Front Panel until the event case for this event completes' is not selected. (right click on the event structure and 'select edit items for this event'. This feature locks the front panel form user interaction until the event completes.
0 Kudos
Message 5 of 12
(3,667 Views)
Dear DavidT:
I have modified my main vi arrcording to your advise.see the attached Updated folder ! Now i can control the "Manual Stop logging" in the front panel. But now another problem occurs. Thant is: after i click the "Manual stop logging", the vi display an error says" Error 7 occurred at New File" .That means i cannot save the log data to txt file.What is the problem? Befor i modify the Case Structure, the vi can save the read back data. How to solve it !Thanks a lot !
0 Kudos
Message 6 of 12
(3,658 Views)
Hi Shenzhengpib,

Looking at your latest version of code, the error is occurring in the Write Characters to File.vi. You have a "true" wired to the "append to file?" input of the VI. This forces there to be an already existing file by the name "D:\data logger system\xxxxxx.txt". If there is not a file by this name already, you will get the error you are mentioning:

==================================
Error 7 occurred at New File.
Possible reasons:
LabVIEW: File not found.
==================================

If you change the "true" to "false", it will automatically create a new file by the name of "D:\data logger system\xxxxxx.txt" if it doesn't already exist.

Hope this helps,
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 7 of 12
(3,640 Views)
Dear Travis.h:
Do you really have tried this ? After i change the "true" to "false", the problem is still the same. The same error displays. why ?
0 Kudos
Message 8 of 12
(3,629 Views)
Are you sure that the file basepath is correct and exists?

Message Edited by DavidT on 04-22-2005 12:39 PM

0 Kudos
Message 9 of 12
(3,630 Views)
Dear DavidT:
Thank u so much for your notice! Yes , so foolish of me ! I forgot that i have changed my folder name from"d:\data logger system " to "d:\data logger system3", but i forget to modify it in the diagram of vi. Thanks !It is OK NOW.

Dear ALL:
Thank u so much for all of you to give me so many useful suggestion ! By the way, do you think where can be modified to be better for this Serial Data log concept ?Hope for your suggestion!
0 Kudos
Message 10 of 12
(3,624 Views)