嵌入式系统项目设计课程设计报告基于LCD的电子时钟实验_第1页
嵌入式系统项目设计课程设计报告基于LCD的电子时钟实验_第2页
嵌入式系统项目设计课程设计报告基于LCD的电子时钟实验_第3页
嵌入式系统项目设计课程设计报告基于LCD的电子时钟实验_第4页
嵌入式系统项目设计课程设计报告基于LCD的电子时钟实验_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、河海大学计算机及信息工程学院(常州)课程设计报告 题 目 嵌入式系统项目设计 专 业 通信工程 授课班号 姓 名 指导教师 完成时间 2011/6/25 课程设计(报告)任务书、课程设计(报告)题目: 基于lcd的电子时钟实验 、课程设计(论文)工作内容一、课程设计目标 1、培养综合运用知识和独立开展实践创新的能力;2、培养学生的编程能力、用计算机解决实际问题的能力。二、研究方法及手段应用1、将任务分成若干模块,查阅相关论文资料,分模块调试和完成任务;2、使用ads1.2编译汇编语言和c语言,连接生成hex文件。3、联合protues 7.4 仿真,选用arm7 lpc2104 芯片,导入he

2、x文件,实现模拟电 子时钟。三、课程设计预期效果1、完成实验环境搭建;2、分模块调试和编译;3、组合并完善程序。4、联合仿真软件运行程序。学生姓名: 李婷 专业年级: 08通信工程 目 录摘 要 3第一章 系统设计 6第一节 课题目标及总体方案.6 第二节 元器件的选择和连线.6 第三节 程序和芯片的初始化.7 第四节 构建功能模块.8第二章 实验(测试)结果及讨论.13 第一节 ads1.2 软件的编译,连接和运行.13 第二节 protues 7.4仿真软件的联合调试.14第三章 结论15心得体会15参考文献 15附 录 16 源程序16 摘 要近年来,随着计算机技术及集成电路技术的发展,

3、嵌入式技术日渐普及,在通讯、网络、工控、医疗、电子等领域发挥着越来越重要的作用。嵌入式系统无疑成为当前最热门最有发展前途的it应用领域之一。 实时时钟(rtc)器件是一种能提供日历/时钟、数据存储等功能的专用集成电路,常用作各种计算机系统的时钟信号源和参数设置存储电路。rtc具有计时准确、耗电低和体积小等特点,特别适用于在各种嵌入式系统忠记录事件发生的时间和相关信息,尤其是在通信工程、电力自动化、工业控制等自动化程度较高领域的无人职守环境。随着集成电路技术的不断发展,rtc器件的新品也不断推出。这些新品不仅具有准确的rtc,还有大容量的存储器、温度传感器和a/d数据采集通道等,已成为集rtc、

4、数据采集和存储于一体的综合功能器件,特别适用于以微控制器为核心的嵌入式系统。summaryin recent years, along with the computer technology and integrated circuit technology development, the embedded technology, growing popularity in communication, network, industrial, medical and electronic field plays a more and more important role. the em

5、bedded system has become the most popular most promising it application field of one.real time clock (rtc) device is a kind of can provide calendar/clock, data storage function application-specific integrated circuit, commonly used all kinds of computer system clock signal source and the parameters

6、set store circuit. with timing accurate rtc, low power consumption, and small volume and other characteristics, especially suitable for all kinds of embedded system loyal record in the timing of events and related information, especially in communication engineering, power automation, industry contr

7、ol, high automation field of unmanned their duties environment. along with the development of the integrated circuit technology, the new product of rtc device also has introduced. these new product not only has accurate rtc, and high capacity memory, temperature sensor and a/d data acquisition chann

8、el etc, has become the collection of data collection and storage, rtc in an integrated function device, especially suitable for to micro controller as the core of the embedded system.第一章 系统设计第一节 课题目标及总体方案 利用lpc 2104芯片和lcd显示器,通过汇编和c语言编译,完成实时时钟的显示。第二节 元器件的选择和连线 选用嵌入式arm 7系列的lpc 2104芯片和lcd pg160128a显示器

