How to toggle power to an LCD Screen?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

How to toggle power to an LCD Screen?

Post by Ondra »

Good day all.
I have an LCD screen connected to my system. To conserve battery power I want to power down the LCD.
I tried using a N-channel Mosfet connected to the Ground of the LCD. When the Mosfet is triggered(Power is disconnected),
the LCD screen still works. Seeing this; I disconnected the Ground to the LCD, and still the LCD works. With this I have
conclude that the Ground is being sourced via the control or data pins connected to the LCD. I noticed that there is a start command
but no stop command. Is there a safe way to Power off the screen that won't damage the chip or LCD?

Ondra

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Benj »

Hi Ondra,

What about a P channel mosfet to switch off the VDD rather then switching the ground, this would likely be my approach.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks Ben.
I was thinking that that would have the same effect sourcing VDD through the control or data pins?

Ondra

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Benj »

Hi Ondra,

It's possible but if you make sure all your data pins are low while the display is disabled then it should be fine. Any pins that are connected directly to VDD or via pull-up's should instead be connected to the switched VDD. Once you have done this you should be ok.

Otherwise do the opposite for your N channel fet. Make all data pins high when disabling the display and ensure that all the display pins connected to ground directly or indirectly go via the switched ground.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks.
So than to make this simple, I can, ignoring the LCD macros create a macro that
when called does the following in that case:

Data 1(D1) = 1
Data 2 (E1) = 1
Data 3 (D0)= 1
Data 4 (E0)= 1
RS (D5) = 1 ????? What about this
Enable (E2) =1 ????? and this
Mosfet Switch (A3) = 0

Does the order of switching matter?

Ondra

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Benj »

Hi Ondra,

Shouldn't matter too much as the amount of time between commands will be in the micro second range so you won't notice either way. I would maybe switch everything before the mosfet apart from the enable pin just to make sure it's not going into a funny mode on powerup, probably won't make any odds as there will likely be a few milliseconds delay on power up before the display would respond to the enable pin being high.

Power Down
Data 1(D1) = 1
Data 2 (E1) = 1
Data 3 (D0)= 1
Data 4 (E0)= 1
RS (D5) = 1
Mosfet Switch (A3) = 0
Enable (E2) =1

Power Up
Enable (E2) =0
Mosfet Switch (A3) = 1
Data 1(D1) = 0
Data 2 (E1) = 0
Data 3 (D0)= 0
Data 4 (E0)= 0
RS (D5) = 0

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks a whole lot Sir. I'll give it a go.

Ondra

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Kenrix2 »

You might want to consider using just the glass for battery systems. From a typical LCD Display Module data sheet the current draw is around 1500ua while using just the glass I average just 2.1ua (with the display on and the micro in sleep). With a CR2032 your looking at a 10 year battery life using Microchip XLP Battery Life Estimator, so you don't really have to turn the display off. Static displays are easy to use but I prefer quarter duty since they use fewer pins on the micro. The glass I use is only $1.33 from Mouser Electronics # S401M16KR . These also operate down to 2.55 volts Vdd with high contrast. As the voltage gets lower the contrast starts to fade and the viewing angle gets lower.
Last edited by Kenrix2 on Tue Sep 17, 2013 6:44 pm, edited 1 time in total.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks Kenrix2.
I'll look in to this. A few questions.
How do you communicate to the class?
Can you use a flowcode object, or do
I have to create the function to print
data to the screen?


Ondra

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Kenrix2 »

The Pic16LF1936 has a built in Module for direct connection to LCD glass displays. To use it in Flowcode I insert a C Code icon in the Main program to "set up" the built in Module. This is similar to the Start/Connections that Flowcode uses when you add the 16x2 LCD Component. The "set up" selects the pins used and powers up the LCD Module plus a few other things like refresh rate and how much power is used and contrast. Internal contrast adjustment is nice since many assembled 16x2 LCD Display Units need an external potentiometer to adjust that. Next I add a variable in Flowcode called "number". A Call Macro icon is added to the Main program. A New Macro called "Display_Number" is then created which converts "number" into the individual segments and displays them. This Macro is similar to the Flowcode LCD Component PrintNumber. For instance, to display a 7 requires three segments to be turned on, the top one and the two right segments. If you purchase a PIC16LF1936 and that specific display, I can help you with the "set up" C Code icon and the "Display_Number" macro. If you need a different LCD glass or PIC I can still help but won't be able to do a hardware test. One nice thing about that display and PIC micro is it can be made into a single sided PCB without jumpers even when using a SOIC PIC and no traces between the pins.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks again Kenrix2.
My project uses a 18LF46K80 fully maxed. I checked the
data sheet and it does not support connecting to LCD Glass.
I'll put this as and upgrade to consider in a future build of the
device. Thanks for the in-site.

Ondra

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

18lf46K80 Vref+/ RA3/ set as I/O not going does not go to 0v outputing a 0 in flowcode goes to .16v. Anyone got any Ideas whats not happening here.
Thanks in advance

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by medelec35 »

Hi Ondra,
Within the datasheet it does state that maximum output low voltage is 0.6V
So when designing circuitry to drive a transistor, you must take that into account.
When you change the o/p to high, is the output voltage between Vdd and Vdd - 0.7V?
It's still worth checking for shorts.

Martin
Martin

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks medelec35.
yes to the question on output voltage VDD 3.36 o/p high 3.36v. In the data sheet you stated that it states a maximum output low voltage is 0.6v.
I don't know how to account for that in my circuit, short of using a pin that can output 0v. Any Ideas on this.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by medelec35 »

first we need to establish if the hardware is ok?
what I would do it put that one out put pin as low & two adjacent pins either side high.
Make sure you set the outputs at the start of main with a endless loop to follow, so no other components like PWM will be initialised.
Then measure that output pin and then the two adjacent pins either side.
Make sure the one low pin has a different voltage to the two adjacent pins.
Also measure at the VSS of the microcontroller to make sure that is reading 0V WRT ground.

What transistor are you using for controlling LCD back light?
Martin

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks looking into it.
Transistor DDTB142JC-7-F
Data sheet at https://www.diodes.com/assets/Datasheets/ds30403.pdf

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by medelec35 »

Hi Ondra
The 0.6 will not be relevent in your case as you're using PNP Transistor.
Will only be relevant if using npn as transistor could be conducting with 0.6V, especially if load current is small.
With PNP the transistor will be fully on if the voltage is <.6 of VDD.
So any voltage from 2.7 to 0 with respect to ground.

So if you have no shorts, then you will no issues controlling the transistor, even if the low voltage is 0.6V instead of 0.16V.

Martin
Martin

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: How to toggle power to an LCD Screen?

Post by Ondra »

Thanks Medelec35.
I took some time to go over the wiring and discovered a trace from LCD power to Vdd.
Its not in the PCB design, so I did not suspect it as an issue. I will need to take this up
with the board fabricator.
Thanks for the assistance.

Post Reply