欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    毕业设计点阵式液晶显示屏的显示程序设计单片机课程设计报告.doc

    • 资源ID:91597737       资源大小:168KB        全文页数:32页
    • 资源格式: DOC        下载积分:9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    毕业设计点阵式液晶显示屏的显示程序设计单片机课程设计报告.doc

    J I A N G S U U N I V E R S I T Y单片机原理及应用课程设计学院名称: 计算机科学与通信工程 专业班级: 通信1002 学生姓名: 马彩霞 学生学号: 3100601033 指导教师姓名: 赵念强 2013年 1 月点阵式液晶显示屏的显示程序设计一、设计目的1熟练掌握C51系统仿真开发系统的应用。2加强单片机的综合运用能力、提高单片机的软件编程和调试能力,为以后的学习和开发工作打下良好基础。3掌握的液晶的工作原理以及应用设计。4掌握小系统开发设计的流程以及设计思路。二、设计方案 实验要求:1)从下到上左到右滚动显示:自己设计的图片 2)能进行正常的模拟量采样值显示(温度、压力、电位) 。3)未按键时菜单要可以停下来 设计思路:由于实验指导书中做过液晶显示和模数转换得实验,根据两个实验的功能实现和流程原理进行设计将程序分成四个模块:主函数模块main.c模数转换模块ADC.c液晶显示模块KS0108.c按键调试模块Test7179.c其中让主函数模块做一些初始化和函数调用工作,模数转换模块主要是将温度,压力,点位的值转化为数字量供液晶显示用,液晶显示模块得到模数转换模块传递过来的数字量显示到液晶面板上,按键调试模块是输入按键显示温度,电压,压力等。程序流程图:1系统主流程图如下开始主函数模块显示模块模数转换模块2主函数流程图开始使能比较器1开中断初始化系统时钟钟初始化定时器0初始化IO端口初始化SPI0使能片内参考电压使能DAC3 显示模块流程图开始初始化LCD滚屏显示江苏大学计算机学院读取数字量并显示调用模数转换得到值显示课程设计题目、班级、姓名健值是否1.2.34 模数转换模块流程图开始读取No和模拟量返回温度返回点位结束返回压力No=2?No=3?No=1? 主要的源程序及注释主函数:#include "c8051f020.h" #include <intrins.h> void Delay1us(unsigned char us) while (us) _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); -us; void SYSCLK_Init (void) int i; / delay counter 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; file:/interal 16MHZ #define PRT0CF P0MDOUT #define PRT1CF P1MDOUT #define PRT2CF P2MDOUT void 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推挽输出 P1 &= 0xc3; /P1.2-P1.5=0 void 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 <= 8MHz (limited by / EEPROM spec.) unsigned char Count1ms; void Timer0_Init (void) CKCON|=0x8; TMOD|=0x1; /16Bit Count1ms=10; TR0 = 0; / STOP Timer0 TH0 = (-SYSCLK/1000) >> 8; / set Timer0 to overflow in 1ms TL0 = -SYSCLK/1000; TR0 = 1; / START Timer0 IE|= 0x2; void Timer0_ISR (void) interrupt 1 /1ms TH0 = (-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(200); T-; char GetKeyValue(void); void init_adc(void); unsigned int GetADCValue(char No); void TestLCD(void); void DispLCD(char *DispBuf,char num); void InitLCD(void); /初始化¯LCD void ShowWenDu(void); void Test7279(bit LoopFlag) ;void main (void) unsigned int w; char No,i,buf5; No=1; WDTCN = 0xde; WDTCN = 0xad; /关看门狗 SYSCLK_Init (); / 初始化时钟Timer0_Init();/初始化定时器 PORT_Init (); /初始化IO口 SPI0_Init (); /初始化SPI0 init_adc(); CPT1CN|=0x80; /使能比较器1 REF0CN = 0x07; /使能片内参考电压 DAC0CN |= 0x80; /使能DAC0 DAC0H=0; DAC0L=0; EA=1; /开中断/Test7279(0); loop: Test7279(0) ;/关闭数码关显示 TestLCD(); InitLCD(); No=0; /w = GetADCValue(1); for (;) i=GetKeyValue(); if (i>=0)&&(i<=3) No=i; switch(No) case 1: ShowWenDu();break; case 2: ShowDianYa();break; case 3: ShowYaLi();break; case 0:goto loop;break; default: break; w = GetADCValue(No); Delay1ms(30); switch(No) case 1: buf0=(w%10000)/1000; buf1=(w%1000)/100; buf2=' ' buf3=(w%100)/10; buf4=(w%10); DispLCD(buf,1); showdu(); break; case 2: buf0=(w%10000)/1000; buf1=(w%1000)/100; buf2=' ' buf3=(w%100)/10; buf4=(w%10); DispLCD(buf,2); showfu(); break; case 3: buf0=(w%10000)/1000; buf1=(w%1000)/100; buf2=' ' buf3=(w%100)/10; buf4=(w%10); DispLCD(buf,3); showniu(); break; default: break; 模数转换#include "c8051F020.h" #include <intrins.h> /* 压力应变片ADC实验*/ #define MUX_TEMP 0x08 #define MUX_VOLT 0x01 #define MUX_PRESS 0x02 unsigned int idata Temp, Press, Volt;unsigned char idata mux_select; sfr16 ADC0 = 0xbe; / ADC0 data void init_adc(void) ADC0CN = 0x81; / ADC0 enabled; normal tracking / mode; ADC0 conversions are initiated / on write to AD0BUSY; ADC0 data is / left-justified REF0CN = 0x07; / enable temp sensor, on-chip VREF, / and VREF output buffer mux_select = MUX_TEMP; / CPU on-chip temp sensor AMX0SL = MUX_TEMP; ADC0CF = (SYSCLK/2500000) << 3; / ADC conversion clock = 2.5MHz /ADC0CF |= 0x01; / PGA gain = 2 EIE2 &= 0x02; / disable ADC0 EOC interrupt EIE1 &= 0x04; / disable ADC0 window compare interrupt / On-chip temperature / AN1. 电位片/ AN2. 应变片void read_analog_inputs(void) long temp_long; AD0INT = 0; / clear conversion complete indicator AD0BUSY = 1; / initiate conversion while (AD0INT = 0); / wait for conversion complete switch (mux_select) case MUX_TEMP: temp_long = ADC0 - 42380/2; temp_long = (temp_long * 200L) / 156; Temp=temp_long; AMX0SL = MUX_VOLT; / Select AIN1 for next read mux_select = MUX_VOLT; break; case MUX_VOLT: temp_long = ADC0; Volt = 24*temp_long/655; AMX0SL = MUX_PRESS; / Select on-chip temp sensor mux_select = MUX_PRESS; break; case MUX_PRESS: temp_long = ADC0; temp_long = 24*temp_long/655; Press = temp_long; AMX0SL = MUX_TEMP; mux_select = MUX_TEMP; break; default: AMX0SL = MUX_TEMP; mux_select = MUX_TEMP; break; unsigned int GetADCValue(char No) read_analog_inputs(); read_analog_inputs(); read_analog_inputs(); switch (No) case 1: return Temp; case 2: return Volt; case 3: if (Press<10) Press=0; return Press; 液晶显示模块KS0108.c#include "C8051F020.h" #include <intrins.h> /* 液晶点阵显示实验-128*64,控制器KS0108实验准备:将拨码开关S1和S2置ON运行此程序将上下左右滚动显示“姓名,马彩霞学号,3100601033班级,通信1002”出现菜单,按键选择。*/ #define LCD_DATA P2 #define LCD_RS P30 #define LCD_RW P31 #define LCD_E P32 #define LCD_CS1 P34 #define LCD_CS2 P33 #define LCD_RST P35 void Delay1ms(unsigned char); #define SELECTCS 0char code zero= /0/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, ; char code one= /1/0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00, ; char code two= /2/0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00, ; char code three= /3/0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00, ; char code four= /4/0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00, ; char code five= /5/0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00, ; char code six= /6/0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00, ; char code seven= /7/0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00, ; char code eight= /8/0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, ; char code nine= /9/0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00, ; char code mao= /:/0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, ; char code dot= /./0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00, ; char code wen= /温/0x10,0x21,0x86,0x70,0x00,0x7E,0x4A,0x4A,0x4A,0x4A,0x4A,0x7E,0x00,0x00,0x00,0x00, 0x02,0xFE,0x01,0x40,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x40,0x00, ; char code du= /度/0x00,0x00,0xFC,0x04,0x24,0x24,0xFC,0xA5,0xA6,0xA4,0xFC,0x24,0x24,0x24,0x04,0x00, 0x80,0x60,0x1F,0x80,0x80,0x42,0x46,0x2A,0x12,0x12,0x2A,0x26,0x42,0xC0,0x40,0x00, ; char code dian= /电/0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00, 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00, ; char code ya= /压/0x00,0x00,0xFE,0x02,0x42,0x42,0x42,0x42,0xFA,0x42,0x42,0x42,0x62,0x42,0x02,0x00, 0x20,0x18,0x27,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x21,0x2E,0x24,0x20,0x20,0x00, ; char code li= /力/0x00,0x10,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00, 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x01,0x00,0x00,0x40,0x80,0x40,0x3F,0x00,0x00, ; char code C= /C/0xC7,0x35,0x0F,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00, ; char code N= /牛顿/0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00, ; char code m= /m/0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F, ; char code V= /V/0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00, ; charcodescreen1= 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x80,0x80,0x00,0x80,0xC0,0x80,0x80,0x80,0x00,0x00,0x00,0xC0,0x00,0x00,0x80,0x80,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0xC0,0x40,0x40,0xC0,0x80,0x80,0x80,0xC0,0x80,0x80,0x80,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,0x000x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xFC,0x80,0x40,0x04,0x04,0x040xFF,0x04,0x04,0x04,0x00,0x82,0x81,0xBE,0xEB,0xAA,0xAB,0xAA,0xEA,0xBF,0x80,0x80,0x00,0x61,0x19,0xFF,0x09,0x91,0x7F,0x00,0x00,0xFF,0x00,0xC0,0x00,0x27,0x21,0x25,0x25,0x25,0xF5,0x2D,0x25,0x21,0x25,0x23,0x00,0xFF,0x20,0x23,0x3C,0x09,0x8A,0x7A,0x0A,0xFA,0x0A,0xC9,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0xC4,0xB4,0x84,0x84,0x84,0xE5,0x9C,0x80,0x00,0x00,0x88,0x98,0xA9,0xD8,0xA4,0x9C,0xA4,0x21,0x10,0x88,0x44,0x00,0x30,0xD4,0x55,0x75,0xD4,0x3C,0x54,0x54,0x75,0xD1,0x31,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x12,0x12,0x10,0x0F,0x00,0x00,0x08,0x04,0x02,0x1F,0x02,0x14,0x10,0x09,0x09,0x04,0x02,0x00,0x00,0x1F,0x05,0x05,0x15,0x10,0x15,0x0D,0x0D,0x15,0x10,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,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,0x42,0x81,0x89,0x89,0x76,0x00,0x00,0x82,0xFF,0x80,0x00,0x00,0x7E,0x81,0x81,0x81,0x7E,0x00,0x7E,0x81,0x81,0x81,0x7E,0x00,0x7E,0x89,0x89,0x8B,0x70,0x00,0x7E,0x81,0x81,0x81,0x7E,0x00,0x00,0x82,0xFF,0x80,0x00,0x00,0x7E,0x81,0x81,0x81,0x7E,0x00,0x42,0x81,0x89,0x89,0x76,0x00,0x42,0x81,0x89,0x89,0x76,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0xD8,0x00,0x04,0xF4,0x5C,0xF4,0x5C,0x54,0xF4,0x00,0x00,0x80,0xE0,0x1C,0x08,0xA8,0xA8,0xA8,0xAC,0xA8,0xA8,0x08,0x00,0x00,0x20,0xF0,0x00,0x00,0x00,0xE0,0x10,0x10,0x10,0xE0,0x00,0xE0,0x10,0x10,0x10,0xE0,0x00,0x60,0x10,0x10,0x90,0x60,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x07,0x08,0x10,0x17,0x11,0x17,0x11,0x15,0x17,0x10,0x00,0x00,0x1F,0x00,0x00,0x1E,0x0A,0x0A,0x0A,0x0A,0x1E,0x00,0x00,0x00,0x08,0x0F,0x08,0x00,0x00,0x07,0

    注意事项

    本文(毕业设计点阵式液晶显示屏的显示程序设计单片机课程设计报告.doc)为本站会员(知****量)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开