毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc

上传人:土8路 文档编号:11073406 上传时间:2021-06-26 格式:DOC 页数:45 大小:427KB
返回 下载 相关 举报
毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc_第1页
第1页 / 共45页
毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc_第2页
第2页 / 共45页
毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc_第3页
第3页 / 共45页
毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc_第4页
第4页 / 共45页
毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc_第5页
第5页 / 共45页
点击查看更多>>
资源描述

《毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc》由会员分享,可在线阅读,更多相关《毕业论文基于PID算法的中医理疗恒温控制器设计10395.doc(45页珍藏版)》请在三一文库上搜索。

1、师范学院学院师范学院学院 毕毕 业业 设设 计(论文)计(论文) 2013 届 题 目 基于基于 PIDPID 算法的中医理疗恒温控制器算法的中医理疗恒温控制器 专 业 电子信息工程电子信息工程 学生姓名 tmpchange(); temp=tmp(); init(); TR0=0; PIDw=1; while(1) keyscan(); keyscanw(); compare_temp(); if(flag=1) tmpchange(); temp=tmp(); Displaytemp(temp); Henwentemp(tmph); showtime(); disdingshi(); if

2、(miao1!=0)|(fen1!=0)|(shi1!=0) if(temp=tmph) henwenfl=1; if(flag=1) yellow=0; TR0=1; if(henwenfl=0) green=0; TR0=1; if(henwenfl=1) hengwenPID(); green=1; if(miao1=0) yellow=1; henwenfl=0; Baojin=0; delay1(900); showtime(); Baojin=1; delay1(900); showtime(); Baojin=0; delay1(900); showtime(); Baojin=

3、1; delay1(900); showtime(); Baojin=0; delay1(900); showtime(); Baojin=1; delay1(900); showtime(); Baojin=0; delay1(900); showtime(); Baojin=1; delay1(900); showtime(); TR0=0; PIDw=1; high_time=0; 3.23.2 按键功能程序按键功能程序 系统按键功能流程图如图 3-2 所示。按键主要完成对温度保持时间、目标温度值等参 数时行设置。在编写程序时主要完成判断是否有按键、去抖、键值确定、功能确定、加、 减等功

4、能。 开始 设置键是否按下? 延时消抖 设置键是否按下? 键盘标志位“0” 设置键是否释放? 键盘功能值加“1” 光标闪烁 功能值=9? 功能值置“0”、键盘标志位置“1” 加键是否按下? 加键是否按下? 减键是否按下 功能数据对应加“1” 延时消抖 减键是否按下? 返回 调整时间写入DS1302 功能数据对应减“1” 延时消抖 功能值不为“0”? Y N Y N Y N Y N N Y Y N N N Y N Y 图 3-2按键功能流程图 键盘部分程序如下: void keyscan(void) uchar i,addr; if(set=0) delay1(2); if(set=0) lag

5、=0; while(!set); num+; switch(num) case 1:write_com(0 x80+15); /miao write_com(0 x0F); break; case 2:write_com(0 x80+12); /fen write_com(0 x0f); break; case 3:write_com(0 x80+9); /fen write_com(0 x0f); break; case 4:num=0; flag=1; write_com(0 x0c); /退出 break; if(num!=0) if(add=0) delay1(1); if(add=0

6、); while(!add); switch(num) case 1: miao+; if(miao=60) miao=0; write_sfm(14,miao,1); break; case 2: fen+; if(fen=60) fen=0; write_sfm(11,fen,1); break; case 3: shi+; if(shi=24) shi=0; write_sfm(8,shi,1); break; if(reduce=0) delay1(1); if(reduce=0); while(!reduce); switch(num) case 1: miao-; if(miao0

7、) miao=59; write_sfm(14,miao,1); break; case 2: fen-; if(fen0) fen=59; write_sfm(11,fen,1); break; case 3: shi-; if(shi0) shi=23; write_sfm(8,shi,1); break; TableDs13020=miao; TableDs13021=fen; TableDs13022=shi; addr=0 x80; WriteSet1302(0 x8e,0 x00); /允许写入 for(i=0;i0)i-; DQ=1; i=4; while(i0)i-; 功能:读

