Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] 20x4 lcd on and off problem

Status
Not open for further replies.

gauravkothari23

Advanced Member level 2
Advanced Member level 2
Joined
Mar 21, 2015
Messages
642
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
6,934
Hi Friends.
This is Gaurav Kothari. and i have made a small project in keil using 89S52, 4x4 Keypad and 20x4 Character LCD. i want to my lcd to get off when i press a on/off switch. i have done using it a small circuit. i have attached pin 2 and 15 of lcd to on/off switch so that on pressing the switch the lcd goes off and pressing it again make it on. but the problem is when i on my lcd again, it shows nothing on the lcd the lcd is left blank. so i thought to just off the backlight of lcd(pin 15) and giving direct supply to pin 2. but in this case when i off the lcd the backlight goes off and the text in lcd is still visible. and it is also battery consuming. so please can anybody Help me in this matter.so that i can save my battery for longer life and can off my lcd when not in use.
Thank You
 

Re: 20x4 lcd on and off problem

One issue with manually powering off the LCD, when it is powered up again it will require a delay in the order of 30ms to 50ms for the display controller chipset (HD44780 compatible) to fully initialize and be ready to accept input from the microcontroller.

A better approach would be to utilize a couple of BJTs or MOSFETs in between the power rails and the power pins for both the LCD and its backlight, then drive these BJTs or MOSFETs with an I/O pin from the AT89S52. An LCD power down/up routines could be written to enable or disable the LCD display, with a 50ms minimum delay on power up to allow the LCD controller to fully initialize before your firmware begins to reconfigure the LCD controller in preparation to load or reload the text required after power up.

You could implement a timer routine with an associated ISR which automatically powers down the LCD display when the duration of user inactivity is exceeded and power back up the LCD display when user activity is detected. Or use an external switch to an I/O pin which triggers an ISR to manually power down or power back up the LCD.

Both of the above approaches have been incorporated into numerous designs and are fairly easy and straight forward to implement.

BigDog
 

Hi,

Mind, When you switch OFF the power for the LCD, you also have to drive all other signals to the LCD LOW, or at least high Z.

After power up (like big dog guru said)
* give the signal lines valid levels
* wait at least 50ms
* initialize the display
* send desired text to the display

Klaus
*
 
Re: 20x4 lcd on and off problem

If i am not wrong.... i think ISR are mainly used when the processor is not replying to the entries we make...Maybe the processor was busy, and it just didnt check to see if you were hitting any buttons at that time.
interrupts are events that cause the processor to stop what it is doing, and handle a high-priority task first.
I my case i think i am not facing any such problems. its just an issue of on and off the lcd.
 

Hi,

If i am not wrong.... i think ISR are mainly used when the processor is not replying to the entries we make
What you describe is more like a watchdog circuit.

Interrupt are used for a lot of tasks.
* when a UART (or other interfac) received data
* to start ADC sampling with a fixed sample rate
* to run a software clock
* to periodically poll inputs like a matrix keyboard
* to control multitasking
* to run a real time os
* to run digital filters
* to run regulation loops.

I really can't remember when last time we did a microcontroller application without interrupts.

Klaus
 
Yes o agree with you.... but i want to change my hardware rather than changing my code. or adding something to my code.
i want to know ia it any possible way to control the lcd on/off function using any hardware or any circuit

- - - Updated - - -

my 89s52 have nothing to do with on/off function of LCd. i dont off or low my lcd signals using microcontroller. i have just added a simple on/off switch to lcd pin 2 and 15.
 

Hi,

i dont off or low my lcd signals using microcontroller.

Then don´t be surprised if you see problems.

Klaus
 

Re: 20x4 lcd on and off problem

If i am not wrong....

Sadly, in this case you are wrong.

Yes o agree with you.... but i want to change my hardware rather than changing my code. or adding something to my code.
i want to know ia it any possible way to control the lcd on/off function using any hardware or any circuit

The short answer to a hardware only solution is, No.


my 89s52 have nothing to do with on/off function of LCd. i dont off or low my lcd signals using microcontroller. i have just added a simple on/off switch to lcd pin 2 and 15.

It's abundantly clear from the above statements that you do not have a firm understanding of the underlying issue, that both Klaus and I have attempted to communicate to you.

In this case, the microcontroller has everything to do with the LCD functioning properly.

Whether you manually power off the LCD or power it off via a BJT or MOSFET is largely irrelevant, the main issue lies in the fact once you have powered off the LCD, you have then changed its state from properly initialized and configured to a state of uninitialized and unconfigured. Keep in mind, the LCD controller configuration is volatile. Therefore, once the LCD is powered back up, the microcontroller controlling the LCD must perform the following required tasks to properly reinitialized and reconfigure the LCD:

1. The microcontroller must provide a sufficient delay of at least 50ms to allow the LCD display controller to fully initialize before attempting to begin the required configuration steps.

2. Once the required delay has passed, the microcontroller can then begin properly configuring the LCD to again a known state, ready to accept input for display from the microcontroller.

