The actual picture of the LCD12864 button menu setting reverse white experiment sharing with Chinese character library is as follows:
I am using Puzhong's development board. If you have the same model of Puzhong development board, you can't display it by downloading it directly because my development board has changed the circuit.
You need to change it.
#include "lcd12864.h"
sbit LCD12864_RS=P2^6; //Register selection input
sbit LCD12864_RW=P2^5; //Register selection input
sbit LCD12864_E=P2^7; //LCD enable control
sbit LCD12864_PSB=P3^0; //Serial/parallel control
sbit LCD12864_RES=P3^2; //Data
reset
Part of the program (some programs are in #include"lcd12864.h" )
#include
#include"lcd12864.h" //lcd12864 LCD screen driver
#define uchar unsigned char //Macro definition unsigned character data type declaration definition name uchar number of bits occupied 8 bits range 0~255
#define uint unsigned int //Macro definition unsigned integer data type declaration definition name uint number of bits occupied 16 bits range 0~65535
/*Button IO pin definition*/
sbit k1=P3^0; //Menu selection button
uchar cdsz=0; //Menu setting flag
/*Delay function delay_ms(1) is about 1ms*/
void delay_ms(uint ms)
{
uchar t;
while(ms--)
{
for(t=120;t>0;t--);
}
}
/*Key function*/
void an_jian()
{
if(k1==0)
{
delay_ms(10); //Debounce delay is about 10ms
if(k1==0)
{
if(cdsz<2)cdsz=cdsz+1;else(cdsz=0);
}
while(!k1); //Confirm whether the key is released
}
}
/*Menu setting function*/
void caidan_shezhi()
{
if(cdsz==0)Lcd12864_SetAscWhite(2,2,10,0); //If cdsz==0, the 10 characters in the range of the 2nd row and the 2nd column are highlighted
else(Lcd12864_SetAscWhite(2,2,10,1)); //If cdsz!=0 2nd row, 2nd column, 10 characters, 1 is for off highlight
if(cdsz==1)Lcd12864_SetAscWhite(3,2,10,0); //If cdsz==1, 3rd row, 2nd column, 10 characters, 0 is for off highlight
else(Lcd12864_SetAscWhite(3,2,10,1)); //If cdsz!=1, 3rd row, 2nd column, 10 characters, 1 is for off highlight
if(cdsz==2)Lcd12864_SetAscWhite(4,2,10,0); //If cdsz==2, 4th row, 2nd column, 10 characters, 0 is for off highlight
else(Lcd12864_SetAscWhite(4,2,10,1)); //If cdsz!=2, 4th row, 2nd column, 10 characters, 1 is for off highlight
}
void main()
{
lcd12864init(); //lcd12864 initialization
LCD12864_cluck(); //Clear the screen completely or the screen will be distorted
while(1)
{
an_jian(); //Read the button function
caidan_shezhi(); //Read the menu setting function*
LCD_PutString(1,3,"settings"); //Start displaying settings at the 3rd column of the 1st row
LCD_PutString(2,1,"1.Display settings"); //Start displaying 1.Display settings at the 1st column of the 2nd row
LCD_PutString(3,1,"2.Application settings"); //Start displaying 2.Application settings at the 1st column of the 3rd row
LCD_PutString(4,1,"3.System settings"); //Start displaying 3.System settings at the 1st column of the 4th row
}
}
Previous article:ws2812b color light with indoor automatic system microcontroller source program
Next article:Single chip intelligent lighting system program
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- The new version is so beautiful, I decided not to update it for the time being!
- [SAMR21 New Gameplay] 12. Driving OLED
- [NXP Rapid IoT Review] Adding USB Serial Port Simulation Function to Rapid
- MSP430 MCU Development Record (8)
- Newbie help! Wireless remote control LED constant current drive circuit. Which part of the receiving circuit is the mixing circuit?
- Image recognition system based on STM32H745
- When writing Linux drivers, where can I find the prototypes or usage instructions of these API functions?
- [Power amplifier case] Application of power amplifier in giant magnetostrictive transducer hole crack defect detection
- TI's GaN technology brings half the size and double the power to machines
- [RVB2601 Creative Application Development] 5 Display letters AB at the same time, and eliminate them by long pressing and short pressing