/ *
=
... =================================================================================*/ /*========================================================*/ #include
k=dat<<4; //Four-bit display datafor
(i=0;i!=4;i++) /*Write Display data :xxxxC0~C3*/
{
if(k&0x80==0)
_DAT=0;
else
_DAT=1;
_WR=0; //Send a write clock pulse_WR
=1;
k=k<<1; //Prepare for the next bit of data
}
_CS=1; //Cancel the chip select signal
}
DISP_NUM(uchar dat) /*Write a number*/
{
uchar i,j,addr;
for (i=8;i!=28;i++)
{
write_dat(i,dat<<4); //One byte needs to be transmitted twicewrite_dat
(++i,dat);
}
}
DIS(uchar dat)
{
uchar i,j;
for(i=0;i!=28;i++)
write_dat(i,dat);
}
setup_lcd(void)
{
delay(100);
write_com(0x01); /*Enable system,SYS EN command*/
write_com(0x18); /*CLOCK SOURCE IS 256kRC ON CHIP,RC 256K*/
write_com(0x29); /*BIAS=1/3 DUTY=1/4,LCD 1/3 bias,4 COM*/
write_com(0x03); /*Display on, turn on LCD bias generator*/
DIS(0x00); /*Clear LCD,clear the screen (fill the display memory with all 0s)*/
delay(20);
}
main()
{
uchar i,j,temp;
delay(100);
setup_lcd(); //Initialize LCD driver IC
delay(10);
while(1)
{
delay(200);
DIS(0x0f); //Display black and white stripes
delay(200);
DIS(0x00); //Clear screen
temp=0xf8;
for(i=0;i!=8;i++) /*Display ICONs*/
{
for(j=0;j=4;j++)
{
write_dat(i,temp>>1);
delay(20);
}
}
write_dat(13,0x01);
write_dat(19,0x01);
write_dat(23,0x01);
delay(200);
DISP_NUM(0xbe); */ //Seven-segment digital display
delay(200);
DISP_NUM(0x06); /*1*/ delay(200);
DISP_NUM (
0x7c); /*2*/ delay(200); DISP_NUM(0x5e); /*3*/ delay(200); DISP_NUM(0xc6); 5*/ delay(200); DISP_NUM(0xfa); /*6*/ delay(200); DISP_NUM(0x0e); /*7*/ delay(200); DISP_NUM(0xfe); /*8*/ delay(200); DISP_NUM(0xde); /*9*/ }
}
Previous article:C51 driver for 1602LCD module
Next article:uC/OS-II transplantation steps on C51
- Popular Resources
- Popular amplifiers
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
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Giant 555 Timer
- [BearPi-HM Nano] Burning system and the first program
- [New ways to play SAMR21] 25. Using LPS22H sensor
- [N32L43X Review] 3. Hardware I2C drive OLED
- CC26x2R LaunchPad Development Kit
- MOSFET Failure Causes
- I am a hardware engineer who has been working for more than 1 year. I want to ask the experts about charging outside of work.
- Video: Introduction to mmWave Sensors
- What should I do if MP1584EN often burns the chip?
- Ultrasonic water and gas meter design challenges and solutions