Measurement method of power consumption of LCD display module

Publisher:EternalSmileLatest update time:2023-06-28 Source: elecfansKeywords:LCD Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Measurement Schematic Diagram

Description K1 K2 K3 are the settings of the LCD module. K1 is the WDT selection switch. When the switch is closed, WDT is turned on. Otherwise, WDT is turned off
. K2 is the TONE selection switch. When the switch is closed, audio output is turned on. Otherwise, it is turned off. K3 is the LCD module oscillator selection switch. When K3 is closed, external 32.768K crystal oscillator is selected. Otherwise, internal RC oscillator 256K is selected. KEY is the confirmation key used to loop the measurement process. LED is the indicator light for the measured value to be readable. When the MCU has finished setting the LCD module, the IO port P0.1 P0.3 P0.5 of the interface will be set to high impedance state, and then the LED will be lit to indicate that the measured value is readable.
Measurement method: Select the working mode of the LCD module by K1 K2 K3, and then press the KEY key and wait for the LED to light up. Observe
the LCD. If the LCD is fully displayed, the current measured by the ammeter is the current of the current setting working mode. Press the KEY key again, and the LCD will be completely off. At this time, the current measurement value is the current in the power-off mode.


2 Source program
/********************************************************
DLCD.c
This program is used to debug and measure the parameters of the water meter LCD module of our company. It can measure
the power consumption of the LCD module in full display mode, the power consumption in power-off mode WDT and the power consumption during audio output.........
**********************************************************/
#include
#define uint unsigned int /* Set LCD module interface port parameters
for SPI.h
*/ sbit CS_PORT=P0^1; /*CS port*/
sbit CLK_PORT=P0^3; /*WR port*/
sbit SDA_PORT=P0^5; /*DATA port*/
#include /*uchar has been defined in the SPI.h file*/
/*Mode selection switch definition*/
sbit K1=P0^0; /*WDT on/off selection*/
sbit K2=P1^6; /*Audio output on/off selection*/

sbit K3=P1^4; /*Internal or external crystal selection*/
sbit KEY=P1^1; /*'Confirm' button*/
sbit LED=P0^7; /*Readable indicator light*/
/*Command word definition The command word is the lower 8 bits of 'command mode'*/
#define BIAS 0X52 /*Define 1 3 Bias 4 Back Pole*/
#define XTAL32 0X28 /*Use external crystal*/
#define RC256 0X30 /*Use internal 256KRC oscillator*/
#define SYSEN 0X02 /*Turn on oscillator generator*/
#define LCDON 0X06 /*Turn on LCD*/
#define SY SDI S 0X00 /*Turn off oscillator generator*/
#define LCDOFF 0X04 /*Display off*/
#define TONE4 0X80 /*Set BZ output frequency to 4K*/
#define TONEON 0X12 /*Turn on BZ audio output*/
#define TONEOFF 0X10 /*Turn off BZ audio output*/
#define CLRWDT 0X1c /*Clear WDT*/
#define F1 0X40 /*WDT set to 4 seconds overflow*/
#define IRQEN 0X10 /*IRQ output disabled*/
#define IRQDIS 0X00 /*IRQ output enabled*/
#define WD TE N 0X0e /*Turn on WDT*/
#define WDTDIS 0X0a /*Turn off WDT*/
#define TI MERDIS 0X08 /*Turn off time base output*/
/****************************************************************
Delay function
Function prototype: void Delay()
Usage: Delay of SPI operation
**************************************************************/
void Delay()
{
uchar i;
for(i=0;i<10;i++); /*Used to adjust CLK pulse width*/
}
/*********************************************************
Long delay function
Function prototype: void Delay1s()
Usage: long delay.....
******************************************************/
void Delay1s()
{
uchar i;
uint j;

for(i=0;i<10;i++)
for(j=0;j<1300;j++);
}
/*********************************************************
Send command function class A
Function prototype: void SEN DC OMA(uchar com)
Use: When sending a command to HT1621, you must first send the ID value, and the command word is used to set the HT1621.
*********************************************************/
void SENDCOMA(uchar com)
{
Start_spi();
SendBit(0X80,4); /*Send setting command ID=100 0*/
SendByte(com); /*Send command word*/
}
/**********************************************************
Send command function class B
Function prototype: void SENDCOMB(uchar ad r)
Use: When sending a command to HT1621, you must first send the ID value Value, then send the starting address of the data to be written,
used for RAM write operation (data can be sent after calling this function) adr is the high 5 bits valid
**********************************************************/
void SENDCOMB(uchar adr)
{
Start_spi();
SendBit(0XA0,4); /*Send write display RAM command ID=101 0*/
SendBit(adr,5); /*Specify write address*/
}
/************************************************************
Send command function (C class)
Function prototype: void SENDCOMC(uchar com)
Usage: When sending a command to HT1621, you must first send the ID value. Then send the C class command word
*********************************************************/
void SENDCOMC(uchar com)
{
Start_spi();
SendBit(0X90,4); /*Send command ID=100 1*/
SendByte(com); /*Send command word*/
}

