LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Restarting Program and Computer with LabView

I have a LabView program that is running on a Windows computer that is not checked on often. The program needs to be restarted if a particular error occurs. If the error occurs repeatedly, the computer needs to be restarted. Since this computer is not checked often, I would like for the program to automatically restart if this error occurs, and if it occurs repeatedly, I would like to restart the computer. Once I close the program when this error occurs, how do I restart it? Can I use a second program to monitor the first? Also, can I restart the computer with LabView? Thanks for any suggestions.
0 Kudos
Message 1 of 7
(5,982 Views)
It is strange that on certain error the Program needs to restart. Generally, you would handle the error in such a way that the Program reinits variables, close refernces etc so that the user sees a seamless operation. The need to reboot the Computer is also strange.

To do the two tasks you are asking, You need to tell us about the operating system. There are differences between different OSes.

To restart Program - What you will have to do is make a batch Program with sufficient Wait and then it Calls your Exe file. Before Exiting Labview Use the Sytem Exec Vi to Start this Batch File. Then exit Labview. The Batch file waits and then Execute the Program. Make sure the System Exec Vi terminal "Wait Until Complete" is wired False.

To reboot Computer - Windows XP supports Command called ShutDown. Call this from command Line using System Exec Vi before exiting Labview.

Here is the link to Microsoft Documentation

http://tinyurl.com/6t4fn

Basically, you will have to make two Batch files and call one of them based on your condition.

I would investigate why such a drastic step is needed though

I hope you are familiar with Batch files
Good Luck!

Mache
0 Kudos
Message 2 of 7
(5,969 Views)
I am using XP. I am controlling an instrument with LabView and occasionally when the program is started, there is a communication problem between the computer and instrument. I have tried re-initializing the instrument among other thing when this happens to keep from restarting the program, but the error does not go away until the program is restarted. I am not familiar with batch files, so any suggestions you can provide would be helpful. Thanks.
0 Kudos
Message 3 of 7
(5,940 Views)
I hope you are using LV 7.1

Attached are 3 files 2 batch files and one vi. The vi calls the batch file based on option you select. It will Load Labview. In your case you may want to replace labview with your exe. Also change the path accordingly. Make sure the .bat files are stored in C:\

I am using the ping command to add delay. ping - n xx.... (xx is the delay you want)
Shutdown command also has a time out which is specified by the switcf -t xx (xx is the delay you want)

I hope you have network card on this machine. If not you will have to get the Sleep Utility and use instead of ping

Search for "Wait in Batch File" on google or get it from microsoft.
Good Luck!

Mache
0 Kudos
Message 4 of 7
(5,918 Views)
Here are the files!! Missed them...
Good Luck!

Mache
0 Kudos
Message 5 of 7
(5,916 Views)

hi

 

 

im using windows embedded can you plz send the files that you have mentioned above.these files that you have uploaded are for windows but it is not working for windows embeddd

 

plz help me out,iam really stuck up

 

 

urgent

 

ekanth

 

0 Kudos
Message 6 of 7
(5,465 Views)

execute the program "shutdown -r"

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 7
(5,434 Views)