嵌入式课程设计报告ARM7电子时钟.doc

上传人:仙人指路1688 文档编号:4149022 上传时间:2023-04-07 格式:DOC 页数:17 大小:134KB
返回 下载 相关 举报
嵌入式课程设计报告ARM7电子时钟.doc_第1页
第1页 / 共17页
嵌入式课程设计报告ARM7电子时钟.doc_第2页
第2页 / 共17页
嵌入式课程设计报告ARM7电子时钟.doc_第3页
第3页 / 共17页
嵌入式课程设计报告ARM7电子时钟.doc_第4页
第4页 / 共17页
嵌入式课程设计报告ARM7电子时钟.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《嵌入式课程设计报告ARM7电子时钟.doc》由会员分享,可在线阅读,更多相关《嵌入式课程设计报告ARM7电子时钟.doc(17页珍藏版)》请在三一办公上搜索。

1、河海大学计算机及信息工程学院(常州)课程设计报告 题 目 嵌入式课程设计 专业学号 学生姓名 授课班号 指导教师 完成时间 2011.7.5 目 录摘 要 2 第一章 时钟设计 3第一节 课题目标 .3 第二节 程序和芯片的初始化.4 第三节 构建功能模块.5 第四节 实现信息的传递. 5 第二章 实验结果讨论 .6 第一节 软件的编译,连接和运行 .6 第二节 protues 7.4仿真软件调试 .7第三章 结论8心得体会9参考文献 10附 录 11 源程序11 摘要 实时时钟(RTC)器件是一种能提供日历/时钟、数据存储等功能的专用集成电路,常用作各种计算机系统的时钟信号源和参数设置存储电

2、路。RTC具有计时准确、耗电低和体积小等特点,特别适用于在各种嵌入式系统忠记录事件发生的时间和相关信息,尤其是在通信工程、电力自动化、工业控制等自动化程度较高领域的无人职守环境。随着集成电路技术的不断发展,RTC器件的新品也不断推出。这些新品不仅具有准确的RTC,还有大容量的存储器、温度传感器和A/D数据采集通道等,已成为集RTC、数据采集和存储于一体的综合功能器件,特别适用于以微控制器为核心的嵌入式系统。 Summary Real Time Clock (RTC) device can provide a calendar / clock, data storage and other fe

3、atures specific integrated circuit, commonly used for various computer systems, the clock source and the parameter settings stored in the circuit.RTC has a timing accuracy, low power consumption and small size and other characteristics, especially for embedded systems Zhong recorded in the event of

4、time and information, especially in communication engineering, electric power automation, industrial control and other areas of higher degree of automationunattended environment.With integrated circuit technology continues to evolve, RTC also has introduced new devices.These new products not only ha

5、ve accurate RTC, there is a large-capacity memory, temperature sensor and A / D data acquisition channel, etc., has become a set of RTC, data collection and storage functions in one integrated device, particularly applicable to micro-controllercore embedded systems.第一章 时钟设计第一节 课题目标 利用ARM 7芯片和LCD显示器,

6、通过C语言编译,完成实时时钟(RTC)的显示。第二节 程序和芯片初始化 程序中包括:Lcd的初始化:中断向量的初始化:RTC的初始化: 第三节 构建功能模块Lcd显示的时钟界面包括:静止不动的圆形钟面和一直在走动的时钟指针。所以需要构建两个重要的函数实现画圆和画直线。以下为画圆函数:该算法是通过X变量的自增,补偿1 修正正方形控制Y变量自减,找到距中心恒定距离的点,其中rs=45,X自0加1增至45。和原点坐标运算,可以在第一象限找到一点,再通过折叠对称找到其他象限的三个点,通过画点函数描绘出。再画他的45度镜像就好了。画线函数:void line(unsigned int x1,unsign

7、ed int y1,unsigned int x2,unsigned int y2,unsigned char draw)以中心的坐标为起点,使用while函数与指针最外圈的点比较,不断延长直至相等,所以事先计算出时针,分针和秒针三个同心圆最外圈点的坐标,以便带入函数。也同圆类似,要考虑不同象限点的情况,根据不同的位置带参数到画点函数中描绘。 第四节 实现信息的传递画点函数:数据传递函数:与通用可编程输入输出口(General Programable Input Output)相连,把计算的数据传递给Lcd显示。第二章 实验结果讨论第一节 软件的编译,连接和运行 构建完整的程序:添加头文件,中

8、断处理汇编程序段,初始化函数和主函数:编译器提示:成功生成所需Hex文件,将得到的Hex文件导入仿真芯片中,观察实时时钟。第三章 结 论综合效果图:以上为protues部分设计的,ads程序见附录。心得体会 回顾起此次课程设计,至今我仍感慨颇多,从理论到实践,我学到很多很多的东西,不仅巩固了以前所学过的知识,而且学到了很多在书本上所没有学到过的内容。通过这次课程设计使我懂得了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才是真正的知识,才能提高自己的实际动手能力和独立思考的能力。在设计的过程遇到了各种各样的问题,同时在设计的过程中