/********************************************************
Fill the display buffer
Prototype: void disp(ucahr dat)
Function: Fill the display buffer and display data in the simplest form
*******************************************************/
void disp(uchar dat)
{
uchar i;
SENDCOMB(0x00); /*Set the data pointer back to 0 and then write data*/
for(i=0;i<16;i++) /*Write 16 bytes of data*/
{
SendByte(dat); /*Write data*/
}
}
/**********************************************************
Full display current measurement
Optional components WDT Audio output Internal RC External crystal selection
Time base output closed
**********************************************************/
void DISP_ALL()
{
/*Display Chip Initialization is also the LCD module power-down wake-up procedure*/
SENDCOMA(BIAS); /*Set bias voltage, back pole number*/
/*Select crystal type*/
K3=1;
if(K3==1)SENDCOMA(RC256); /*Set to internal crystal 256K*/
else SENDCOMA(XTAL32);
/*Start LCD oscillator*/
SENDCOMA(SYSEN); /*Start oscillator*/
Delay1s();
SENDCOMA(LCDON); /*Display enable*/
SENDCOMA(TIMERDIS); /*Disable time base output*/
/* Watchdog selection*/
K1=1;
if(K1==0)
{
SENDCOMC(F1); /*WDT set to 4S*/
SENDCOMA(WDTEN); /*Open WDT*/
SENDCOMA(CLRWDT); /*Clear WDT*/

SENDCOMC(IRQEN); /*Turn on IRQ*/
}
else
{
SENDCOMC(IRQDIS); /*Disable IRQ*/
SENDCOMA(WDTDIS); /*Disable WDT overflow flag output*/
}
/*Audio output selection*/
K2=1;
if(K2==0)
{
SENDCOMA(TONE4); /*Audio output is set to 4KHz*/
SENDCOMA(TONEON); /*Turn on audio output*/
}
else SENDCOMA(TONEOFF); /*Otherwise turn off audio output*/
disp(0xff); /*Output full display data*/
PT0AD=0x3e; /*SPI interface digital input function disabled*/
P0M1=P0M1|0x3e; /*Set SPI port to input only P0M2 corresponding bit is already 0*/
LED=1; /*Indicates that the measured value is readable*/
KEY=1; /*Wait for the 'confirm' button*/
while(KEY==1);
P0M1=P0M1&0xc1; /*Set SPI port as bidirectional port*/
PT0AD=0x00;
LED=0; /*Turn off LED indication*/
while(KEY==0);
}
/************************************************************
Power-off measurement part
First turn off the audio output and then enter the power-off mode
After power-off, the LCD interface is set to high-impedance state. If the IO port is not in high-impedance mode, it should be set to 1
********************************************************/
void DISP_OFF()
{
SENDCOMA(TONEOFF); /*Audio output disabled*/
Delay1s();
SENDCOMA(LCDOFF); /*Display disabled*/
Delay1s();
SENDCOMA(SYSDIS); /*Stop oscillator*/
P0M1=P0M1|0x3e; /*Set SPI port as input only*/

PT0AD=0x3e; /*SPI interface digital input function disabled*/
LED=1; /*Indicates that the power-off current measurement value can be read*/
KEY=1;
while(KEY==1);
P0M1=P0M1&0xc1; /*Set the SPI port to a bidirectional port*/
PT0AD=0x00;
LED=0;
while(KEY==0);
}
/****************************************************
Main function
Prototype: void main()
Function: Continuously query KEY. If there is a key, perform full display measurement state. If the key is pressed again, enter
Power-off measurement state and cycle measurement in sequence
**********************************************************/
void main()
{
P0M1=P0M1&0x7f; /*Set the LED port to pull-up output*/
P0M2=P0M2|0x80;
while(1)
{
LED=0; /*Turn off the indicator light*/
DISP_ALL(); /*Full display measurement*/
DISP_OFF(); /*Power-off measurement*/
}
}
Header file SPI.h
/************************************************************
SPI.h
This header file is some basic functions for reading and writing SPI. It is used for the LCD module of our company's water meter
Driver debugging
********************************************************/
#define uchar unsigned char
extern void Delay(); /*Delay program of device driver*/
/*************************************************************/
Name: Send data bit
Prototype: void SendBit(uchar dat,uchar bitcnt)
Purpose: Send the bitcnt data of dat to SPI starting from the high bit. (bitcnt cannot be greater than 8)
/***************************************************************/