9、: 根据使用的需要配置端口连线: 第三节 程序和芯片的初始化 程序中包括:lcd的初始化:中断向量的初始化:rtc的初始化:芯片lpc2104 基础配置:中间使用了上接正电源配合电容的交流特性,为芯片提供电源和复位功能。其他引脚根据芯片要求配置连接。 第四节 构建功能模块lcd显示的时钟界面包括:静止不动的圆形钟面和一直在走动的时钟指针。所以需要构建两个重要的函数实现画圆和画直线。以下为画圆函数:void shouw_cricle() / 整 点 set_color(gui_yellow);fill_circle (160, 30,2); / 12点(x,y,r) fill_circle (1

10、35, 35,2); / 11 点(x,y,r) fill_circle (115, 55,2); / 10 点(x,y,r) fill_circle (110, 80,2); / 9 点(x,y,r) fill_circle (115, 105,2); / 8 点(x,y,r) fill_circle (135, 125,2); / 7 点(x,y,r) fill_circle (160, 130,2); / 6 点(x,y,r) fill_circle (185, 125,2); / 5 点(x,y,r) fill_circle (205, 105,2); / 4 点(x,y,r) fil

11、l_circle (210, 80,2); / 3 点(x,y,r) fill_circle (205, 55,2); / 2点(x,y,r)fill_circle (185, 35,2); / 1点(x,y,r)该算法是通过x变量的自增,补偿1 修正正方形控制y变量自减,找到距中心恒定距离的点,其中rs=45,x自0加1增至45。和原点坐标运算,可以在第一象限找到一点,再通过折叠对称找到其他象限的三个点,通过画点函数描绘出。再画他的45度镜像就好了。画线函数:void line(unsigned int x1,unsigned int y1,unsigned int x2,unsigned

12、int y2,unsigned char draw)以中心的坐标为起点,使用while函数与指针最外圈的点比较,不断延长直至相等,所以事先计算出时针,分针和秒针三个同心圆最外圈点的坐标,以便带入函数。也同圆类似,要考虑不同象限点的情况,根据不同的位置带参数到画点函数中描绘。 1. 画指针模块int spacexs61=160,165,170,175,180,185,189,193,197,201,205,206,207,208,209,210,209,208,207,206,205,201,197,193,189,185,180,175,170,165,160,155,150,145,140,

13、135,131,127,123,119,115,114,113,112,111,110,111,112,113,114,115,119,123,127,131,135,140,145,150,155,160, , spaceys61=30,31,32,33,34, 35,39,43,47,51, 55,60,65,70,75, 80,85,90,95,100, 105,109,113,117,121, 125,126,127,128,129, 130,129,128,127,126, 125,121,117,113,109, 105,100,95,90,85, 80,75,70,65,60,

14、55,51,47,43,39, 35,34,33,32,31,30, spacexm61=160,164,168,172,176,180,183,186,189,192, 195,196,197,198,199,200,199,198,197,196, 195,192,189,186,183,180,176,172,168,164, 160,156,152,148,144,140,137,134,131,128, 125,124,123,122,121,120,121,122,123,124, 125,128,131,134,137,140,144,148,152,156, 160 , spa

15、ceym61=40,41,42,43,44,45,48,51,54,57, 60,64,68,72,76,80,84,88,92,96, 100,103,106,109,112,115,116,117,118,119, 120,119,118,117,116,115,112,109,106,103, 100,96,92,88,84,80,76,72,68,64, 60,57,54,51,48,45,44,43,42,41, 40spacexh13=160,175,185,190,185,175,160,145,135,130,135,145,160, spaceyh13=50,55,65,80

16、,95,105,110,105,95,80,65,55,50,2. 显示模块void shows() show(sec); set_color(gui_gray); /擦除上一秒的 draw_line(x_line,y_line,*placex,*placey); placex=placex+1; placey=placey+1; set_color(gui_yellow); /显示下一秒的 draw_line(x_line,y_line,*placex,*placey); set_color(gui_red); /显示下一分的 draw_line(x_line,y_line,*placexm

17、,*placeym); set_color(gui_green); /显示下一时的 draw_line(x_line,y_line,*placexh,*placeyh); if(placex=&spacexs60&placey=&spaceys60) placex=&spacexs0; placey=&spaceys0; 小时,分显示类似。3. 计时模块oid task_2(void *pdata) for(;) show_color(); shouw_cricle(); set_color(gui_red); sec = 0; set_color(gui_yellow); /显示 draw_

