1602 is a character LCD, which contains a character library of 128 ASCII characters, so it can display ASCII characters but not Chinese characters.
1602 can display two lines of information, 16 characters per line, powered by 5V power supply and with backlight.
Knowledge points:
#include
#include
#define uchar unsigned char
#define LCD P2
sbit RS = P3^0;
sbit RW = P3^1;
sbit E = P3^2;
uchar i,j;
uchar tab[] = "I LOVE YOU"; //Define an array and put the characters to be displayed into the array
void writeCMD(uchar cmd)
{
RS = 0; //0 represents command, 1 represents data write command
RW = 0; //0 represents write, 1 represents read
for(i=0;i<200;i++);//Small delay
LCD = cmd; //write command
E = 1; //LCD enable
for(i=0;i<5;i++);//Small delay
E = 0; //Disable LCD
for(i=0;i<5;i++);//Small delay
}
void writeDATA(uchar data1) //write data
{
RS = 1; //0 represents command, 1 represents data write data
RW = 0; //0 represents write, 1 represents read
for(i=0;i<200;i++);//Small delay
LCD = data1; //write command
E = 1;
for(i=0;i<5;i++);//Small delay
E = 0;
for(i=0;i<5;i++);//Small delay
}
//LCD initialization, hardware fixed initialization steps, no need to remember
void init()
{
RW = 0; //Low level makes write operation effective
E = 0; // Enable LCD
writeCMD(0x38); //16*2 display, 5*7 dot matrix, 8-bit data interface
writeCMD(0x0C); //Open the display, but do not display the cursor
writeCMD(0x06); //After reading or writing a character, the address pointer is incremented by 1, and the cursor is incremented by 1; when writing a character, the entire screen display does not move
writeCMD(0x01); //Clear screen
}
//Main function
void main(void)
{
init(); //LCD initialization sub-function call
writeCMD(0xc0); //Write address, choose where to display characters on the screen
for(i=0;i<220;i++);//Small delay
for(j=0;j<10;j++)//for loop displays multiple characters in sequence
writeDATA(tab[j]); //Characters to be displayed on the screen
while(1);
}
Wireless label included:
Click LBL, double-click on the two ends of the wireless connection, and attach the same name.
Previous article:80C31 MCU external interrupt 0
Next article:External interrupt 0/1
- 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
- Red Hat announces definitive agreement to acquire Neural Magic
- 5G network speed is faster than 4G, but the perception is poor! Wu Hequan: 6G standard formulation should focus on user needs
- SEMI report: Global silicon wafer shipments increased by 6% in the third quarter of 2024
- OpenAI calls for a "North American Artificial Intelligence Alliance" to compete with China
- OpenAI is rumored to be launching a new intelligent body that can automatically perform tasks for users
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- ASML provides update on market opportunities at 2024 Investor Day
- Arm: Focusing on efficient computing platforms, we work together to build a sustainable future
- AMD to cut 4% of its workforce to gain a stronger position in artificial intelligence chips
- A new interpretation of the principle of integral circuits: the transformation of amplifiers and capacitors
- How to achieve two-way voltage regulation output with 2SC8050 boost circuit
- Is there anyone who knows Mitsubishi PLC?
- Live broadcast at 10 am today [TI SimpleLink wireless platform latest software and hardware solutions]
- Bidirectional 5V, 3.3V logic level conversion circuit
- LT3514 step-down followed by optocoupler
- Microphone preamplifier circuit
- Fudan Microelectronics MCU
- dsp bootloader c5000
- Crystal oscillator problem