8、 1 字节函数 uchar tmpread(void) uchar i,j,dat; dat=0; for(i=1;i=8;i+) j=tmpreadbit();/读 1 位数字程序 dat=(j1); /读出的数据最低位在最前面,这样刚好一个字节在 DAT 里 return(dat); 功能: 向 1820 写一个字节数据函数 void tmpwritebyte(uchar dat) uint i; uchar j; bit testb; for(j=1;j1; if(testb) /write 1 DQ=0; i+;i+; DQ=1; i=8;while(i0)i-; else DQ=0;

9、 /write 0 i=8;while(i0)i-; DQ=1; i+;i+; void tmpchange(void) 功能: DS18B20 开始获取数据并转换 dsreset(); delay(1); tmpwritebyte(0 xcc); / address all drivers on bus 写跳过读 ROM 指令 tmpwritebyte(0 x44); / initiates a single temperature conversion 写温 度转换指令 功能: 读取寄存器中存储的温度数据 uint tmp() float tt; uchar a,b; dsreset();

10、 delay(1); tmpwritebyte(0 xcc); tmpwritebyte(0 xbe); a=tmpread(); /读低 8 位 b=tmpread(); /读高 8 位 temp=b; temp当前温度? 全速加热停止加热 目标温度与当前 温度差值大于 0? 输出控制量、控制加热趋势 PID算法 目标温度与当前 温度差值大于1? 返回 Y Y N N N Y 图 3-6 温度比较子程序流程图 温度控制部分程序如下: unsigned int PIDCalc( struct PID *pp, unsigned int NextPoint ) unsigned int dErr

11、or,Error; Error = pp-SetPoint - NextPoint; / 偏差 pp-SumError += Error; / 积分 dError = pp-LastError - pp-PrevError; / 当前微分 pp-PrevError = pp-LastError; pp-LastError = Error; return (pp-Proportion * Error / 比例项 + pp-Integral * pp-SumError / 积分项 + pp-Derivative * dError); / 微分项 温度比较处理子程序 void compare_tem

12、p() unsigned char i; if(tmphtemp) if(tmph-temp10) high_time=100; /全速加热 low_time=0; else for(i=0;i10;i+) tmpchange(); temp=tmp(); s=temp%10*100/16; temp=temp/10; rin = s; / Read Input rout = PIDCalc ( / Perform PID Interation if (high_time=100) high_time=(unsigned char)(rout/800); else high_time=100;

13、 low_time= (100-high_time); else if(tmph0) high_time=0; /停止加热 low_time=100; else for(i=0;i10;i+) tmpchange(); temp=tmp(); s=temp%10*100/16; temp=temp/10; rin = s; / Read Input rout = PIDCalc ( / Perform PID Interation if (high_time=30) miao1=miao1-(60-abs(miao2-miao3); else miao1=miao1-abs(miao2-mia

14、o3); if(miao10) if(fen1!=0|shi1!=0) fen1=fen1-1; miao1=59; if(miao10 if(fen10) shi1=shi1-1; fen1=59; if(fen10 if(shi14)*10 + (readdat/BCD 码转化成 10 进制 readdat = readRTC_B(DS1302_MINUTE); fen = (readdat readdat = readRTC_B(DS1302_HOUR); shi = (readdat readdat = readRTC_B(DS1302_DAY); day = (readdat rea

15、ddat =readRTC_B(DS1302_WEEK); week = (readdat readdat = readRTC_B(DS1302_MONTH); yue = (readdat readdat = readRTC_B(DS1302_YEAR); nian = (readdat 第四章第四章 总结及实验结果总结及实验结果 4.14.1 设计总结设计总结 通过查阅大量关于中医理疗设备上恒温控制应用的相关资料,对 PID 算法有了初步了 解,基本理清了自己设计的整体思路,初步形成了大概的设计方案框架,即以 STC89C52 单 片机为核心控制器件,采用 DS18B20 数字温度传感器,

16、无需数模拟数字转换,直接与单 片机进行数字传输。应用 PID 算法提高温度的精度,使温度保持在要求的一个恒定范围内。 配有按键用于输入设定温度,配有数码管 LED 用来显示温度,并通过绿、黄、红彩灯显示 正在加热、定时倒计时、报警这三种状态。之后将继续深入查找并分析相关资料,积极与 指导老师探讨商量,结合文献资料,制定出具体详细的设计方案,能通过按键设定加热目 标温度和恒温时间,通过 LED 数码管显示温度和时间,当目标温度到达时,倒计时,并通 过绿、黄、红彩灯显示正在加热、定时倒计时、报警。最终温度误差0.2,系统加热 温度100。基本完成了设计任务。 4.24.2 实验结果实验结果 经过一

17、系列实验数据测试,数据结果记录如表 4-1 所示。 表 4-1 数据结果记录表 设定温度/稳定时间/min稳定下限/稳定上限/ 151014.915.1 201019.920.2 25524.925.1 30529.830.1 351034.935.1 从测定数据分析可以得出:该系统测量的温度误差保持在0.2左右,而且非常稳定, 能够达到系统控制精度的要求。 4.34.3 实物图实物图 参参 考考 文文 献献 1 张方林.医用恒温箱干燥箱的改进探讨与应用J.医疗卫生装备,2004(3):61-62. 2 石曙光,石雄武.基于数字PID和数字电位器的恒温控制系统J.汉工业学院报. 2005,24

18、(1):12-16. 3 石凤英等,康复护理学M.人民卫生出版社,2006:51-53. 4 陈乐.医用恒温箱控温系统D.北京:北京交通大学,2007:27-30. 5 邓恩强等.利用位置式 PID 控制算法实现对恒温箱的控制J.电子元器件应用.2006(12): 39-40. 6 黄贤武,郑筱霞.传感器原理与应用M.成都:电子科技大学出版社,高等教育出版社, 2005:76一108. 7 李善寿等.基于单片机的恒温控制器的设计和实现J.计算机技术与发展,2008(12): 197-199. 8 李朝青单片机原理及接口技术M北京:北京航空航天大学出版社,1999:286-320. 9 徐国林.

19、基于单片机的保温箱智能温度控制系统J.潍坊学院学报,2007(4):20-21. 10 Dallas semiconductor.DS18B20 Programmable Resolution.www.maxim-. 11 余瑾等.基于 DS18B20 测温的单片机温度控制系统J.2009(3-2):105-106. 12 陶永华新型PID控制及其应用M北京:机械工业出版社2002:117-285. 13 刘小兵等.基于51单片机的水温自动控制系统J.兰州工业高等专科学校学报, 2008(3):49-51. 14 康华光,陈大钦.模拟电子电路M.北京:高教育出版社,2004:335-336.

20、15 Dallas Semiconductor. DS18B20 DatasheetP. 2002:243-190. 16 Mohammad A.K.ALIA,Mohammad K.ABU Zalata.A closed-loop temperature control system by utilizing a labview custome-design PID controllerJ.Faculty of Engineering Technology Al-Balqa Applied University,2004:175-178. 17 李英顺等.基于模糊神经网络的 PID 温度控制系

21、统J.鞍山钢铁学院学报,2002(6): 408-411. 18 王万良.自动控制原理M.北京:高等教育出版社,2008,261-268. 结结 束束 语语 经过了两个多月的学习和工作,我终于完成了基于 PID 算法中医理疗的恒温控制系 统的论文。从开始接到论文题目到系统的实现,再到论文文章的完成,每走一步对我来 说都是新的尝试与挑战,这也是我在大学期间独立完成的最大的项目。 在这段时间里,我学到了很多知识也有很多感受,从对专业知识的一无所知,对单片 机等各种芯片很不了解的状态,我开始了独立的学习和试验,查看相关的资料和书籍,让 自己头脑中模糊的概念逐渐清晰,使自己非常稚嫩作品一步步完善起来,

22、每一次改进都是 我学习的收获,每一次试验的成功都让我兴奋不已。 虽然我的论文作品不是很成熟,还有很多不足之处,但我可以自豪的说,这里面的每 一个句子,都有我的努力的痕迹。当看着自己的程序,自己成天相伴的系统能够健康的执 行,真是莫大的幸福和欣慰。我相信其中的酸甜苦辣最终都会化为甜美的甘泉。 这次做论文的经历也会使我终身受益,我感受到做论文是要真真正正用心去做的一件 事情,是真正的自己学习的过程和研究的过程,没有学习就不可能有研究的能力,没有自 己的研究,就不会有所突破。希望这次的经历能让我在以后学习中激励我继续前进。 致致 谢谢 在这次毕业设计的整个过程中,很多老师和同学给予了我细心的指导和热

23、心的帮助, 让我顺利完成了这份我比较满意的作品,在此深表感谢!真诚地感谢在整个毕业设计过程 中帮助过我的每一个人。 首先,也是最主要感谢的是我的指导老师,蔡志端老师。在整个课程设计和毕业设计过 程中,蔡老师在选题、开题、设计方案的确定与细化等方面都给了我耐心、细致的指导; 同时,蔡老师还仔细地审阅我的论文,为我指出错误、提出修改方法。蔡老师诲人不倦、 一丝不苟、严肃认真的治学风格给我留下了深刻印象,值得我认真学习。在此,谨向指导 老师蔡老师致以真诚的谢意! 再者,要感谢实验室的同学,在他们的指导和帮助下,我顺利完成硬件电路。还有一 些软件方面的指导,比如如何编写各部分的子程序,各部分的程序框图

24、等等。尤其在最后 的硬件检测部分,实验室的同学给我提供了一个极好的模拟恒温的方法。 最后,要感谢在毕业设计过程中一路走来帮助过我的人,虽然各自选择的题目不一样, 当我有难题的时候他们一样伸出热情的援助之手,在此深表感谢,也祝他们顺利完成毕业 设计! 附录附录 系统硬件原理图 Employment tribunals sort out disagreements between employers and employees. You may need to make a claim to an employment tribunal if: you dont agree with the di

25、sciplinary action your employer has taken against you your employer dismisses you and you think that you have been dismissed unfairly. For more information about dismissal and unfair dismissal, see Dismissal. You can make a claim to an employment tribunal, even if you havent appealed against the dis

26、ciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal. Remember that in most cases you must make an application to an employment tribunal within three months of the date when

27、the event you are complaining about happened. If your application is received after this time limit, the tribunal will not usually accept it. If you are worried about how the time limits apply to you, take advice from one of the organisations listed under Further help. Employment tribunals are less

28、formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation. Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away

29、 from one of the organisations listed under Further help. If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as a damages-based agreement. In England and Wales, your so

30、licitor cant charge you more than 35% of your compensation if you win the case. If you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizen

31、s Advice Bureau. To find your nearest CAB, including those that give advice by e-mail, click on nearest CAB. For more information about making a claim to an employment tribunal, see Employment tribunals. The (lack of) air up there Watch mCay man Island s- based Webb, the head of Fifas anti- racism t

32、askfor ce, is in Londo n for the Footba ll Associ ations 150th annive rsary celebr ations and will attend Citys Premi er Leagu e match at Chelsea on Sunday. I am going to be at the match tomorrow and I have asked to meet Yaya Toure, he told BBC Sport. For me its about how he felt and I would like to

33、 speak to him first to find out what his experience was. Uefa has opened disciplinary proceedings against CSKA for the racist behaviour of their fans during Citys 2-1 win. Michel Platini, president of European footballs governing body, has also ordered an immediate investigation into the referees ac

34、tions. CSKA said they were surprised and disappointed by Toures complaint. In a statement the Russian side added: We found no racist insults from fans of CSKA. Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of t

35、he same day; May be back in the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do i

36、t. 一字开头的年龄已经到了尾声。或许是愧疚于自己 似乎把转瞬即逝的很多个不同的日子过成了同一天的样 子;或许是追溯过去,对自己那些近乎偏执的怪异信念 的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断 纠缠。总觉得自己自己似乎应该去做点什么,或者写点 什么。二十年的人生轨迹深深浅浅,突然就感觉到有些 事情,非做不可了。 The end of our life, and can meet many things really do? 而穷尽我们的一生,又能遇到多少事情是真正地非 做不可? During my childhood, think lucky money and new clothes

37、 are necessary for New Year, but as the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenl y found that isnt reall

38、y grow up, it seems is not so importan t; Then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventual ly infarctio n when graduati on party in the throat, later again stood on the pitch he has sweat profus

39、ely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance. 童年时,觉得压岁钱和新衣服是过年必备,但是随 着年龄的推进,会越来越发现,那些东西根本就可有可 无;初中时,以为要有一场暗恋才意味着真正的成长, 但三年过去后,自己心平气和的写同学录的时候,突然 就发现是不是真正的成长了,好像并没有那么重要了; 然后到了高中,觉得非要吐露出自己的心声才能为高中 生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最 终还是被梗塞在了咽喉,后来再次站

40、在他曾经挥汗如雨 的球场,看着他投过篮球的球框时,突然间发现自己已 经想不起他的容颜。 Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time. 原来,这个世界上,对某个事件能产生化学反应的, 除了非做不可的坚决,还有,时间。 A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing

41、could shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm inj

42、ection, or is a self-righteous spiritual. 一个人的时候,自己的想法总是特别地清晰。想要 的,不想要的,界限明确,好像没有什么可以撼动自己。 也曾经好像已经下定了决心去做某件事,但更多的时候 是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发 现有很多缘分,有很多错过,好像冥冥之中真的已经注 定。那些曾经所谓的非做不可,只是青葱年华里自己给 自己注射的一支强心剂,或者说,是自以为是的精神寄 托罢了。 At the moment, the sky is dark, the air is fresh factor after just rained. Sudd

43、enly thought of blue plaid shirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning. Those years, those days of do, finally, like youth, will end in our life. 此刻,天空是阴暗的,空气里有着刚下过雨

44、之后的 清新因子。突然想到那件蓝格子衬衫;那些被折成各种 各样形 状的信 纸;那 段从街 角深巷 伊始的 友谊; 还有那 场还没 有开始 就宣告 了终结 的邂逅 计 划 那些年 那些天 的非做 不可, 终于和 青春一 样,都 将在我 们的人 生中谢 幕。 Baumga rtner the disappoi nting news: Mission aborted. r plays an importan t role in this mission. Starting at the ground, conditio ns have to be very calm - winds less tha

45、n 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting e

46、ven higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence. The supersonic descent could happen as early as Sunda. The weatheThe balloon will slowly dri

47、ft to the edge of space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform. Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the dist

48、ance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jump When he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him completely. If he go

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

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1