ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I end my LV7 program externally?

Hi. I developed a DAQ application in LabView 7.1 which is intended to be running 24 hours a day. The PC is protected with an UPS which can safely shutdown WinXP in case of power failure.
Now, before ending windows I would like (I really NEED) to end my program safely by means of a windows command or something like that, issued by the UPS. I mean, I need to tell my UPS how to end my program.

Note: By now I'm running my VI from LabView, but soon I will complile it as a stand alone application (with the application builder).

Thanks.
0 Kudos
Message 1 of 7
(3,375 Views)
Hi,

Most UPS's have a serial connection that can be read by LabVIEW. By studying
this protocol, LabVIEW can close itself. It's the most decent option.

Another option is to make a vi "Stop All" that is set to auto-run. This VI
stops (and closes) all top level vi's, exept itself. You can start this vi
with a command line ("c:\program.....\LabVIEW.exe "stop all.vi"" or
something), even when LabVIEW is already running. The vi will stop all
running vi's. If you need a gracefull shutdown, you can have the started vi
set a global (or pref. a buffer) that is used by the main program. You can
even let the started vi generate a dynamic event, but that is a bit harder.

To my own supprise, this also works with the executable (I tried it with a
buffer). Just use main
.exe instead of labview.exe.

The last option is to communicate using windows. You can use memory mapped
files, windows messages, or even a normal file.

Regards,

Wiebe.


"Daniel_Chile" wrote in message
news:506500000008000000E4FC0000-1079395200000@exchange.ni.com...
> Hi. I developed a DAQ application in LabView 7.1 which is intended to
> be running 24 hours a day. The PC is protected with an UPS which can
> safely shutdown WinXP in case of power failure.
> Now, before ending windows I would like (I really NEED) to end my
> program safely by means of a windows command or something like that,
> issued by the UPS. I mean, I need to tell my UPS how to end my
> program.
>
> Note: By now I'm running my VI from LabView, but soon I will complile
> it as a stand alone application (with the application builder).
>
> Thanks.
Message 2 of 7
(3,374 Views)
Hi, Wiebe, thanks for your answer.
I also thougth about setting a global that's read by the main program, and it worked fine before building the executables. After that I couldn't make the "main" and the "stop" programs to share the global as I wanted.
I understand that you successfully used a "buffer" (may I understand "a queue"?) that worked fine even as executables. Could you post the example for me?

Thank you,

Daniel
0 Kudos
Message 3 of 7
(3,374 Views)
"Daniel_Chile" wrote in message
news:5065000000050000008DDA0100-1079395200000@exchange.ni.com...
> Hi, Wiebe, thanks for your answer.
> I also thougth about setting a global that's read by the main program,
> and it worked fine before building the executables. After that I
> couldn't make the "main" and the "stop" programs to share the global
> as I wanted.
> I understand that you successfully used a "buffer" (may I understand
> "a queue"?) that worked fine even as executables. Could you post the
> example for me?
>
> Thank you,
>
> Daniel

Sure, here is the main, the buffer and a vi to set a value in the buffer.
It's not much though. I also included the build script.

The main just displays a string from a buffer
. Set String.vi puts a string
in the buffer, the string stays in the buffer until something else is put
into it (you can run set string again).

I set the text in main.exe by executing 'main.exe "Set String.vi" '. I do
thing a global should work too, but only when a vi that sets the global is
run like this from the command line.

Regards,

Wiebe.



[Attachment String buffer.vi, see below]


[Attachment Set String.vi, see below]


[Attachment Main.vi, see below]


[Attachment main.bld, see below]


[See first reply for additional information]
Download All
0 Kudos
Message 4 of 7
(3,374 Views)
[Additional attachment(s)]
0 Kudos
Message 5 of 7
(3,374 Views)
Ok, Wiebe, I understand that by executing 'main.exe "Set String.vi"' I'm making the "external" vi to run once on the same execution engine of the executable, am I right?
I think that it should work. Thanks and see you!

Daniel
0 Kudos
Message 6 of 7
(3,374 Views)
"Daniel_Chile" wrote in message
news:506500000005000000FBDA0100-1079395200000@exchange.ni.com...
> Ok, Wiebe, I understand that by executing 'main.exe "Set String.vi"'
> I'm making the "external" vi to run once on the same execution engine
> of the executable, am I right?
> I think that it should work. Thanks and see you!
>
> Daniel

You are right!

Regards,

Wiebe.
0 Kudos
Message 7 of 7
(3,374 Views)