9、发现了自己的不足之处,对以前所学过的知识理解得不够深刻,掌握得不够牢固,通过这次课程设计,把以前所学过的知识重新温故,巩固了所学的知识。参考文献1 谢自美,电子线路设计、实验、测试,华中理工大学出版社,2003。2 宋春荣,通用集成电路速查手册,山东科学技术出版社,1995。3 Arnold Berger,嵌入式系统设计,吕骏 译, 北京:电子工业出版社, 20024 桑楠. 嵌入式系统原理及应用开发技术,北京:北京航空航天大学出版社, 2002 附 录一、 一、源程序:#include .incconfig.h#defineSTACKSIZE256#define x_line 160#def

10、ine 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,XH23,X

11、H33;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,11

12、2,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,30,

13、 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,54,

14、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,50,

15、 *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 show(I8 s) if(s%4=0) Set_Color(GUI_BLUE); Set_Font (&CHINESE_FONT16); Dis

16、p_String (CN_startCN_end,48,210); Set_Font(&GUI_Font8x16); Display_xh3(250,210); Display_xh2(250,190); Display_xh1(250,170); Set_Color(GUI_RED); Set_Font (&CHINESE_FONT16); Display_xh1(250,210); else if(s%4=1) Set_Color(GUI_YELLOW); Set_Font (&CHINESE_FONT16); Disp_String (CN_startCN_end,48,210); Se

17、t_Color(GUI_YELLOW); Fill_Circle (288,50,25); Display_xh1(250,210); else if(s%4=2) Set_Color(GUI_BLUE); Set_Font (&CHINESE_FONT16); Disp_String (CN_startCN_end,48,210); Set_Color(GUI_WHITE); Set_Font (&CHINESE_FONT16); Disp_String (CN_startCN_end,48,210); Set_Color(GUI_WHITE); Set_Font(&GUI_Font8x16

18、); Display_xh2(250,210); else if(s%4=3) Set_Color(GUI_BLUE); Set_Font(&GUI_Font8x16); Disp_String (CLOCK,10,10); Set_Font (&CHINESE_FONT16); Disp_String (CN_startCN_end,48,210); Set_Color(GUI_LIGHTMAGENTA); Set_Font (&CHINESE_FONT16); Disp_String (CN_startCN_end,48,210); Set_Color(GUI_LIGHTMAGENTA);

19、 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,*Placeym); Set_Color(GUI_GREEN); /显示

20、下一时的 Draw_Line(x_line,y_line,*Placexh,*Placeyh); if(Placex=&SpaceXS60&Placey=&SpaceYS60) Placex=&SpaceXS0; Placey=&SpaceYS0; void Showm() Set_Color(GUI_GREEN); Fill_Circle (288, 50, 25); Set_Color(GUI_RED); Fill_Circle (280, 50, 10); Fill_Circle (296, 50, 10); Fill_Circle (288, 40, 10); Fill_Circle

21、(288, 60, 10); Set_Color(GUI_YELLOW); Fill_Circle (288, 50, 5); 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

22、,*Placexh,*Placeyh); if(Placexm=&SpaceXM60&Placeym=&SpaceYM60) Placexm=&SpaceXM0; Placeym=&SpaceYM0; void Showh() Set_Color(GUI_YELLOW); Fill_Circle (288, 50, 25); Set_Color(GUI_GREEN); Fill_Circle (280, 50, 10); Fill_Circle (296, 50, 10); Fill_Circle (288, 40, 10); Fill_Circle (288, 60, 10); Set_Co

23、lor(GUI_RED); Fill_Circle (288, 50, 5); 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(Placexh=&SpaceXH12&Placeyh=&SpaceYH12) Placexh=&SpaceXH0; Placeyh=&Space

24、YH0; 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, 105,2); / 8 点(x,y,r) Fill_Circle (135, 125,2); / 7 点(x,y,r) Fill_Circle (16

25、0, 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) Set_Color(GUI_WHITE); Fill_Circle (165, 31,1); Fill_Circle (170, 32,1); Fill_Circle (1

26、75, 33,1); Fill_Circle (180, 34,1); Fill_Circle (189, 39,1); Fill_Circle (193, 43,1); Fill_Circle (197, 47,1); Fill_Circle (201, 51,1); Fill_Circle (206, 60,1); Fill_Circle (207, 65,1); Fill_Circle (208, 70,1); Fill_Circle (209, 75,1); Fill_Circle (209, 85,1); Fill_Circle (208, 90,1); Fill_Circle (2

27、07, 95,1); Fill_Circle (206, 100,1); Fill_Circle (201, 109,1); Fill_Circle (197, 113,1); Fill_Circle (193, 117,1); Fill_Circle (189, 121,1); Fill_Circle (180, 126,1); Fill_Circle (175, 127,1); Fill_Circle (170, 128,1); Fill_Circle (165, 129,1); Fill_Circle (155, 129,1); Fill_Circle (150, 128,1); Fil

