点阵式液晶显示屏的显示程序设计单片机原理及应用课程设计.doc
《点阵式液晶显示屏的显示程序设计单片机原理及应用课程设计.doc》由会员分享,可在线阅读,更多相关《点阵式液晶显示屏的显示程序设计单片机原理及应用课程设计.doc(24页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流点阵式液晶显示屏的显示程序设计单片机原理及应用课程设计.精品文档. 单片机原理及应用课程设计学院名称: 计算机学院 专业班级: 计算机1001 学生姓名: 秦 佳 学生学号: 3100602007 指导教师姓名: 赵念强 完成时间: 2013年7月5日 点阵式液晶显示屏的显示程序设计一、设计目的1熟练掌握C51系统仿真开发系统的应用。2加强单片机的综合运用能力、提高单片机的软件编程和调试能力,为以后的学习和开发工作打下良好基础。3掌握的液晶的工作原理以及应用设计。4掌握小系统开发设计的流程以及设计思路。二、设计方案1、实验要求:1)字符方式:
2、从下到上滚动显示:“江苏大学计算机学院”然后交替显示:“2013年单片机课程设计”“液晶点阵显示屏程序设计”“作者姓名、班级、学号” 2)图片方式:显示相应图片(有左、右移,上下卷等多种动态方式 )3) 模拟量采样值显示(温度、压力、电位)4) 其它功能不限,可自由发挥(时钟、秒表、计算器、菜单等),拓展要求2、设计思路:将程序分成四个模块:1.主函数模块main.c2.模数转换模块ADC.c 3.液晶显示模块KS0108.c4.测试模块test7279.c其中,在main.c中定义一个功能选择菜单图片,包含课设的简介,图片的变换,模拟量的采集以及计算器的实现,该菜单功能的切换由按键功能来实现
3、。在KS0108.c中定义了两张图片分别来简单介绍一下该课程设计,包含“江苏大学计算机学院、2013年单片机课程设计”和“秦佳、计算机1001、3100602007”;还定义了字符方式下的“液晶点阵显示屏程序设计”;定义了在ADC中要用到的0-9的数字以及计算器中要用到的各种运算符。在其中还定义了上移、下移、左移和右移函数以及计算器实现的函数。在ADC.c中定义了字符形式的“温度压力电位”以及将模拟量转换成数字量的showadc函数。各函数说明三、 程序流程图:a、 系统主流程图b、 主函数流程图初始化各部件c、 显示模块流程图d、 模数转换模块流程图开中断开始显示菜单主函数模块判断键入值并调
4、用相应函数b液晶显示模块模数转换模块a开始判断KS0108是否空闲读取No和模拟量向LCD发送控制命令No=3No=2No=1定义各类显示函数返回压力返回电位返回温度定义初始化LCD函数结束d定义各类图像变换函数以及字符显示函数cd四、 主要的源程序及注释1、main.c#include c8051f020.h #include void Delay1us(unsigned char us)while (us) _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); -us;void SYSCLK_Init (void) int i; / delay coun
5、ter OSCXCN = 0x67; / start external oscillator with / 18.432MHz crystal for (i=0; i 256; i+) ; / Wait for osc. to start up while (!(OSCXCN & 0x80) ; / Wait for crystal osc. to settle OSCICN = 0x88; / select external oscillator as SYSCLK / source and enable missing clock / detector/OSCICN = 0x07; /in
6、teral 16MHZ#define PRT0CF P0MDOUT#define PRT1CF P1MDOUT#define PRT2CF P2MDOUTvoid PORT_Init (void) XBR0 = 0x07; / Enable SMBus, SPI0, and UART0 XBR1 = 0x00; XBR2 = 0x44; / Enable crossbar and weak pull-ups EMI0CF = 0x27; EMI0TC = 0x21; P74OUT = 0xFF; P0MDOUT = 0x15; P1MDOUT |= 0x3C; /P1.2-P1.5推挽输出 P
7、1 &= 0xc3;/P1.2-P1.5=0void SPI0_Init (void) SPI0CFG = 0x07; / data sampled on 1st SCK rising edge / 8-bit data words SPI0CFG|=0xC0;/CKPOL =1; SPI0CN = 0x03; / Master mode; SPI enabled; flags / cleared SPI0CKR = SYSCLK/2/8000000-1; / SPI clock 8; / set Timer0 to overflow in 1ms TL0 = -SYSCLK/1000; TR
8、0 = 1; / START Timer0 IE|= 0x2; void Timer0_ISR (void) interrupt 1 /1msTH0 = (-SYSCLK/1000) 8; TL0 = -SYSCLK/1000;if (Count1ms) Count1ms-;void Delay1ms(unsigned char T)Count1ms=T;while (Count1ms);void Delay1s(unsigned char T)while (T)Delay1ms(200);Delay1ms(200);Delay1ms(200);Delay1ms(200);Delay1ms(2
9、00);T-;char GetKeyValue(void);void Show(void);void Show1(void);void showadc();void caculater();void DispBmp(char *buf);void InitLCD(void);void WaitKeyOff(void);char code screen=/功能选择0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0
10、0,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0x40,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,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,0x0
11、0,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,0x41,0x7F,0x7F,0x40,0x00,0x00,0x30,0x70,0x60,0x4
12、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xFF,0xFF,0x7F,0x7F,0x7F,0xFB,0xFF,0xFE,0x00,0x00,0x10,0x18,0xDC,0xEE,0x7F,0x1B,0xFD,0xFF,0x06,0x0C,0x0C,0x08,0x08,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,0x0
13、0,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,0x20,0x30,0x1
14、0,0xF0,0xF0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0,0xF0,0xF0,0x70,0xF1,0xF1,0xF0,0x00,0x00,0x00,0x00,0xF0,0xF0,0xE0,0x79,0x79,0x58,0x40,0x00,0x00,0x00,0x00,0xA0,0xA0,0xE0,0xF8,0xF8,0xF0,0xD0,0xD0,0x90,0x00,0x00,0x80,0xC0,0xF8,0xF0,0xC0,0xF0,0xF0,0xF
15、0,0xA0,0xA0,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,0x0
16、0,0x00,0x00,0x00,0x00,0x00,0x0C,0x0E,0x0F,0x0B,0x0C,0x0C,0x00,0x06,0x0E,0x0C,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1F,0x0F,0x0F,0x0F,0x0F,0x09,0x3F,0x3F,0x1F,0x00,0x00,0x10,0x18,0x0F,0x07,0x03,0x01,0x3F,0x3F,0x00,0x00,0x00,0x00,0x10,0x11,0x13,0x1E,0x0F,0x0F,0x1F,0x11,0x10,0x10,0x10,0x0
17、4,0x04,0x16,0x1F,0x1F,0x17,0x1F,0x0F,0x1F,0x13,0x12,0x12,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,0x0
18、0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x26,0x32,0x3E,0xFE,0xE0,0x00,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0xE8,0xFF,0xFF,0xAC,0xBE,0xFE,0xFF,0xFF,0x7B,0x4A,0x40,0x80,0x90,0xD8,0xFF,0xFE,0xF8,0xF4,0x6C,0xEC,0xFC,0xBC,0x00,0x00,0x10,0x10,0x32,0xF
19、E,0xFE,0xFE,0xFE,0xFE,0x1A,0x08,0x08,0x00,0x00,0x20,0xAC,0xEE,0xFE,0xFF,0xFF,0xB7,0x92,0x00,0x00,0x00,0x90,0xF1,0xFF,0xFE,0xFA,0xF6,0xFE,0xFF,0x6B,0x4A,0x40,0x40,0x60,0xF8,0xFE,0x06,0xFA,0xFC,0xFE,0xF6,0xF4,0x04,0x00,0x00,0x00,0x42,0xCE,0xFE,0xFE,0xFE,0xFE,0xFE,0x66,0x20,0x00,0x00,0x20,0xA0,0xE4,0x6
20、4,0xF4,0xF6,0xD2,0xD2,0xD0,0x90,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x81,0xC1,0xC1,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xE3,0xE2,0x03,0x83,0x81,0x83,0xC3,0xC2,0x02,0x00,0x00,0xC3,0xC3,0xC3,0xE1,0xE3,0xE3,0x2
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 阵式 液晶显示屏 显示 程序设计 单片机 原理 应用 课程设计
限制150内