The PCF8574 module makes it possible to realize IIC driving LCD1602.
The following figure is the connection circuit diagram of PCF8574 module and 1602:
The actual connection method is as follows:
If you want to use the PCF8574 module to implement IIC driving LCD1602, it is very necessary to first understand the timing of IIC, PCF8574 device address, and four-line control LCD1602 method.
Below are two important h files. You can transplant them into your program by modifying some codes in these two h files (the wiring is different).
The microcontroller source program is as follows:
void delay1(uchar x)
{
uchar a,b;
for(a=x;a>0;a--)
for(b=200;b>0;b--);
}
void write_com(uchar com) //write command function
{ uchar com1,com2;
com1=com|0x0f;
write_add(com1&0xfc);
delay1(2);
write_add(com1&0xf8);
com2=com<<4;
com2=com2|0x0f;
write_add(com2&0xfc);
delay1(2);
write_add(com2&0xf8);
}
void write_date(uchar date) //Write data function
{
uchar date1,date2;
date1=date|0x0f;
write_add(date1&0xfd);
delay1(2);
write_add(date1&0xf9);
date2=date<<4;
date2=date2|0x0f;
write_add(date2&0xfd);
delay1(2);
write_add(date2&0xf9);
}
void init_lcd() //initialization function
{
write_com(0x33); //Display mode setting
delayms(6);
write_com(0x32); //Display mode setting
delayms(6);
write_com(0x28); //4-bit bus, double-line display, display 5×7 dot matrix characters
delayms(6);
write_com(0x01); //Clear screen
delayms(6);
write_com(0x06); //Character entry mode: screen does not move, characters move backward
delayms(6);
write_com(0x0c); //Display on and off cursor
//write_LCD_Command(0x0f); //display on, cursor on, cursor blinking
delayms(6);
}
//Display string: what is displayed in row x, column y
void ShowString(unsigned char x,unsigned char y,unsigned char *str)
{
if(x == 1)
{
write_com(0x80 | y-1);
}
if(x == 2)
{
write_com(0xc0 | y-1);
}
// Output string
while(*str!='')
{
write_date(*str);
str++;
}
}
Previous article:Using 51 single chip microcomputer to control LCD12864 display screen source program
Next article:Single chip LCD12864 linked list to achieve the greedy snake source code
Recommended ReadingLatest update time:2024-11-22 23:44
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- A preliminary study of k210 - MixNo - graphical programming
- Brief Introduction of LPC Series MCU
- 【i.MX6ULL】Driver Development 6——Pinctrl subsystem and GPIO subsystem light up LED
- Excellent Works of the National College Student Electronic Design Competition - Smart Car Album
- Tektronix RF Communication Laboratory Innovation Experiment Platform
- New tire pressure monitoring system based on NPX
- What is the use of the C language comments in the figure?
- IoT Protocol: MQTT Protocol
- What to do if there is no package when importing PCB netlist in Cadence
- The Development and Application of Wireless Video Surveillance