/***********************************************************
File name: Driver for PC2004 series character LCM module of POWERTIPAuthor
: FreeVersion
: v01Description
: Address 0x80~0xa7,0xc0~0xe7;
First line: 0x80~0x96; Second line: 0xc0~0xd6;
Third line: 0x97~0xa7; Fourth line: 0xd7~0xe7;
Modification record: None
***********************************************************/
typedef unsigned char Uchar;
typedef unsigned int Uint;
#define LCDCmdPort P0
#define LCDDataPort P0
sbit LCD_RS = P2^7;
sbit LCD_E = P2^6;
/* LCD busy detection function*/
void LCDBusy(void)
{
Uchar i;
for(i=0;i<80;i++)
{}
}
/* LCD control command function*/
void LCDCmd(char c)
{
LCDBusy();
LCDCmdPort=c;
LCD_RS=0;
LCD_E=1;
LCD_E=0;
}
/* LCD data input function*/
void LCDData(char d)
{
LCDBusy();
LCDDataPort=d;
LCD_RS=1;
LCD_E=1;
LCD_E=0;
}
/* LCD initialization function*/
void LCDInit(void)
{
LCD_E=1;
LCD_RS=1;
LCDCmd(0x38); //function set
LCDCmd(0x0c); //display on/off
LCDCmd(0x06); //set entry mode
LCDCmd(0x02); //return home
LCDCmd(0x01); //clear display
}
/* Display string function, addr displays the starting address of the string*/
void LCDStr(Uchar addr,Uchar *s)
{
idata int d=0;
LCDCmd(addr); //Display address//
while (s[d]!=0x00)
LCDData(s[d++]); // char of LCM //
}
/*p is the first address of the string or array, len is the number of strings, the array should be a two-dimensional array of ≤4*20 or a one-dimensional array of ≤80*/
void LCDSz(Uchar *p,Uchar len)
{
Uchar i;
LCDCmd(0x80); //Display address//
while(*p!=0x00)
{for(i=0;i
break;
}
}
Previous article:AT89C4051+TLC7225I three-phase AC signal source
Next article:AT89C2051+AD7545 sine signal generator
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Feedforward multi-carrier old technology
- 【Smart Network Desk Lamp】10. Esp32-S2 driver UART
- Fun Oscilloscope + Running Polygons
- How to get download points
- A 985 graduate student is unemployed at the age of 37. What should I do?
- GPU Computing Motherboard Study Material No. 735: AGX Xavier GPU Computing Motherboard Based on 3U VPX
- Key concepts and definitions of 5G mmWave OTA testing
- EEWORLD University ---- PRU-ICSS: Processor and multiple ADC interfaces
- [Zero-knowledge ESP8266 tutorial] Quick Start 20 OLED local hour clock
- EEWORLD University ---- Altera max10 fpga training video