版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、本智能停车场管理系统之车位引导具有以下功能:(基于51单片机)u 车位自动引导功能(12864显示屏和点阵屏的使用)总控制器和区域控制器会实时的统计停车场总的停车位和每一个区域的停车位空闲状态,然后通过显示屏显示出来,所以车主在驶入停车场的整个过程中都可以得到指引,顺利的找到一条最方便快接的路径,把车子驶入车位。u 车位自动统计功能(红外线和超声波传感器的使用)每一个车位上方都有一个超声波探测器,他能够实时的监测车位上车子的状况,并且将这些状况通过双交线传输到系统的控制器里面,控制器具有数据运算功能,通过运算就可以知道整个车库的使用状况,然后通过车位显示屏显示出整个停车场有多少空车位,每一个停
2、车区域有多少空车位。此代码大多都有文字说明,排序合理,有少少基础的一看就能懂的。附录:源代码/*/* name: 智能停车场管理系统之车位引导 b*/* #include <reg52.h>#include <intrins.h>#define uchar unsigned char#define uint unsigned int/引脚定义 sbit rx = p3 3;/超声波模块ech0 sbit tx = p3 4;/超声波模块trigsbit cs = p3 5;/12864片选 高电平有效 sbit sid = p3 6;/12864数据 sbit sclk
3、 = p3 7;/12864时钟sbit h_1=p10; /定义红外传感器的输入端口sbit h_2=p11; sbit h_3=p12; sbit h_4=p13; sbit h_5=p14; sbit h_6=p15; sbit h_7=p16; sbit h_8=p17;sbit h_9=p30; #define dataout p2/指定p2口做为点阵屏输出/*/*16*16点阵屏的显示*/*/sbit data=dataout0;/列数据输出位sbit sclh=dataout1;/列扫描时钟位sbit sclt=dataout2;/列数据锁存位sbit ab=dataout4;/
4、行数据输出位sbit sck=dataout5;/行扫描时钟位unsigned char lhj32;/32字节ram做为16*16点阵屏显示缓存void display();/做为点阵扫描函数,将显示缓存的数据输出到点阵屏void displays(unsigned int timer);/指定时间扫描显示void displaymove(unsigned char *lp,unsigned char c,unsigned char timer);/显示汉字内容的移动效果,lp指向要显示第一个字的首地址,c表示显示字的个数,/timer是移动的速度void displaymovetb(uns
5、igned char din,unsigned char *lp,unsigned char timer);/上下移动内容,din:1为向下,0为向上,lp指向要移入的内容,timer为移动速度code unsigned char huan32=/*"欢"*/ 0x12,0x10,0x7f,0x90,0x12,0x10,0x73,0x90, 0x52,0xbe,0x73,0xa2,0x14,0x24,0x22,0x50, 0x7f,0x90,0xa4,0x10,0x3f,0x10,0x24,0x28, 0x3f,0x28,0x24,0x24,0x3f,0xc4,0x20,0
6、x82, ;code unsigned char ying32=/*"迎"*/ 0x00,0x00,0x41,0x84,0x26,0x7e,0x14,0x44, 0x04,0x44,0x04,0x44,0xf4,0x44,0x14,0xc4, 0x15,0x44,0x16,0x54,0x14,0x48,0x10,0x40, 0x10,0x40,0x28,0x40,0x47,0xfe,0x00,0x00, ;code unsigned char guang32=/*"光*/ 0x01,0x00,0x21,0x08,0x11,0x0c,0x09,0x10, 0x09,
7、0x20,0x01,0x04,0xff,0xfe,0x04,0x40, 0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x40, 0x08,0x42,0x10,0x42,0x20,0x3e,0x40,0x00, ;code unsigned char lin32=/*"临"*/ 0x00,0x40,0x7e,0x40,0x48,0x7e,0x48,0x80, 0x49,0x7c,0x7e,0x44,0x42,0x44,0x42,0x44, 0x42,0x7c,0x7e,0x00,0x48,0xee,0x48,0xaa, 0x48,0xaa,0x48,
8、0xaa,0x7f,0xee,0x00,0x88, ;code unsigned char che32=/*"车"*/ 0x01,0x00,0x01,0x00,0x01,0x10,0x3f,0xf8, 0x01,0x00,0x1f,0xf0,0x11,0x10,0x1f,0xf0, 0x11,0x10,0x1f,0xf0,0x01,0x04,0xff,0xfe, 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00, ;code unsigned char wei32=/*"位"*/ 0x08,0x80,0x08,0x40,0x
9、08,0x40,0x10,0x08, 0x17,0xfc,0x30,0x00,0x52,0x08,0x92,0x08, 0x11,0x10,0x11,0x10,0x10,0x90,0x10,0xa0, 0x10,0x24,0x1f,0xfe,0x10,0x00,0x10,0x00, ;code unsigned char yi32=/*"已*/ 0x00,0x10,0x7f,0xf8,0x00,0x10,0x00,0x10, 0x20,0x10,0x20,0x10,0x3f,0xf0,0x20,0x10, 0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x04
10、, 0x20,0x04,0x20,0x04,0x1f,0xfc,0x00,0x00, ;code unsigned char man32=/*"满"*/ 0x41,0x20,0x31,0x24,0x1f,0xfe,0x01,0x20, 0x80,0x00,0x6f,0xfc,0x20,0x80,0x00,0x80, 0x1f,0xfc,0x28,0x84,0xec,0xc4,0x2a,0xa4, 0x2d,0xd4,0x28,0x8c,0x28,0x94,0x28,0x08, ;code unsigned char tanhao32=/*"!*/ 0x00,0x0
11、0,0x01,0x80,0x03,0xc0,0x03,0xc0, 0x03,0xc0,0x03,0xc0,0x03,0xc0,0x01,0x80, 0x01,0x80,0x01,0x80,0x00,0x00,0x01,0x80, 0x03,0xc0,0x01,0x80,0x00,0x00,0x00,0x00, ;code unsigned char left32=/*"左箭头"*/ 0x03,0xc0,0x07,0x80,0x0f,0x00,0x1e,0x00, 0x3c,0x00,0x78,0x00,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,
12、0xff,0x78,0x00,0x3c,0x00, 0x1e,0x00,0x0f,0x00,0x07,0x80,0x03,0xc0, ;code unsigned char up32=/*"上箭头*/ 0x03,0xc0,0x07,0xe0,0x0f,0xf0,0x1f,0xf8, 0x3f,0xfc,0x7b,0xde,0xf3,0xcf,0xe3,0xc7, 0xc3,0xc3,0x83,0xc1,0x03,0xc0,0x03,0xc0, 0x03,0xc0,0x03,0xc0,0x03,0xc0,0x03,0xc0, ;code unsigned char right32=/*
13、"右箭头"*/ 0x03,0xc0,0x01,0xe0,0x00,0xf0,0x00,0x78, 0x00,0x3c,0x00,0x1e,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x00,0x1e,0x00,0x3c, 0x00,0x78,0x00,0xf0,0x01,0xe0,0x03,0xc0 ;/* 名称 : display()* 功能 : 点阵屏显示* 输入 : 无 * 输出 : 无*/void display()/显示unsigned char i,ia,j,tmp;/定义变量dataout=0xff;/置位高电平做准备a
14、b=0;/将行数据位清0,准备移位for(i=0;i<16;i+)/循环输出16行数据sck=0;/为行移位做准备sclt=0;/为列锁存做准备for(ia=2;ia>0;)/每行16个点,循环位移两个字节ia-;/循环两次tmp=lhji*2+ia;/读取点阵数据做输出,这里用到ia目的是先读取点阵数据的第二位字节,因一行16个点由两个字节组成,/电路中的移位寄存器最后一位对应最后一列,所以要先输出一行中的第二个字节数据for(j=0;j<8;j+)/循环两次,每次移一个字节,sclh=0;/为列移位做准备 data=tmp&0x01; /将数据低位做输出,由电路图
15、可知,移位寄存器的最后一位对应最后一列,因此先移最后一位tmp>>=1; /将数据缓冲右移一位,为下次输出做准备 sclh=1;/将data上的数据移入寄存器/移入单字节结束/移入两个字节结束dataout|=0x24;/此句可以用以下两句来理解,如果不将两句合为一句,将出现拖影现像/sck=1;/sck拉高,行数据移位,相应行拉低,三极管导通输出电量到相应行点阵管阳极(共阳)/sclt=1;/sclt拉高,将数据锁存输出到相应列的点阵发光管显示,显示一行后将保持到下一行显示开始ab=1;/行数据位只在第一行时为0,其它时候都为1,当将这个0移入寄存器后,从第一位开始一直移位最后一
16、位,/移位的过程,ab就必需是1,这是因为不能同时有两个及两个以上0的出现,否则显示出乱j=64;while(j-);/每一行的显示,保持了两字节的移位时间,因此,最后一行的显示,也要加入保持时间,补尝显示的亮度sck=0;/sck=1;/将最后一行数据移出/* 名称 : displays()* 功能 : 指定时间扫描显示* 输入 : 指定时间unsigned int timer * 输出 : 无*/void displays(unsigned int timer)/指定时间扫描显示unsigned char i;while(timer-)/当timer=1时,大约1秒时间i=130;whil
17、e(i-)display();/* 名称 : displaymove()* 功能 : 显示汉字内容的移动效果* 输入 : lp指向要显示第一个字的首地址,c表示显示字的个数,timer是移动的速度* 输出 : 无*/void displaymove(unsigned char *lp,unsigned char c,unsigned char timer)unsigned char i=0,j=0,ia=0;unsigned int tmp=0,timerc=0;unsigned char tmp216;c*=2;/因一个汉字由32字节组成,而移位显示,要分开半个汉字16字节处理,因此将这里乘
18、以2for(i=0;i<16;i+)tmp21=0;/将缓冲区清0,while(c)/循环处理if(lp!=0)/当lp指向的地址为0时,直接用组缓冲0补上,效果是将当前显示的内容移出tmp=c%2;/取余,目的是为了判断处理汉字的前半部份还是后半部份for(i=0;i<16;i+)tmp2i=lpi*2+tmp;/取半个汉字点阵数据,16字节if(tmp)/当tmp为1时,表时一个字数组处理完成,将地址转到下一个字lp+=32;/-tmp=8;/变量再次利用while(tmp)/循环8次,是将下一个字的前半部份的字节数据移入显示缓冲ia=0;/做为点阵数组的元素for(i=0;i
19、<16;i+)/移动是16行同时移,因此要处理16个字节lhjia<<=1;/移当前显示缓冲的前半行字节if(lhjia+1&0x80)/判断后半行字节的高位是否为1,是移入前半行字节低位,否则不处理lhjia+;ia+;lhjia<<=1;/移当前显示缓冲的后半行字节if(tmp2i&0x80)/判断下一个要显示汉字的前半行字节的高位是否为1,是移入,否则不处理lhjia+;ia+;tmp2i<<=1;/下一个要显示汉字的半行字节向高位移一位,准备下一次取位tmp-;timerc=timer;/处理完16行,调用显示函数更新点阵whi
20、le(timerc-)/循环做为处理的速度,即移动的速度display();/-c-;/移完一半,进入下一半或下一个汉字,直到结束/* 名称 : displaymovetb()* 功能 : 显示汉字内容的上下移动效果* 输入 : din:1为向下,0为向上,lp指向要移入的内容,timer为移动速度* 输出 : 无*/void displaymovetb(unsigned char din,unsigned char *lp,unsigned char timer)unsigned char i=0,j=0,ia=0;unsigned int tmp=0,timerc=0;if(din)/判断
21、移动方向,向下ia=32;/要移入第一个汉字的数组元素i=16;/行索引while(i-)/逐行处理j=30;while(j)j-;lhjj+2=lhjj;/将上一行的内容复制到下一行,每两行内容相隔四个字节,复制15行if(lp=0)/最后一行的处理,判断移入的内容是否为空,是用0移入lhj0=0;lhj1=0;else/否则,取字数组处理ia-;lhj1=lpia;ia-;lhj0=lpia;timerc=timer;/处理完16行,调用显示函数更新点阵while(timerc-)/循环做为处理的速度,即移动的速度display();else/移动方向,向上ia=0;/向上移动,移入汉字从
22、低位开始for(i=0;i<16;i+)/处理16行for(j=0;j<30;j+)/将下一行的内容复制到上一行,每两行内容相隔四个字节,复制15行lhjj=lhjj+2;if(lp=0)/最后一行的处理,判断移入的内容是否为空,是用0移入lhj30=0;lhj31=0;else/否则,取字数组处理lhj30=lpia;lhj31=lpia+1;ia+=2; timerc=timer;/处理完16行,调用显示函数更新点阵while(timerc-)/循环做为处理的速度,即移动的速度display(); void toup()/显示向上箭头unsigned char i=0;for(
23、i=0;i<32;i+)lhji=upi;/将"上箭头"字数据复制到显示缓存displays(3);/显示图案约2秒void toleft()/显示向左箭头unsigned char i=0;for(i=0;i<32;i+)lhji=lefti;/将"左箭头"字数据复制到显示缓存displays(3);/显示图案约2秒void toright()/显示向右箭头unsigned char i=0;for(i=0;i<32;i+)lhji=righti;/将"右箭头"字数据复制到显示缓存displays(3);/显示图案
24、约2秒/*/*12864屏的显示*/*/void write_char(bit start, unsigned char ddata); /写指令或数据void send_byte(unsigned char bbyte); /发送一个字节void delaynms(unsigned int di); /延时 n x10usvoid lcd_init(void);/初始化lcdvoid disp_img(unsigned char *img); /显示图像void lcd_write_string(unsigned char x,unsigned char y,unsigned char *s
25、);/中英文字符串显示函数void lcd_set_xy( unsigned char x, unsigned char y );/设置lcd显示的起始位置,x为行,y为列unsigned char code num="0123456789 :.-"unsigned int time=0; long s=0;unsigned char disbuff4 = 0,0,0,0,;unsigned char code logo= /*- 调入了一幅图像:笑脸,有间停车场 - */ /*- 宽度x高度=128x64 /*- 调入了一幅图像*/*- 宽度x高度=128x64 -*/0
26、x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
27、x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xff,0xf7,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xe8,0x00,0x00,0
28、x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xf4,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x0f,0xff,0xd0,0xff,0xfe,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xe7,0xff,0x00,0x00,0x3f,0xfc,0x00,0x0f,0xfe,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf7,0xff,0x00,0x00,0x3f,0xe0,0x00,0
29、x05,0xfe,0x00,0x00,0x3f,0xff,0xf8,0x00,0x00,0x70,0x07,0x00,0x00,0xff,0xc0,0x00,0x00,0xff,0xc0,0x00,0x3f,0xff,0xf8,0x00,0x03,0x80,0x07,0x00,0x00,0x7f,0x00,0x00,0x00,0xff,0xe0,0x00,0x01,0xe0,0x00,0x00,0x03,0xbf,0xf7,0x00,0x03,0xff,0x00,0x00,0x00,0x3f,0xe0,0x00,0x03,0xff,0xe0,0x00,0x03,0xbf,0xf7,0x00,0
30、x03,0xff,0x00,0x00,0x00,0x37,0xf0,0x00,0x03,0xff,0xe0,0x00,0x03,0xbf,0xf7,0x00,0x03,0xf0,0x00,0x00,0x00,0x03,0xf8,0x00,0x0f,0xff,0xe0,0x00,0x03,0xb8,0x77,0x00,0x0f,0xf0,0x00,0x00,0x00,0x03,0xfc,0x00,0x0f,0x80,0xe0,0x00,0x03,0xbf,0xf7,0x00,0x0f,0xe0,0x12,0x00,0x00,0x01,0xfe,0x00,0x1f,0xff,0xe0,0x00,0
31、x03,0xbf,0xf7,0x00,0x1f,0xc0,0x3e,0x00,0x1f,0x00,0xfc,0x00,0x7f,0xff,0xe0,0x00,0x03,0xbf,0xf7,0x00,0x1f,0xc0,0x7f,0x40,0x3f,0x80,0xff,0x00,0x7f,0xc0,0xe0,0x00,0x03,0xb8,0x77,0x00,0x1f,0x80,0xff,0x80,0x7f,0xc0,0xfc,0x00,0x33,0xff,0xe0,0x00,0x03,0xb8,0x77,0x00,0x3f,0x00,0xff,0x80,0x7f,0xc0,0x7f,0x00,0
32、x03,0xff,0xe0,0x00,0x03,0xbf,0xf7,0x00,0x3f,0x00,0xff,0x80,0x7f,0xc0,0x7f,0x00,0x03,0xff,0xe0,0x00,0x03,0xbf,0xf7,0x00,0x3f,0x00,0xff,0x80,0x7f,0xc0,0x3f,0x80,0x03,0x80,0xe0,0x00,0x03,0x80,0x07,0x00,0x3f,0x00,0xff,0x80,0x7f,0xc0,0x1f,0x80,0x03,0x87,0xe0,0x00,0x03,0x80,0x3f,0x00,0x3f,0x00,0x7f,0x00,0
33、x7f,0x80,0x3f,0x80,0x03,0x83,0xe0,0x00,0x03,0x80,0x1f,0x00,0x3e,0x00,0x3f,0x00,0x1f,0x00,0x1f,0x80,0x03,0x83,0xc0,0x00,0x03,0x80,0x1e,0x00,0x7e,0x00,0x0a,0x00,0x04,0x00,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
34、x7d,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x00,0x60,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x01,0x80,0x00,0x00,0x70,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x03,0xc0,0x00,0x00,0xf0,0x1f,0x80,0x00,0x00,0x00,0x00,0
35、x00,0x00,0x00,0x00,0x7e,0x03,0xe0,0x00,0x00,0xf0,0x0f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x03,0xe0,0x00,0x00,0xf0,0x2f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x03,0xe0,0x00,0x01,0xf0,0x3f,0x8e,0x0e,0x00,0x00,0x70,0x00,0x07,0x00,0x00,0x3e,0x03,0xe0,0x00,0x01,0xf0,0x3f,0x8e,0
36、x0e,0x00,0x00,0x70,0x00,0x07,0x3f,0xf0,0x7e,0x03,0xe0,0x00,0x01,0xf0,0x3f,0x8f,0xff,0xf8,0x00,0xf0,0x00,0x07,0x3f,0xf8,0x7e,0x03,0xf8,0x00,0x03,0xf0,0x1f,0x1d,0xff,0xf8,0x3f,0xff,0xe0,0x07,0x01,0xe0,0x1f,0x01,0xf0,0x00,0x07,0xe0,0x7f,0x3c,0xff,0xe0,0x3f,0xff,0xe0,0x07,0x07,0xc0,0x3f,0x81,0xfc,0x00,0
37、x07,0xe0,0x3e,0x7c,0xff,0xe0,0x03,0xf8,0x00,0x07,0x0f,0x80,0x3f,0x80,0xfc,0x00,0x0f,0xc0,0xfe,0x7c,0xf1,0xe0,0x07,0xb8,0x00,0x3f,0xdf,0x00,0x1f,0x80,0xfe,0x00,0x1f,0xc0,0xfc,0x7c,0xff,0xe0,0x0f,0x38,0x00,0x3f,0xff,0xfc,0x0f,0xc0,0x7f,0x80,0x7f,0x80,0xfe,0x7c,0xff,0xe0,0x1f,0x38,0x00,0x07,0x3f,0xfc,0
38、x0f,0xe0,0x3f,0xff,0xff,0x03,0xfc,0x6f,0xff,0xf8,0x1f,0xff,0xe0,0x07,0x3e,0xdc,0x07,0xe0,0x1f,0xff,0xfe,0x01,0xfe,0x0f,0xff,0xf8,0x1f,0xff,0xe0,0x07,0x0e,0xdc,0x07,0xf0,0x07,0xff,0xfc,0x07,0xfc,0x0f,0x00,0x18,0x00,0x38,0x00,0x07,0x1e,0xdc,0x03,0xf8,0x03,0xff,0xf8,0x0f,0xf0,0x0f,0x7f,0xd8,0x00,0x38,0
39、x00,0x07,0xfc,0xdc,0x03,0xfc,0x00,0xff,0xc0,0x1f,0xf0,0x0f,0x7f,0xd8,0x7f,0xff,0xf8,0x0f,0xf9,0xdc,0x00,0xff,0x80,0x00,0x00,0x3f,0xe0,0x0c,0x06,0x00,0x7f,0xff,0xf8,0x3f,0xfb,0x9c,0x00,0x7f,0xc0,0x00,0x00,0xff,0xc0,0x0c,0x06,0x00,0x7f,0xff,0xf8,0x3f,0xf7,0x1c,0x00,0x3f,0xf0,0x00,0x01,0xff,0x40,0x0c,0
40、x06,0x00,0x00,0x38,0x00,0x3f,0xff,0x3c,0x00,0x1f,0xfa,0x00,0x07,0xff,0x80,0x0c,0x3e,0x00,0x00,0x38,0x00,0x00,0x3e,0xf8,0x00,0x0f,0xff,0xc2,0xff,0xfd,0x00,0x0c,0x1e,0x00,0x00,0x38,0x00,0x00,0x3c,0xf0,0x00,0x07,0xff,0xff,0xff,0xf0,0x00,0x0c,0x1e,0x00,0x00,0x38,0x00,0x00,0x18,0x60,0x00,0x00,0xff,0xff,0
41、xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xfd,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcf,0xd0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
42、x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
43、x00,0x00,0x00,0x00,;/* 名称 : lcd_init()* 功能 : 初始化lcd* 输入 : 无* 输出 : 无*/void lcd_init(void)delaynms(10); /启动等待,等lcm讲入工作状态 cs=1; write_char(0,0x30); /8 位介面,基本指令集 write_char(0,0x0c); /显示打开,光标关,反白关/* 名称 : write_char()* 功能 : 对液晶屏写指令或数据* 输入 : bit start, unsigned char ddata* 输出 : 无*/void write_char(bit start
44、, unsigned char ddata)unsigned char start_data,hdata,ldata; if(start=0) start_data=0xf8; /写指令 else start_data=0xfa; /写数据 hdata=ddata&0xf0; /取高四位 ldata=(ddata<<4)&0xf0; /取低四位 send_byte(start_data); /发送起始信号 delaynms(5); /延时是必须的 send_byte(hdata); /发送高四位 delaynms(1); /延时是必须的 send_byte(ldat
45、a); /发送低四位 delaynms(1); /延时是必须的/* 名称 : send_byte()* 功能 : 向液晶屏发送一个字节* 输入 : unsigned char bbyte* 输出 : 无*/void send_byte(unsigned char bbyte) unsigned char i; for(i=0;i<8;i+) sid=bbyte&0x80; /取出最高位 sclk=1; sclk=0; bbyte<<=1; /左移 /* 名称 : delaynms()* 功能 : 点阵屏专用的延时函数* 输入 : unsigned int di* 输出 : 无*/void delaynms(unsigned int di) unsigned int da,db; for(da=0;da<
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年度云南省高校教师资格证之高等教育心理学综合练习试卷B卷附答案
- 低空经济公司组建方案
- 阜阳师范大学《证券投资学》2023-2024学年第一学期期末试卷
- 阜阳师范大学《团体操创编与表演》2023-2024学年第一学期期末试卷
- 苏教版小学《科学》五年级下册教学设计
- 人教版九年级体育教案
- 福建师范大学《证据法》2021-2022学年第一学期期末试卷
- 2024年二建法规-考前铂金AB卷
- 2024年二级建造师公路-考点押题
- 福建师范大学《数学分析(Ⅲ)》2023-2024学年第一学期期末试卷
- 古琴教学精品课件ppt
- 《走进爱国主义教育基地》ppt
- 自考《学前教育研究方法》全套课件(完整版)
- 无痛宫腔镜检查日间手术临床路径及表单
- 企业、事业专职消防队训练内容及操作规程
- 中考课外古诗词鉴赏
- 语言行为法简介(课堂PPT)
- 完形填空20篇(附答案解析)
- GB_T5235-2021 加工镍及镍合金牌号和化学成分(高清最新版)
- 【课件】高一上学期英语人教版(2019)必修第一册Unit 2 Grammar 现在进行时-
- 甲骨文软件操作手册4操作手册
评论
0/150
提交评论