Figure 1. LPC1114 driving LCD1602
Figure 2. LPC1114 driving LCD0802
The program used for LCD1602 and LCD0802 is the same.
In the lcd.h file, the code is as follows:
#ifndef __LCD0802_H__ #define __LCD0802_H__ #include "lpc11xx.h" #define OUT_DATA(value) LPC_GPIO2->DATA =(value<<4) #define RS_LOW LPC_GPIO3->DATA&=~(1<<0) #define RS_HIGH LPC_GPIO3->DATA|=(1<<0) #define WR_LOW LPC_GPIO3->DATA&=~(1<<1) #define WR_HIGH LPC_GPIO3->DATA|=(1<<1) #define EN_LOW LPC_GPIO3->DATA&=~(1<<2) #define EN_HIGH LPC_GPIO3->DATA|=(1<<2) extern void delay_0802(uint16_t us); extern void write_com(uint16_t com); extern void write_date(uint16_t dat); extern void init_0802(void); extern void lcd_show(void); #endif
In the lcd.c file, the code is as follows:
#include "lcd.h" #include "lpc11xx.h" void delay_0802(uint16_t us) { uint16_t i,j; for(i=0;i<100;i++) for(j=0;jDIR|=0xFF0; // Set the high 8-bit pins of P2 port to output, used as LCD 8-bit parallel data LPC_GPIO2->DATA |= 0XFF0; // Set the high 8-bit pin of port P2 to high LPC_GPIO3->DIR|=0x007; // P3 port P3.0 to P3.3 are output pins, used as LCD control pins LPC_GPIO3->DATA |= 0x007; // P3 port P3.0 to P3.3 set high delay_0802(300); write_com(0x38); delay_0802(100); write_com(0x38); delay_0802(100); write_com(0x38); delay_0802(100); write_com(0x0c); delay_0802(100); write_com(0x06); delay_0802(100); write_com(0x01); delay_0802(100); }
In the main.c file, the code is as follows:
/************************************************** * Name: LPC1114 drives LCD0802 1602 * Main frequency: 50Mhz (externally connected to 10MHz crystal oscillator, multiplied by 5 times) * Author: Ration (CEO of Ruisheng Electronics Network) * Date: December 5, 2013 (edited) * Copyright: Copyright belongs to, please keep integrity when disseminating * * For more programs, please visit: http://www.rationmcu.com *************************************************/ #include "lpc11xx.h" #include "lcd.h" uint8_t table1[8]=" Hello "; uint8_t table2[8]=" World "; void delay_ms(uint16_t ms) { uint16_t i,j; for(i=0;i<5000;i++) for(j=0;j
Previous article:lpc1114 set pin function
Next article:LPC1114 Deep power-down mode Deep power-down mode
- 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
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Here it comes! 6G tasks for the 14th Five-Year Plan
- [Jihai APM32E103VET6S MINI Development Board Review] Part 5: Software Triggering ADC
- Huawei FPGA Design Complete Collection
- DC-DC output capability
- Here comes a smart home device controller that supports synchronous wireless communication. Let’s discuss it.
- Designing low-power AC-DC power supplies with ultra-high power density
- Raspberry Pi Bluetooth Basics - Use of bluezero library
- "Recommended Chinese Chip" + JieFa AC781x ARM Chip
- 5 important attributes of EMC analysis
- Bandwidth Management System (BWM) for TI C64x+ DSPs