28、l_Circle (145, 127,1); Fill_Circle (140, 126,1); Fill_Circle (131, 121,1); Fill_Circle (127, 117,1); Fill_Circle (123, 113,1); Fill_Circle (119, 109,1); Fill_Circle (114, 100,1); Fill_Circle (113, 95,1); Fill_Circle (112, 90,1); Fill_Circle (111, 85,1); Fill_Circle (111, 75,1); Fill_Circle (112, 70,

29、1); Fill_Circle (113, 65,1); Fill_Circle (114, 60,1); Fill_Circle (119, 51,1); Fill_Circle (123, 47,1); Fill_Circle (127, 43,1); Fill_Circle (131, 39,1); Fill_Circle (140, 34,1); Fill_Circle (145, 33,1); Fill_Circle (150, 32,1); Fill_Circle (155, 31,1); void Delay(int time);void ChangeForm(char Time

30、,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

31、 (:,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,180); Disp_String (MON,x + 40,180); Disp_String (,x + 56,180); Disp_String (DAY,x + 64,180); void Display_xh1(char x

32、x1,char yy1)/ ChangeForm(XH0, xh0); ChangeForm(XH1, xh1); ChangeForm(XH2, xh2); ChangeForm(XH3, xh3); ChangeForm(XH4, xh4); Disp_String (XH0,xx1,yy1); Disp_String (XH1,xx1+16,yy1); Disp_String (XH2,xx1+32,yy1); Disp_String (XH3,xx1+48,yy1); Disp_String (XH4,xx1+48,yy1); void Display_xh2(char xx2,cha

33、r yy2)/ ChangeForm(XH0, xh0); ChangeForm(XH1, xh1); ChangeForm(XH2, xh2); ChangeForm(XH3, xh3); ChangeForm(XH5, xh5); Disp_String (XH0,xx2,yy2); Disp_String (XH1,xx2+16,yy2); Disp_String (XH2,xx2+32,yy2); Disp_String (XH3,xx2+32,yy2); Disp_String (XH5,xx2+48,yy2); void Display_xh3(char xx3,char yy3)

34、/ ChangeForm(XH0, xh0); ChangeForm(XH1, xh1); ChangeForm(XH2, xh2); ChangeForm(XH6, xh6); ChangeForm(XH7, xh7); Disp_String (XH0,xx3,yy3); Disp_String (XH1,xx3+16,yy3); Disp_String (XH2,xx3+32,yy3); Disp_String (XH6,xx3+48,yy3); Disp_String (XH7,xx3+48,yy3); void Show_Color()Set_Color( GUI_BLUE ); F

35、ill_Rect(0,0,319,239); Set_Color(GUI_RED); Set_BkColor (GUI_BLUE); Fill_Rect(0,0,319,2); Fill_Rect(0,0,2,239); Fill_Rect(0,237,319,239); Fill_Rect(317,0,319,239); Set_Color(GUI_RED); Set_Font (&CHINESE_FONT16);Disp_String (CN_start姓名:CN_end,5,210);Disp_String (CN_start学号:CN_end,210,210);Set_Color(GU

36、I_WHITE ); Fill_Rect (79,17,242,20); /上线(x0,y0,x1,y1)Fill_Rect (79,20,82,202); /左线(x0,y0,x1,y1)Fill_Rect (238,20,242,202); /右线(x0,y0,x1,y1)Fill_Rect (79,199,242,202); /下线(x0,y0,x1,y1)Set_Color(GUI_LIGHTRED); Fill_Rect (83,21,237,198); /*分配各任务的堆栈容量 */OS_STK Stack_Task_1STACKSIZE;OS_STK Stack_Task_2ST

37、ACKSIZE*3;/*void Task_3(I8 s)I8 display; for(;) Delay(100); display+; Set_Color(GUI_RED); Display_xh1(5,180); if(display=1000) display=0; /*- 函数名称 : Task_2(void *pdata)- 函数说明 : GUI任务,优先级为9- 输入参数 : pdata- 输出参数 : 无*/void Task_2(void *pdata) for(;) Show_Color(); Shouw_Cricle(); Set_Color(GUI_RED); sec = 0; Set_Color(GUI_YELLOW); /显示 Draw_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+;

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号