18、line(x_line,y_line,*placex,*placey); display_time(130, 160);/时间 do delay(1200); sec+; shows(); if (sec = 60) sec = 0; min+; showm(); if (min = 60) min = 0; hour+; showh(); if (hour = 23) hour = 0; day+; if(day =32) day = 1; mon+; if(mon = 13) mon = 1; yea1+; display_time(130, 160);/时间 日期while(1);第二章

19、 实验(测试)结果及讨论第一节 ads1.2 软件的编译,连接和运行 构建完整的程序:添加头文件,中断处理汇编程序段,初始化函数和主函数: 编译所有的文件:编译器提示:成功生成所需hex文件,将得到的hex文件导入仿真芯片lpc 2104中,观察实时时钟。第二节 protues 7.4仿真软件的联合调试 为lpc 2104 芯片选择hex文件路径:连接芯片与lcd端口,运行程序,观察效果。显示如下时钟界面: 动态显示当前的时间,包括:年、月、日、时、分、秒,时针、分针和秒针为动态实时指示当前的时间。第三章 结 论综合效果图:以上为protues部分设计的,ads程序见附录。心得体会通过短短一个

20、星期的嵌入式课程设计,我获益匪浅。在课程设计的过程中,我发现我们专业在半个学期里所修的嵌入式课程的知识点都仅仅是基础中的基础,要完成老师交给我们的任务还是有一些距离的,于是我们小组自发上网搜集了许多嵌入式的资料,在完成方案设计和程序修改调试以后,就可初步实现本课题课程设计的要求。但当我们将程序烧入实验箱后,发现最初的版本并不完美,存在许多使用上的不方便与可以进一步改进的地方,譬如功能不全、外观粗糙通过这次课设,我发现了自己在课本知识上掌握的不足,同时把以前所学过的知识重新温故,巩固了所学的知识。我觉得这次的成功很大部分取决与团队合作与冷静、耐心和细心。团队合作可以增强我们的创新能力与加大我们的

21、完成速度,而程序的修改,调试,编译则离不开冷静、耐心和细心等心理素质。另外,这次课设的完满结束,给了我们日后毕业设计宝贵的经验,使我们受益匪浅。 参考文献1 谢自美,电子线路设计、实验、测试,华中理工大学出版社,2003。2 宋春荣,通用集成电路速查手册,山东科学技术出版社,1995。3 arnold berger,嵌入式系统设计,吕骏 译, 北京:电子工业出版社, 20024 桑楠. 嵌入式系统原理及应用开发技术,北京:北京航空航天大学出版社, 2002 附 录一、 源程序:#include .incconfig.h#definestacksize256#define x_line 160#

22、define y_line 80os_stk_data stk;extern gui_font chinese_font12;extern gui_font chinese_font16;extern gui_font gui_font8x16;os_event * send_lcd_sem;os_event *key_mbox;i8 hour3,min3,sec3;i8 hour = 0, min = 0, sec = 0,ms;i8 yea13,yea23,mon3,day3;int yea1 = 20,yea2=11, mon = 6, day = 23;i8 xh03,xh13,xh2

23、3,xh33;i8 xh43,xh53,xh63,xh73;char xh0=01,xh1=62,xh2=31,xh3=03;char xh4=32,xh5=36,xh6=02,xh7=12;/int timecount = 0;int spacexs61=160,165,170,175,180,185,189,193,197,201,205,206,207,208,209,210,209,208,207,206,205,201,197,193,189,185,180,175,170,165,160,155,150,145,140,135,131,127,123,119,115,114,113

24、,112,111,110,111,112,113,114,115,119,123,127,131,135,140,145,150,155,160, , spaceys61=30,31,32,33,34, 35,39,43,47,51, 55,60,65,70,75, 80,85,90,95,100, 105,109,113,117,121, 125,126,127,128,129, 130,129,128,127,126, 125,121,117,113,109, 105,100,95,90,85, 80,75,70,65,60, 55,51,47,43,39, 35,34,33,32,31,

