毕业论文-基于PID算法的中医理疗恒温控制器设计10395.doc_第1页
毕业论文-基于PID算法的中医理疗恒温控制器设计10395.doc_第2页
毕业论文-基于PID算法的中医理疗恒温控制器设计10395.doc_第3页
毕业论文-基于PID算法的中医理疗恒温控制器设计10395.doc_第4页
毕业论文-基于PID算法的中医理疗恒温控制器设计10395.doc_第5页
免费预览已结束,剩余40页可下载查看

下载本文档

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

文档简介

师范学院学院 毕 业 设 计(论文) 2013 届 题 目 基于 pid 算法的中医理疗恒温控制器 专 业 电子信息工程 学生姓名 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(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); 师范学院学院本科毕业论文 18 showtime(); baojin=1; delay1(900); showtime(); baojin=0; delay1(900); showtime(); baojin=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.2 按键功能程序 系统按键功能流程图如图 3-2 所示。按键主要完成对温度保持时间、目标温度值等参 数时行设置。在编写程序时主要完成判断是否有按键、去抖、键值确定、功能确定、加、 减等功能。 师范学院学院本科毕业论文 19 开始 设置键是否按下 ? 延时消抖 设置键是否按下 ? 键盘标志位 “ 0 ” 设置键是否释放 ? 键盘功能值加 “ 1 ” 光标闪烁 功能值 = 9 ? 功能值置 “ 0 ” 、 键盘标志位置 “ 1 ” 加键是否按下 ? 加键是否按下 ? 减键是否按下 功能数据对应加 “ 1 ” 延时消抖 减键是否按下 ? 返回 调整时间写入 d s 1 3 0 2 功能数据对应减 “ 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; 师范学院学院本科毕业论文 20 if(set=0) delay1(2); if(set=0) lag=0; while(!set); num+; switch(num) case 1:write_com(0x80+15); /miao write_com(0x0f); break; case 2:write_com(0x80+12); /fen write_com(0x0f); break; case 3:write_com(0x80+9); /fen write_com(0x0f); break; case 4:num=0; flag=1; write_com(0x0c); /退出 break; if(num!=0) if(add=0) delay1(1); if(add=0); 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) 师范学院学院本科毕业论文 21 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)i-; dq=1; i=4; while(i0)i-; 功能:读 1 字节函数 uchar tmpread(void) 师范学院学院本科毕业论文 24 uchar i,j,dat; dat=0; for(i=1;i1); /读出的数据最低位在最前面,这样刚好一个字节在 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; /write 0 i=8;while(i0)i-; dq=1; i+;i+; void tmpchange(void) 功能: ds18b20 开始获取数据并转换 dsreset(); delay(1); tmpwritebyte(0xcc); / address all drivers on bus 写跳过读 rom 指令 tmpwritebyte(0x44); / initiates a single temperature conversion 写温 度转换指令 功能: 读取寄存器中存储的温度数据 uint tmp() float tt; uchar a,b; 师范学院学院本科毕业论文 25 dsreset(); delay(1); tmpwritebyte(0xcc); tmpwritebyte(0xbe); a=tmpread(); /读低 8 位 b=tmpread(); /读高 8 位 temp=b; temp 当前温度 ? 全速加热 停止加热 目标温度与当前 温度差值大于 0 ? 输出控制量 、 控制加热趋势 p i d 算法 目标温度与当前 温度差值大于 1 ? 返回 y y n n n y 图 3-6 温度比较子程序流程图 温度控制部分程序如下: unsigned int pidcalc( struct pid *pp, unsigned int nextpoint ) unsigned int derror,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_temp() unsigned char i; if(tmphtemp) if(tmph-temp10) high_time=100; /全速加热 low_time=0; else for(i=0;i0) high_time=0; /停止加热 low_time=100; else for(i=0;i=30) miao1=miao1-(60-abs(miao2-miao3); else miao1=miao1-abs(miao2-miao3); if(miao10) shi1=shi1-1; fen1=59; if(fen14)*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 readdat =readrtc_b(ds1302_week); week = (readdat readdat = readrtc_b(ds1302_month); yue = (readdat readdat = readrtc_b(ds1302_year); nian = (readdat 师范学院学院本科毕业论文 31 第四章 总结及实验结果 4.1 设计总结 通过查阅大量关于中医理疗设备上恒温控制应用的相关资料,对 pid 算法有了初步了 解,基本理清了自己设计的整体思路,初步形成了大概的设计方案框架,即以 stc89c52 单 片机为核心控制器件,采用 ds18b20 数字温度传感器,无需数模拟数字转换,直接与单 片机进行数字传输。应用 pid 算法提高温度的精度,使温度保持在要求的一个恒定范围内。 配有按键用于输入设定温度,配有数码管 led 用来显示温度,并通过绿、黄、红彩灯显示 正在加热、定时倒计时、报警这三种状态。之后将继续深入查找并分析相关资料,积极与 指导老师探讨商量,结合文献资料,制定出具体详细的设计方案,能通过按键设定加热目 标温度和恒温时间,通过 led 数码管显示温度和时间,当目标温度到达时,倒计时,并通 过绿、黄、红彩灯显示正在加热、定时倒计时、报警。最终温度误差0.2,系统加热 温度100。基本完成了设计任务。 4.2 实验结果 经过一系列实验数据测试,数据结果记录如表 4-1 所示。 表 4-1 数据结果记录表 设定温度/ 稳定时间/min 稳定下限/ 稳定上限/ 15 10 14.9 15.1 20 10 19.9 20.2 25 5 24.9 25.1 30 5 29.8 30.1 35 10 34.9 35.1 从测定数据分析可以得出:该系统测量的温度误差保持在0.2左右,而且非常稳定, 能够达到系统控制精度的要求。 4.3 实物图 师范学院学院本科毕业论文 32 参 考 文 献 1 张方林.医用恒温箱干燥箱的改进探讨与应用j.医疗卫生装备,2004(3):61-62. 2 石曙光,石雄武.基于数字pid和数字电位器的恒温控制系统j.汉工业学院报. 2005,24(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 徐国林.基于单片机的保温箱智能温度控制系统j.潍坊学院学报,2007(4):20-21. 10 dallas semiconductor.ds18b20 programmable r. 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. 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 温度控制系统j.鞍山钢铁学院学报,2002(6): 408-411. 18 王万良.自动控制原理m.北京:高等教育出版社,2008,261-268. 师范学院学院本科毕业论文 33 结 束 语 经过了两个多月的学习和工作,我终于完成了基于 pid 算法中医理疗的恒温控制系 统的论文。从开始接到论文题目到系统的实现,再到论文文章的完成,每走一步对我来 说都是新的尝试与挑战,这也是我在大学期间独立完成的最大的项目。 在这段时间里,我学到了很多知识也有很多感受,从对专业知识的一无所知,对单片 机等各种芯片很不了解的状态,我开始了独立的学习和试验,查看相关的资料和书籍,让 自己头脑中模糊的概念逐渐清晰,使自己非常稚嫩作品一步步完善起来,每一次改进都是 我学习的收获,每一次试验的成功都让我兴奋不已。 虽然我的论文作品不是很成熟,还有很多不足之处,但我可以自豪的说,这里面的每 一个句子,都有我的努力的痕迹。当看着自己的程序,自己成天相伴的系统能够健康的执 行,真是莫大的幸福和欣慰。我相信其中的酸甜苦辣最终都会化为甜美的甘泉。 这次做论文的经历也会使我终身受益,我感受到做论文是要真真正正用心去做的一件 事情,是真正的自己学习的过程和研究的过程,没有学习就不可能有研究的能力,没有自 己的研究,就不会有所突破。希望这次的经历能让我在以后学习中激励我继续前进。 师范学院学院本科毕业论文 34 致 谢 在这次毕业设计的整个过程中,很多老师和同学给予了我细心的指导和热心的帮助, 让我顺利完成了这份我比较满意的作品,在此深表感谢!真诚地感谢在整个毕业设计过程 中帮助过我的每一个人。 首先,也是最主要感谢的是我的指导老师,蔡志端老师。在整个课程设计和毕业设计过 程中,蔡老师在选题、开题、设计方案的确定与细化等方面都给了我耐心、细致的指导; 同时,蔡老师还仔细地审阅我的论文,为我指出错误、提出修改方法。蔡老师诲人不倦、 一丝不苟、严肃认真的治学风格给我留下了深刻印象,值得我认真学习。在此,谨向指导 老师蔡老师致以真诚的谢意! 再者,要感谢实验室的同学,在他们的指导和帮助下,我顺利完成硬件电路。还有一 些软件方面的指导,比如如何编写各部分的子程序,各部分的程序框图等等。尤其在最后 的硬件检测部分,实验室的同学给我提供了一个极好的模拟恒温的方法。 最后,要感谢在毕业设计过程中一路走来帮助过我的人,虽然各自选择的题目不一样, 当我有难题的时候他们一样伸出热情的援助之手,在此深表感谢,也祝他们顺利完成毕业 设计! 师范学院学院本科毕业论文 35 附录 系统硬件原理图 g an employment tribunal claim employment tribunals sort out disagreements between employers and employees. you may need to make a 师范学院学院本科毕业论文 36 claim to an employment tribunal if: you dont agree with the disciplinary 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 disciplinary 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 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 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 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 solicitor 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 citizens 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 taskfor 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 师范学院学院本科毕业论文 37 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 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 actions. 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 the 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 it. 一字开头的年龄已经到了尾声。或许是愧疚于自己 似乎把转瞬即逝的很多个不同的日子过成了同一天的样 子;或许是追溯过去,对自己那些近乎偏执的怪异信念 的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断 纠缠。总觉得自己自己似乎应该去做点什么,或者写点 什么。二十年的人生轨迹深深浅浅,突然就感觉到有些 事情,非做不可了。 the end of our life, and can meet many things really do? 而穷尽我们的一生,又能遇到多少事情是真正地非 做不可? during my childhood, think lucky money and new clothes 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 really 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 师范学院学院本科毕业论文 38 throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance. 童年时,觉得压岁钱和新衣服是过年必备,但是随 着年龄的推进,会越来越发现,那些东西根本就可有可 无;初中时,以为要有一场暗恋才意味着真正的成长, 但三年过去后,自己心平气和的写同学录的时候,突然 就发现是不是真正的成长了,好像并没有那么重要了; 然后到了高中,觉得非要吐露出自己的心声才能为高中 生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最 终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨 的球场,看着他投过篮球的球框时,突然间发现自己已 经想不起他的容颜。 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 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 injection, or is a self-righteous spiritual. 一个人的时候,自己的想法总是特别地清晰。想要 的,不想要的,界限明确,好像没有什么可以撼动自己。 也曾经好像已经下定了决心去做某件事,但更多的时候 是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发 现有很多缘分,有很多错过,好像冥冥之中真的已经注 定。那些曾经所谓的非做不可,只是青葱年华里自己给 自己注射的一支强心剂,或者说,是自以为是的精神寄 托罢了。 at the moment, the sky is dark, the air is fresh factor after just rained. suddenly 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. 此刻,天空是阴暗的,空气里有着刚下过雨之后的 清新因子。突然想到那件蓝格子衬衫;那些被折成各种 各样形 状的信 纸;那 段从街 角深巷 伊始的 友谊; 还有那 场还没 有开始 就宣告 了终结 的邂逅 计 划 那些年 那些天 的非做 不可, 终于和 青春一 样,都 将在我 们的人 生中谢 幕。 baumga rtner the disappoi nting news: mission aborted. r plays an importan t role in this mission. starting at the ground, conditio 师范学院学院本科毕业论文 39 ns have to be very calm - winds less than 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 even 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

温馨提示

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

评论

0/150

提交评论