Sometimes it is usefull to switch on/off the display controller from your application. For example, if you want extend the lifetime of the backlight or reduce power consumption.
NetDCU5.2 and NetDCU8 implement this functionality with power managment functions.
Switch on/off display controller
-
-
Hi,
for those who use VB.net:
Code- <DllImport> Private Function ExtEscape( _
- ByVal hdc As IntPtr, _
- ByVal nEscape As Int32, _
- ByVal cbInput As Int32, _
- ByVal plszInData As Byte(), _
- ByVal cbOutput As Int32, _
- ByVal lpszOutData As IntPtr) As Int32
- End Function
- <DllImport> Private Function GetDC( _
- ByVal hwnd As IntPtr) As IntPtr
- End Function
- Private Const SETPOWERMANAGEMENT As Int32 = 6147
- Private Enum VideoPowerState As Byte
- VideoPowerOn = 1
- VideoPowerStandBy
- VideoPowerSuspend
- VideoPowerOff
- End Enum
- 'Schaltet die Hintergrundbeleuchtung Ein(True) oder Aus(False).
- 'Switch the Backlight On(True) or Off(False).
- Public Sub BarneyBacklight(ByVal switch As Boolean)
- Dim hdc As IntPtr = GetDC(IntPtr.Zero)
- Dim vpm() As Byte = {12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}
- If switch Then
- vpm(8) = VideoPowerState.VideoPowerOn
- Else
- vpm(8) = VideoPowerState.VideoPowerOff
- End If
- ExtEscape(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero)
- End Sub
best regards Benjamin
-
Mit der Firmware 1.40 schaltet das Display nicht mehr das Backlight aus, sondern das ganze Display wird weiß erleuchtet!
Hat jemand eine Idee wie sich das wieder beheben lässt?
Gruß Christian
-
Hallo,
ich nehme an Sie sprechen von derNetDCU8!
Ab Version 1.40 können dort die Hintergrundbeleuchtung und das LCD getrennt abgeschaltet werden und zwar über die Registry unter "HKLM\System\CurrentControlSet\Control\Power\Timeouts" mit den Werten "ACScrennOff" und "ACBacklightOff" (0=off, sonst Timeouts in Sekunden). Diese Feature darf aber das bisherige Verhalten nicht beeinflussen! Habe das mit den Kommandos von "ndcucfg" gestested. Deshalb vermute ich das bei Ihnen der "Schalter" für die Hintergrundbeluchtung zerstört ist. Reagiert bei Ihnen Die Hintergrundbeleuchtung auf das Kommando "backlight off"? -
Ja es geht um die NetDCU8.
Hier der verwendete Code (Übersetzung des VB-Beispiels in C#):
Code- [DllImport("coredll.dll", SetLastError = true)]
- private static extern Int32 ExtEscape(IntPtr hdc, Int32 nEscape, Int32 cbInput, byte[] plszInData, Int32 cbOutput, IntPtr lpszOutData);
- [DllImport("coredll.dll", SetLastError = true)]
- private static extern IntPtr GetDC(IntPtr hwnd);
- private const Int32 SETPOWERMANAGEMENT = 6147;
- private enum VideoPowerState : byte
- {
- VideoPowerOn = 1,
- VideoPowerStandBy,
- VideoPowerSuspend,
- VideoPowerOff
- }
- public void backlight(bool backlight_on) //Schaltet die Hintergrundbeleuchtung Ein(True) oder Aus(False).
- {
- IntPtr hdc = GetDC(IntPtr.Zero);
- byte[] vpm = { 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
- if (backlight_on)
- {
- vpm[8] = (byte)VideoPowerState.VideoPowerOn;
- }
- else
- {
- vpm[8] = (byte)VideoPowerState.VideoPowerOff;
- }
- ExtEscape(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero);
- }
"backlight on" bzw. "backlight off" über netcfg funktionieren weiterhin!
Das Programm nd52_video_power.zip (siehe oben) schaltet auch nur auf einen weißen Bildschirm. Backlight bleibt an!
Gruß Christian
-
Hallo,
was passiert wenn Sie zuerst in den "PowerStandBy" Modus wecheln und dann erst "PowerOff" aufrufen?
Wenn "PowerOff" beides übernimmt, hat man den Nachteil, das man die Spannungen (Vlcd, Vcfl) nicht beliebig getrennt schalten kann. -
Danke, damit funktioniert es !
Hier der berichtigte Code:
Code- [DllImport("coredll.dll", SetLastError = true)]
- private static extern Int32 ExtEscape(IntPtr hdc, Int32 nEscape, Int32 cbInput, byte[] plszInData, Int32 cbOutput, IntPtr lpszOutData);
- [DllImport("coredll.dll", SetLastError = true)]
- private static extern IntPtr GetDC(IntPtr hwnd);
- private const Int32 SETPOWERMANAGEMENT = 6147;
- private enum VideoPowerState : byte
- {
- VideoPowerOn = 1,
- VideoPowerStandBy,
- VideoPowerSuspend,
- VideoPowerOff
- }
- public void backlight(bool backlight_on) //Schaltet die Hintergrundbeleuchtung Ein(True) oder Aus(False).
- {
- IntPtr hdc = GetDC(IntPtr.Zero);
- byte[] vpm = { 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
- if (backlight_on)
- {
- vpm[8] = (byte)VideoPowerState.VideoPowerOn;
- }
- else
- {
- vpm[8] = (byte)VideoPowerState.VideoPowerStandBy;
- ExtEscape(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero);
- vpm[8] = (byte)VideoPowerState.VideoPowerOff;
- }
- ExtEscape(hdc, SETPOWERMANAGEMENT, 12, vpm, 0, IntPtr.Zero);
- }
-
Hello,
We encouter a problem with the last posted c# code with picocom2.
We success to switch display controller OFF,
but never succeed to switch it ON again.We tried to call VideoPowerStandBy + VideoPowerOff (then backlight is off),
but VideoPowerOn doesn't work.We tried to call only VideoPowerStandBy (it seems to do the same as above)
but VideoPowerOn doesn't work.We tried also to use BACKLIGHTCOMMAND instead of SETPOWERMANAGEMENT,
but it doesn't work with BACKLIGHT_CMD_ON or BACKLIGHT_CMD_OFF.With DCUTerm, the command display power on and off doesn't work.
Another command we tried is CONTRASTCOMMAND.
It works fine.
We thought we could use it to have an ersatz of VideoPowerOff,
by setting the contrast to the min. But the new problem is:
- it could be ok with the picocom2 testboard with Hitachi TX09 LCD screen
as the screen get black
- with our own screen URT 8277, the minimum contrast is not low enough
to get a black screen.Waiting for any suggestion.
-
Hello,
you may use OS function "SetSystemPowerState" for your purpose. Please refer MSDN. -
Thank you for the answer.
With Picocom2 startkit, we tried :
SetSystemPowerState(null, POWER_STATE_ON, POWER_FORCE);
and
SetSystemPowerState(null, POWER_STATE_OFF, POWER_FORCE);
instead of calling SETPOWERMANAGEMENT
but we did'nt get any reaction.
What could be wrong ? -
Hi,
Without success with the former method,
we try another one which is acceptable for us:we would like to realize these DCUTerm commands
(where mode100 is for our URT8227 screen):reg open \drivers\display\LCD\mode100
reg set value contrastenable dword 0 (or 1)
reg save
rebootThis works fine, but we would like to be able to do the same,
in c#, without reboot. Is it possible ?Regards,
-
Hello,
-> SetSystemPowerState
i suggest parameter 1 must be "screen off" (http://msdn.microsoft.com/en-us/library/aa929708.aspx)!-> It is also possible to call ndcucfg via command line (ndcucfg -c "backlight on" OR ndcucfg -c "backlight off") from your app, c++ sample:
...
BOOL bRes = CreateProcess(_T("ndcucfg"), _T("-c \"backlight off\""), NULL , NULL, 0, 0, NULL, NULL, NULL, NULL);
... -
Hi,
We also tried
SetSystemPowerState(null, POWER_STATE_IDLE, POWER_FORCE);//Screen Off, Touch Disable
and
SetSystemPowerState("ScreenOff", 0, POWER_FORCE);
which seems to do the same: the screen gets off and immediately on
(we are not touching screen or moving mouse during this time).
How can we maintain off ?As we did not succeed to use SetSystemPowerState, we tried the last kernel.
We were using Picocom2 V1.09 kernel.
We loaded Picocom2 V1.13 kernel and we got what we needed:in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\Timeouts
we set ACScreenOff to the wanted value and it works !As we missed this debug in kernel history.txt,
could you explain us what stands for this debug in history.txt
(is it - 0000245: [Display Driver] Display controller power enabled too late. in V11 ?)Best regards,