Are you really sure you need to. I'd have thought that the LiquidChrystal Library would work straight out of the box. Doesn't lcd.noDisplay() do the job? If you're just trying to turn off the backlight, you just have to find out which pin it's connected to and DigitalWrite(pin,low);
Quite obviously you have never looked at the programming of this chip so why do you bother to comment. What I want is an honest appraisal followed by a workable code,
"LCD.noDisplay;" MERELY SHUTS DOWN THE CHARACTER PRODUCTION ON THE SCREEN and all the other rubbish you accumulated has nothing to do with shutting down the display. You annoy me intensely.
Please don't try to make and Ar__le of me, even when doing the same to your self. I am looking for an answer not a guess or even some one trying it on with me by guessing.
No need to thrash out at people.
What I'm seeing is frustration over asking for help based on trying to implement an assumed
very specific solution to a given problem along with a lack of understanding of
how certain components work.
The thread started out asking for help with the solution without stating
And then there are some terminology issues like:
The "LCD display" is not the same as the "LCD backlight".
I believe that the combination of all these factors is the reason you are seeing some
questions about what you are wanting to do.
Assuming that I understand what you are trying solve (which I admit at this point is still a bit vague to me),
I believe that in the bigger picture, that the specific solution that you are trying to implement is not going
to fully solve your real issue of power management as I think there is some misunderstanding
as to where the power issues are and how to control/manage them.
(back to that a bit later)
If you look even closer at the HD44780 specification and programming of the chip,
you will notice that there is nothing related to the backlight.
That is because the backlight is not part of the hd44780 spec so there will
be no hd44780 command that can be used to control the backlight.
The hd44780 electrical interface is only 14 pins.
The 2 LED pins (pins 15 and 16) are separate power pins that directly control the backlight.
The hd44780 Display control on/off command bit D will not control the backlight.
Controlling the D,C,B bits of the Display control on/off command:
Have you looked at the LiquidCrystal library code to see if there are API functions
to control the hd44780 D, C, B bits of the display on/off command?
There are existing API functions in the LiquidCrystal library to control those bits so there
is no need to have to write any of your own code to control them as you
can simply use the existing API functions:
display()/noDisplay() controls the D bit
cursor()/noCursor() controls the C bit
blink()/noBlink() controls the B bit
(All other bits are remembered and resent during each API function call for each individual bit)
Normally, as is the case in your example code, the C and B bits
are not used so if you want to disable the display circuitry
(which is not the same as the backlight)
you can use display()/noDisplay() to manipulate the D bit.
If I look at the wiring that you indicated, in response #20:
You have said that the pins 15 and 16 are hard wired as follows:
15] Vcc via a 840R to protect the led at 6mA
With this wiring, the backlight will be permanently on and there will be no way
to turn it off in software since there is not even any h/w for controlling it.
Stepping back, way back for a moment.
We need to understand what the real problem is in order to provide
reasonable suggestions for how to solve it.
If the problem is that the full h/w needs to run on batteries, then the solution
is definitely not as simple as being able to send a hd44780 command like
controlling the D,C,B bits in the display on/off command.
For example, the D bit will not control the backlight and there are other sources
of power consumption.
In order to help with suggesting power management solutions,
we would also need to fully understand all the hardware you are using.
The backlight is a moderate power draw, not nearly as large as the draw of a typical Arduino board,
particularly when using an external power supply vs the USB to power the board since
the on board Arduino voltage regulators are very inefficient.
When trying to get things to run efficiently on batteries, it is often not a simple solution
since the entire system has to optimized for lower power.
You must know where all the sources of power draw are coming from and then how
to manage/control them and it often means using special s/w to put the MCU to sleep.
In most cases, if you want extended battery life, it cannot be done with an off the shelf
If you could tell us what your real goals/needs are along with the hardware you are currently
using, then we could provide you with information on reasonable solutions on how to get there - or if it is
even possible to get there with the hardware you have.
Stumbling down this path of trying to come up with a way send raw hd44780 commands to the display
is not a good approach.