Programs should be written in their own style
******************************************************
** This is a 1602 program written when learning msp430g2553 microcontroller **
** Time is accurate to us, basically no garbled characters **
** P1 is the data output port **
** rs is connected to p2.1 **
** rw ground **
** en connect to p2.0 **
******************************************************
#include
#include
#define rs_0 P2OUT&=~BIT1
#define rs_1 P2OUT|=BIT1
#define en_0 P2OUT&=~BIT0
#define en_1 P2OUT|=BIT0
char
table_1[]={"SHOU BU NIAO L !"};
char
table_2[]={"2012.8.02"};
unsigned int num;
unsigned int con_1,con_2;
void LCD1602_write_command(unsigned int com)
{
rs_0;
P1OUT=com;
__delay_cycles(500);
en_1;
__delay_cycles(500);
en_0;
}
void LCD1602_write_data(unsigned int dat)
{
rs_1;
P1OUT=dat;
__delay_cycles(500);
en_1;
__delay_cycles(500);
en_0;
}
void LCD1602_init()
{
LCD1602_write_command(0x38); //5*7 dot matrix, double line display
LCD1602_write_command(0x0c); //0x0f has cursor,
LCD1602_write_command(0x01); //Clear screen
LCD1602_write_command(0x06); //After writing data, the cursor moves right and the display screen does not move
LCD1602_write_command(0x80);
}
void main ()
{
con_1=strlen(table_1);
con_2=strlen(table_2);
WDTCTL=WDTPW+WDTHOLD;
P1DIR =0XFF;
P2DIR=0XFF;
LCD1602_init();
for(num=0;num
LCD1602_write_data(table_1[num]);
__delay_cycles(1000);
}
LCD1602_write_command(0x80+0x40);
for(num=0;num
LCD1602_write_data(table_2[num]);
__delay_cycles(1000);
}
while(1);
}
Previous article:Keil Tutorial (II)
Next article:DS18b20 Temperature Detection Description
- 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
- [Zero-knowledge ESP8266 tutorial] Quick start 1-Let your development board say hello to the world
- EEWORLD University Hall----Engineering is smarter, industrial design is more powerful: TI robot system
- Calculation and setting of baud rate of msp430 microcontroller
- Analysis of the Principle of Power Switching Circuit
- Do you know? Use GPIO to simulate I2C communication on C2000
- New Technology for Air Quality Monitors and Smoke Detectors
- Measurement and analysis of vehicle speed sensor signals using an automotive oscilloscope
- How to reduce 60V to 42V using LM34927
- Detailed explanation of STM32 minimum system circuit
- This online circuit simulation tool YYDS