In short, how you power down and power back up the LCD is largely up to you, however the microcontroller must be alerted by some means as to the state change of the LCD, so that it can perform the required tasks above when the need should arise.

Failing to carryout the above tasks is essentially equivalent to removing the delay and LCD initialization/configuration code from your program/application and expecting the LCD to function properly, and as you should know, it certainly will not.


BigDog
 
... but i want to change my hardware rather than changing my code. or adding something to my code....

You want to power on an lcd character module 4*20 and without any initialization to be ready for operation...

You thing the initialization procedure in the documentation of the lcd, is not required and it is a waste of time and space in code?

...i want to know ia it any possible way to control the lcd on/off function using any hardware or any circuit...
yes, with an lcd module that utilizes an other mC attached, and do the init for you.
 
20x4 lcd on and off problem

Hi Friends.
I need your help. i am working on a project of how to on and off 20x4 lcd using 89S52.
i am using 20x4 character LCD a 4x4 keypad and 89S52. i wnt something like when key '1' is Pressed from keypad the screen should go completly off and again when '2' is pressed it should get on. i have assign port 1 of 89S52 for Lcd data and P3^5 and P3^6 for grounding LCD. and have power up my lcd directly to 4.5v. my code works absolutely fine. but the problem is when i press Key1 to switch off the lcd gets dim but does not get off. my code is somewhat like
at initial stage both port 3 and port 1 are off.
P3=0xff;P1=0xff;
when key is pressed.
P3=0x00;P1=0x00;
When i off my lcd and checked with multimeter it is still showing me nearly 2.5v . can anybody please help me how to completely shut off my lcd.
 

Re: 20x4 lcd on and off problem

89SXX ports are not totem pole/push pull. They are open collector with weak pull ups.

So if I understand correctly, you have Vcc continuously connected to LCD and you supply/or not Vss thru two port3 pins.

You have to set all pins connected to LCD, in HIGH level in order to disable the LCD.
If you don't, current will find it's way to the LOW level pins and the required HIGH level on the P3 pins (provided by the internal weak pull ups), will drop.
This is why 2,5V seems possible.

Of course you cannot multiplex functions on pins connected to lcd with other functions.

An other approach would be to use a pnp transistor and drive the Vcc on the LCD.
 
  • Like
Reactions: bigdogguru

    bigdogguru

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
The situation you face with the AT89S52 and the LCD is similar to the situation discussed in your other thread:

https://www.edaboard.com/threads/341602/#post1457260

Examine the attached screen capture of the AT89S52 datasheet concerning it's limit current sourcing capabilities and restriction of current sinking.


BigDog
 

Can you offer the battery type and backlight current in your design details?
I would hope you designed it for low power consumption such as 3V and use 3.7V LiPo but not sure of LCD requirements.

Dynamic power is affected by clock frequency.
 

Re: 20x4 lcd on and off problem

thanks all.....
@xenos..... as u told that i need to put all the pins of lcd to high... can u please tell me how can i do that... actually i am very new to Electronics and programming. or else how can i use PNP transistor to do that...

- - - Updated - - -

@xenox.... yes i have made all my pins connected to lcd at high.... as u can see my previous post i have mentioned that....at initial stage both port 3 and port 1 are off.
P3=0xff;P1=0xff;
when key is pressed.
P3=0x00;P1=0x00;
but at initial stage when all pins are high P3=0xff and P1=0xff.... even through it is showing me 2.5 v and lcd is not getting off.. infact its dim
 

Hi,

i recommend to use a P-Ch FET or a PNP to switch high side power of LCD. (very low current on the port pins, very low dropout to the LCD supply)

When power is off, then pull all signals low.
***
Supplying switched GND to a device with the port pins of a microcontroller is not a good design in my eyes.
(because when the microcontroller outputs a LOW to a signal it will be significantely lower then than device´s GND. Also if there is any ADC or ACOMP used in the microcontroller, then you will see offset errors caused by GND bounce)

Klaus
 
Thanks Klaus.
But can u plz tell me how should i connect the MOSFET.
 

Hi,

there are not many options.

P-Ch:
* Source to VCC
* Drain to LCD (switched)
* Gate to port pin

port pin = low --> LCD = ON
port pin = high -- >LCD = OFF

Klaus
 
Thanks a lot.
But what MOSFET should i use. Standard MOSFET normally turns on when there is a supply od 10v-15v. but my circuit itself works on 4.5v-5v
 

It would be useful to know your purpose of switch-off the LCD.

a) Is it simply to have a completely blank screen ?
OR
b) is it to save power ?

If (a) then you can do this by removing power from backlight and ALSO changing the contrast voltage. (The one connected thru pot or resistor divider). Remember that the display on the LCD is stored in its controller, so removing the main Vcc to the panel will obviously delete this information.

If it is (b) then either you must refresh the latest display data (as described by others in this thread), OR you can opt for an Ultra-Low power LCD display panel.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top