虫虫首页|河北快3网投APP|资源专辑|河北快3网投APP|心愿单
m 登录|注册

52单片机开发板的实例程序

源代码在线查看: lcd12864.c

河北快3网投APP大小: 496 K 河北快3网投APP次数: 2
上传用户: myangcheng
关键词: 52单片机 开发板 实例程序
河北快3网投APP地址: 电信河北快3网投APP 网通河北快3网投APP 移动河北快3网投APP 联通河北快3网投APP VIP VIP

相关代码

					 #include
					#include
					#define uchar unsigned char
					#define uint unsigned int
					sbit rs=P1^0;
					sbit rw=P1^1;
					sbit en=P1^2;
					uchar code one[]="智天河北快3网投APP";
					uchar code two[]="52与AVR 实验板";
					uchar code three[]="单片机 C语言学习";
					uchar code four[]="从零开始快速入门 ";
					void delay(uint z)
					{
						uint x,y;
						for(x=z;x>0;x--)
						for(y=110;y>0;y--);
					}
					void write12864_command(uchar command)//写指令子函数
					{
					   rs=0;
					   rw=0;
					   P2=command;
					   delay(2);
					   en=1;
					   delay(3);
					   en=0;
					}
					void write12864_data(uchar date)//写数据子函数
					{
					   rs=1;
					   rw=0;
					   P2=date;
					   delay(2);
					   en=1;
					   delay(3);
					   en=0;
					}
					void init()
					{	
						en=0;
						rw=0;
						write12864_command(0x38);
						write12864_command(0x01);
						write12864_command(0x0c);
						write12864_command(0x06);
						write12864_command(0x80);
					}
					void main()
					{		uchar i,ge,shi,bai,temp=0;
							init();
					    write12864_command(0x80);
						for(i=0;one[i]!='\0';i++)
								{
									write12864_data(one[i]);
									delay(1);
								}
					write12864_command(0x90);
						for(i=0;two[i]!='\0';i++)
								{
									write12864_data(two[i]);
									delay(1);
								}
					write12864_command(0x88);
						for(i=0;three[i]!='\0';i++)
								{
									write12864_data(three[i]);
									delay(1);
								}
					write12864_command(0x98);
						for(i=0;four[i]!='\0';i++)
								{
									write12864_data(four[i]);
									delay(1);
								}
						    while(1)   
							{
					    	  bai=temp/100;
							  shi=temp%100/10;
							  ge=temp%10;
							  write12864_command(0x80+5);
							  write12864_data(0x30+bai);
							  write12864_data(0x30+shi);
							  write12864_data(0x30+ge); 
							  temp++;
							  if(temp>200)
							  temp=0;
							  delay(800);
							}
						
					}
									

相关资源