Knowledge Base
Valid For#HMI
Applies ToHMI430

This instruction configures the LCD backlight, both its brightness and time between switching between high, medium and off levels.

Function Prototype
SetBacklight(
h:HighLevel,
m:MediumLevel,
md:DelayFromLastPressToMediumLevel,
od:DelayFromMediumLevelToLowLevel,
p: IgnoreButtonPressWhenDim )
ParameterOptionDescription
hoptionalHigh backlight level as a normalised float, ie, 0.0 (off) thru 1.0 (max).  Default is 1.0.
moptionalMedium backlight level as a normalised float, ie, 0.0 (off) thru 1.0 (max).  Default is 0.3.
mdoptionalMedium Delay in seconds from the last touch until the medium level becomes active.  A value of 0 means the medium level won’t be used at all.  Buttons may be pressed while the display is at the medium level.  Default time is 120s.
odoptionalOff Delay in seconds from the time the medium level began.  Buttons are ignored while the display is off.  The first touch will simply “wake” the screen, restoring it to the high level.  Default time is 10 minutes.   
p   optional   Ignore Press set to 1 to ignore any button press whilst the backlight is at the medium level.  Hence the first press will restore the backlight to the high level and the second press will then act on the button.  Default is 0, meaning the press is acted on.

Backlights have a limited life span, keep them on maximum and they’ll only run for a few thousand hours.  So this instruction allows you to greatly increase the life of your backlight by turning it on only while someone is touching the screen. The backlight will be at the high level when the screen is touched.  A set time after the last touch, it will then drop to the medium level.  If it’s touched while at the medium level, buttons will respond and the backlight will return to the high level.  However if it’s at the medium level and still not touched, it will then turn off.  When off, the LCD will also turn off to help prevent pixel burn-in (which can actually happen to LCDs).

It’s typical to set your backlight preferences at the start of your application.  However, this instruction may be called at any time to alter the backlight settings.

Examples
#HMI SetBacklight( h:1.0, m:0.3, md:30, od:60, p:0 )

Sets the backlight to maximum brightness, dimming to 30% after 30 seconds, then turning off after a further minute.  Any press whilst the backlight is dim will be acted on.

#HMI SetBacklight()

This will “kick” the backlight, forcing it to its high level and restarting the delay timers.  No parameters will be changed.

#HMI SetBacklight( h:0.8, md:0, od:0 )

Sets the backlight to 80% and leaves it there forever.  This isn’t a great idea as your backlight will die an early death.