51 Learning notes to achieve 1602 and 8051 connections in bus mode

Source: Internet
Author: User
Tags clear screen

//8051 and 1602 communication in bus mode//the main implementation function of this program is to send a string of strings to 1602, and display it#include<reg52.h>#include<absacc.h>#defineUchar unsigned char#defineUINT unsigned int#defineLcdddata XBYTE[0XFFFF]//Read Data address#defineLcdxdata XBYTE[0XFDFF]//Write Data address#defineLcddcom Xbyte[0xfeff]//Read Command#defineLcdxcom XBYTE[0XFCFF]//Write CommandsUchar idata s_good[5]={'W','D','J','X',0x00};uchar idata s_good1[]={'2','0','1','6','-','0','7','-','2','2',0x00};sbit Bflag=acc^7;voidWaitvoid){     Do{acc=lcddcom;} while(bflag==1);}voidINIT_LCD (void) {lcdxcom=0x38;//Setup Modewait (); Lcdxcom=0x0f;//display switch and cursor settingswait (); Lcdxcom=0x06;//display switch and cursor settingswait (); Lcdxcom=0x01;//Clear Screenwait ();}voidD_char (Uchar a)//Write Data function{lcdxdata=A; Wait ();}voidDisplay (Uchar x, Uchar idata *s)//Display function The first variable is an address such as 0x80 or 0x80+0x40 the second is the data{Uchar I=0; Lcdxcom=x;    Wait ();  while(s[i]!=0x00) {D_char (s[i]); I++; }}    voidMainvoid) {INIT_LCD (); Display (0x80+0x01, S_good); Display (0x80+0x40, S_GOOD1);  while(1); }//Reprint please indicate the source

Associated Emulator Address:

Http://pan.baidu.com/s/1bGuyaa

51 Learning notes to achieve 1602 and 8051 connections in bus mode

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.