1. Hardware Introduction
1>Pin Introduction
The specific pins are as follows:
The pins that need to be operated on the microcontroller are: RS, RW, E and DB0~7
2>Instruction Introduction
Here, let’s just introduce what is CGRAM and what is DDRAM?
CGRAM: It is a user-defined character storage memory. You can define characters at the specified address.
DDRAM: It is a memory corresponding to the screen position. By setting this address, it is determined where on the screen the characters will be displayed.
2. Software
#include
#include
#define DATA P0
sbit RS=P2^6;
sbit RW=P2^5;
sbit EN=P2^7;
unsigned char zifu[]={"Hello,World!0"};
unsigned char wangzhi[]={"http://shop108408772.taobao.com/"};
void delayms(unsigned char m) //适当延时
{unsigned char i;
while(m--)
{
for(i=0;i<=250;i++)
{_nop_();
}
}
}
void WRITE_BYTE(unsigned char canshu)
{
RW=0;
_nop_();
_nop_();
EN=1;
_nop_();
DATA=canshu;
EN=0;
_nop_();
_nop_();
}
void main()
{
unsigned char *point;
RS=0;
WRITE_BYTE(1); //Clear screen
delayms(10); //About 23ms delay
WRITE_BYTE(2); //Cursor home
delayms(10);
WRITE_BYTE(6);
delayms(10);
WRITE_BYTE(0x0F); //Cursor display flashes
delayms(10);
WRITE_BYTE(0x14);
delayms(10);
WRITE_BYTE(0x38); //Two lines display, 5X7 characters
delayms(10);
WRITE_BYTE(0x80);
delayms(10);
_nop_();
point=wangzhi;
while(*point!='') //Hello, world!,http: //shop108408772.taobao.com
{RS=1;
_nop_();
WRITE_BYTE(*point);
point=point+1;
delayms(10);
if(point==wangzhi+16)
{RS=0;
WRITE_BYTE(0xC0);
delayms(10);
}
}
while(1);
}
3. Problems in testing
1> Pay attention to the appropriate delay after each instruction, otherwise the operation will go wrong
2> In this test, the busy flag is not read, and the direct delay and operation can basically pass
4. Test Results
Previous article:LCD1602 main parameters, pin functions and initialization methods
Next article:MSP430 MCU Mode IIC Protocol C Language Program
- 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
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Isolated DC-DC power supply module, input and output common ground problem.
- PCB Star Decoration
- Introduction to TTL level, CMOS level, and RS232 level
- RedMonk Programming Language Survey: Python Remains at No. 2
- What is the functional difference between these two capacitors?
- ATmega4809 Curiosity Nano Review Summary
- Embedded Engineer Recruitment-Beijing-This post is valid for a long time
- 【GD32E231_DIY】-06 SYN7318 speech recognition module information
- 3 Ways to Speed Up Your Design Cycle Using Brushless DC Motors
- EEWORLD University Hall----Live Replay: TI's new generation C2000? microcontroller integrates powerful communication capabilities and control performance to achieve more flexible system-level design