51 single-chip computer sixth---LCD LCD display module

Source: Internet
Author: User

I didn't see the LCD screen. Forget the money, buy a program first.

/******************************************************************************** Experiment Name: LCD1602 experiment * Use of IO:LCD use P0 * Experimental results: Display love* on the LCD screen Note: *******************************************************************************/#incl Ude <reg52.h> #include <intrins.h> #define gpio_led p2#define gpio_lcd p0#define gpio_key p1#define UINT unsigned int#define uchar unsigned charsbit lcde=p2^7;sbit rw=p2^5;sbit rs=p2^6;uchar code dig_code[17]={0x3f,0x06,0x5b , 0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};uchar my_code[]= "Love"; void Delay10ms (); void Lcdinit (); void lcdwritecom (Uchar com); void lcdwritedata (Uchar dat); void main () {Uchar I;    Lcdinit (); for (i=0;i<4;i++) Lcdwritedata (My_code[i]), while (1) {}}void delay10ms () {Uchar i=38,j=130; while (i--) while (j--);} void lcdwritecom (Uchar com)//read command {rs=0;rw=0; gpio_lcd=com; Lcde=1;delay10ms (); lcde=0;} void Lcdwritedata (Uchar dat)//read data {rs=1;rw=0; Gpio_lcd=dat; Lcde=1;delay10ms (); lcde=0;} void Lcdinit ()//Initialize {lcdwritecom (0x38); Lcdwritecom (0x0c); Lcdwritecom (0x06); Lcdwritecom (0x01); Lcdwritecom (0x80);}

51 single-chip computer sixth---LCD LCD display module

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.