To download NI software, including the products shown below, visit ni.com/downloads.
This project will prevent the system from sleeping when run.
There are plenty of ways of preventing a PC from sleeping or hibernating. The problem with most of them is that they require your user to remember to turn them on when running LabVIEW. If you just set the PC to never sleep then it will never go to sleep but what you really want is for it only to stay awake when collecting data with your LabVIEW program. Or you could run a third-party program like Caffiene to prevent the PC from sleeping, but this has the same problem.
Windows has an elegant way to deal with this, they are called Power Availability Requests. have you noticed that your PC never goes to sleep when watching a video? These are Power Availability Requests in action. You can make you LabVIEW program behave the same way.
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Thank you for this example! Informations you reported on MSDN were very helpful as I'm very often facing the problem of systems not properly confguired for unattended, long-lasting tests.
I managed to develop a similar example for LabWindows/CVI: you can find it here.
Thanks, glad I could help.
Very useful. But I suggest you make your cleanup functions, "Power Clear Request" and "Clear Handle", operate even if there is an error input, following the usual LabVIEW error-handling convention.
I've updated the Git repository per your suggestion.Thanks!
Thanks for sharing this.
Have you tested it on Windows 10?
I'm assuming that the Git repository is this one: https://github.com/benmanthey/Power-Requests
Yes to both your questions.
It works fine on Win 10 and that is my Git repository.