悉数源代码下载:http://www.51hei.com/f/128yhj.rar
#include"reg51.h"sbit cd = P2^0;unsigned char pdata *addr;#define uchar unsigned char#define uint unsigned shortvoid lcd_writecom_two(uchar onedat,uchar twodat,uchar com);void lcd_writedat_onebyte(uchar onedat,uchar com);uchar lcd_readdat_onebyte(uchar com);void lcd_writedat_nbyte(uchar *dat,uchar len);void lcd_readdat_nbyte(uchar *dat ,uchar len);void clear_point(uchar x,uchar y);void sel_point(uchar x,uchar y);void sel_rmiddling(uchar x,uchar y);void clr_rmiddling(uchar x,uchar y);void sel_rbig(uchar x,uchar y);void clr_rbig(uchar x,uchar y);void graph_mode_writeword(uchar x,uchar y,uchar *dat);void graph_mode_write_letter(uchar x,uchar y,uchar *dat);void rhorizontal(uchar x0,uchar x1,uchar y);void erect(uchar y0,uchar y1,uchar x);void Draw_line(uchar x0,uchar y0,uchar x1,uchar y1);void draw_circle(int x, int y, int r);void lcd_init();/**********************************读取lcd状况**********************************/uchar lcd_readcom(){uchar temp;cd=1;addr = 0xff;temp = *addr;return temp;}/*********************************判别指令/数据读写繁忙状况*********************************/void check_busy(){uchar temp;do{temp=lcd_readcom();}while((temp&0x03)!=0x03);}/*********************************判别数据主动写繁忙状况*********************************/void check_auto_write_busy(){uchar temp;do{temp=lcd_readcom();}while((temp&0x08)!=0x08);}/*********************************判别数据主动读繁忙状况*********************************/void check_auto_read_busy(){uchar temp;do{temp=lcd_readcom();}while((temp&0x04)!=0x04);}/*********************************向lcd写指令*********************************/void lcd_writecom(uchar dat){check_busy();cd=1;*addr = dat;}/************************************向lcd写数据************************************/void lcd_writedat(uchar dat){check_busy();cd=0;*addr = dat;}/********************************从lcd读数据*********************************/uchar lcd_readdat(){uchar temp;cd=0;addr = 0xff;temp = *addr;return temp;}