[1] [2]
Keywords:LCD Reference address:Measurement method of power consumption of LCD display module

Previous article:LCD TV System Solutions
Next article:Design of plasma color TV based on Genesis gm5020 chip

Recommended ReadingLatest update time:2024-11-16 11:33

Honor Magic 4 Lite renderings and specifications exposed: 6.81-inch LCD screen
       The Honor Magic4 / Magic4 Pro smartphones, which use Qualcomm Snapdragon 8 Gen 1 chipsets and powerful camera modules, have already impressed many people. However, for consumers with limited budgets, the price of 900 / 1100 euros is still daunting. The good news is that if you don't have high requirements for a
[Mobile phone portable]
mini2440_LCD_x35 porting
Starting from Linux 2.6, a new set of driver management and registration mechanisms have been introduced: platform_device and piatform_driver. (platform represents platform); the device is represented by platform_device, and the driver is registered with piatform_driver.  Compared with the traditional devicedriver m
[Microcontroller]
LCD device driver in Linux (5) - based on s3c6410 platform
In the previous articles, when analyzing the probe functions corresponding to the LCD platform devices, some functions were not analyzed in detail because the main purpose was to highlight the overall structure of the probe function. Now we will analyze some functions in more detail. (1), void s3cfb_pre_init(void)
[Microcontroller]
LCD device driver in Linux (5) - based on s3c6410 platform
C51 MCU, 128*64 serial port LCD driver
CA12864K Serial C51 Demo Program //CA12864K test program (serial port)  //*************************************************************************** //Connection table: CPU=89C52 SystemClock=12Mhz * //CS=P3.0            SCLK=P3.1          SID=P3.2       Reset=RC in Board    * //***************************************
[Microcontroller]
JZ2440 Development Board-TFT LCD Experiment
This experiment CPU: s3c2440 LCD: 4.3 inches Resolution 480*272 TFT-LCD Model AT043TN24 V.1 The s3c2440 LCD controller supports: ①1/2/4/8bpp palette display mode, 16bpp/24bpp non-palette display mode After the LCD model is selected, the hardware engineer makes the circuit board, and the LCD module wiring is de
[Microcontroller]
JZ2440 Development Board-TFT LCD Experiment
MCU I2C communication and LCD1602 display C program
Download the schematic used in this program:  click here  , the microcontroller chip used is stc89c52; just find the schematic diagram of the digital tube. This is the circuit diagram of the entire microcontroller development board, ignore the others. Download the keil project file of this program: http://www.51hei.com
[Microcontroller]
STM32 FSMC interface driver TFT-LCD design
0 Introduction With the continuous updating of electronic products, more and more display interfaces are being developed. Due to the high cost-effectiveness of TFT color screens, they are widely used as display screens in various electronic devices. At present, there are many solutions to drive TFT color screens. Yo
[Microcontroller]
STM32 FSMC interface driver TFT-LCD design
LCD12864 Test Procedure
The controller of LCD12864 is ST7920, which has Chinese character library, graphic library and parallel port driver. #include reg52.h #include intrins.h #define uint unsigned int #define uchar unsigned char #define P0 P0 uchar code table1 ={"Wallacer"}; uchar code table2 ={"I like microcontrollers!"};  uchar
[Microcontroller]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号