25、30, spacexm61=160,164,168,172,176,180,183,186,189,192, 195,196,197,198,199,200,199,198,197,196, 195,192,189,186,183,180,176,172,168,164, 160,156,152,148,144,140,137,134,131,128, 125,124,123,122,121,120,121,122,123,124, 125,128,131,134,137,140,144,148,152,156, 160 , spaceym61=40,41,42,43,44,45,48,51,

26、54,57, 60,64,68,72,76,80,84,88,92,96, 100,103,106,109,112,115,116,117,118,119, 120,119,118,117,116,115,112,109,106,103, 100,96,92,88,84,80,76,72,68,64, 60,57,54,51,48,45,44,43,42,41, 40 , spacexh13=160,175,185,190,185,175,160,145,135,130,135,145,160, spaceyh13=50,55,65,80,95,105,110,105,95,80,65,55,

27、50, *placex=&spacexs0,*placey=&spaceys0,*placexm=&spacexm0,*placeym=&spaceym0, *placexh=&spacexh0,*placeyh=&spaceyh0;void display_xh1(char xx1,char yy1);void display_xh2(char xx2,char yy2);void display_xh3(char xx3,char yy3);void shows() show(sec); set_color(gui_gray); /擦除上一秒的 draw_line(x_line,y_lin

28、e,*placex,*placey); placex=placex+1; placey=placey+1; set_color(gui_yellow); /显示下一秒的 draw_line(x_line,y_line,*placex,*placey); set_color(gui_red); /显示下一分的 draw_line(x_line,y_line,*placexm,*placeym); set_color(gui_green); /显示下一时的 draw_line(x_line,y_line,*placexh,*placeyh); if(placex=&spacexs60&placey

29、=&spaceys60) placex=&spacexs0; placey=&spaceys0; void showm() set_color(gui_gray); /擦除上一分的 draw_line(x_line,y_line,*placexm,*placeym); placexm=placexm+1; placeym=placeym+1; set_color(gui_red); /显示下一分的 draw_line(x_line,y_line,*placexm,*placeym); set_color(gui_green); /显示下一时的 draw_line(x_line,y_line,*

30、placexh,*placeyh); if(placexm=&spacexm60&placeym=&spaceym60) placexm=&spacexm0; placeym=&spaceym0; void showh() set_color(gui_gray); /擦除上一时的 draw_line(x_line,y_line,*placexh,*placeyh); placexh=placexh+1; placeyh=placeyh+1; set_color(gui_green); /显示下一时的 draw_line(x_line,y_line,*placexh,*placeyh); if(

31、placexh=&spacexh12&placeyh=&spaceyh12) placexh=&spacexh0; placeyh=&spaceyh0; void shouw_cricle() / 整 点 set_color(gui_yellow); fill_circle (160, 30,2); / 12点(x,y,r) fill_circle (135, 35,2); / 11 点(x,y,r) fill_circle (115, 55,2); / 10 点(x,y,r) fill_circle (110, 80,2); / 9 点(x,y,r) fill_circle (115, 10

32、5,2); / 8 点(x,y,r) fill_circle (135, 125,2); / 7 点(x,y,r) fill_circle (160, 130,2); / 6 点(x,y,r) fill_circle (185, 125,2); / 5 点(x,y,r) fill_circle (205, 105,2); / 4 点(x,y,r) fill_circle (210, 80,2); / 3 点(x,y,r) fill_circle (205, 55,2); / 2点(x,y,r) fill_circle (185, 35,2); / 1点(x,y,r) void delay(in

33、t time);void changeform(char time,char time) time0 = time / 10 + 48; time1 = time % 10 + 48; time2 = 0;void display_time(char x,char y) changeform(hour, hour); changeform(min, min); changeform(sec, sec); changeform(mon, mon); changeform(day, day); changeform(yea1, yea1); changeform(yea2, yea2); disp_string (hour,x,160); disp_string (:,x + 16,160); disp_string (min,x + 24,160); disp_string (:,x + 40,160); disp_string (sec,x + 48,160); disp_string (yea1,x , 180); disp_string (yea2,x +16,180); disp_string (,x + 32,18

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论