kruemi Posted March 19, 2011 Report Share Posted March 19, 2011 Hello I've had some issues with a laptop that is used for data acquisition. Sometimes the people unplug the power and don't plug it in again. To not loose too much data, I had to find a was for LabView to know the power source and the fill level of the battery. This vi is done with LabView 7.1 and uses a call to the windows library kernel32.dll to get the data. It should work on any windows system since Windows 2000. Maybe it is useful to other LV users as well. The second vi just calls the first one in 500ms intervals and shows the results. If you have ideas for improvement, let me know. kruemi PowerStatus.vi ShowPowerStatus.vi 2 Quote Link to comment
Phillip Brooks Posted March 21, 2011 Report Share Posted March 21, 2011 I posted this on the NI forums several years ago. I used .NET to monitor the power status instead of polling a DLL. I registered for a callback event and then used a LabVIEW notifier to pass the status to other LV code... http://decibel.ni.co...t/docs/DOC-1154 Quote Link to comment
kruemi Posted April 18, 2011 Author Report Share Posted April 18, 2011 I posted this on the NI forums several years ago. I used .NET to monitor the power status instead of polling a DLL. I registered for a callback event and then used a LabVIEW notifier to pass the status to other LV code... http://decibel.ni.co...t/docs/DOC-1154 Meh, and I've not been able to find it. Yours looks way nicer than mine :-) It would be nice if there was a way to make that stuff platform independet, but I don't think this will be possible soon .-( DLL-Calls often are a bit of a hassle to implement. Especially when you don't have access to header files. The upside is, that I'm using a dll that is sitting in every windows version since Windows 2000. So th solution is quite portable inside the windows line. kruemi Quote Link to comment
Rolf Kalbermatter Posted April 20, 2011 Report Share Posted April 20, 2011 (edited) On 4/18/2011 at 8:50 AM, kruemi said: Meh, and I've not been able to find it. Yours looks way nicer than mine :-) It would be nice if there was a way to make that stuff platform independet, but I don't think this will be possible soon .-( It's possible but not without writing a DLL/shared library for every platform you want to support. For Windows straighforward, for MacOS X quite a bit of digging in the Carbon framework and for Linux a bit of a pain to do, since it can vary depending on kernel version, distribution and packaging. Quote DLL-Calls often are a bit of a hassle to implement. Especially when you don't have access to header files. The upside is, that I'm using a dll that is sitting in every windows version since Windows 2000. So th solution is quite portable inside the windows line. And not to forget, that it doesn't invoke a .NET monster framework to get at some low level system information that is accessed through several other layers by the .Net library. Edited October 11, 2018 by rolfk 1 Quote Link to comment
catur Posted April 3, 2016 Report Share Posted April 3, 2016 Hi Kruemi... Your PowerStatus.vi is very useful for me... but i need to know how you know that we can get the battery information like BatteryFullLifeTime,BatteryLifeTime, BatteryLifePercent, ACLineStatus etc and what there is another else? And also how you know use that data type, example unsigned byte for ACLineStatus and long integer for BatteryFullLifeTime hope you can help me, may be you can make a video for me thank a lot Quote Link to comment
hooovahh Posted April 4, 2016 Report Share Posted April 4, 2016 It's a system level DLL call that's documented here. https://msdn.microsoft.com/en-us/library/windows/desktop/aa372693(v=vs.85).aspx The SystemPowerStatus type is defined here. https://msdn.microsoft.com/en-us/library/windows/desktop/aa373232(v=vs.85).aspx Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.