毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc

上传人:仙人指路1688 文档编号:2961219 上传时间:2023-03-05 格式:DOC 页数:4 大小:148KB
返回 下载 相关 举报
毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc_第1页
第1页 / 共4页
毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc_第2页
第2页 / 共4页
毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc_第3页
第3页 / 共4页
毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于PIC12F629 的两位大数字LED 机车速度表的设计.doc(4页珍藏版)》请在三一办公上搜索。

1、基于PIC12F629的两位大数字LED机车速度表的设计王同宏 文章摘要 本文介绍了一种基于PIC12F629制作的两位大LED数字机车速度表的设计,详细说明了两位大LED数字速度表的工作原理、器件的选择及设计方法。该速度表结构简单,通用性强,修改其部分控制程序和输入方式可以将其应用在需要两位数字显示的温度、压力、速度及计数等场合,具有较高的实用价值。关 键 词 PIC12F629 数字LED 74LS164 ULN2003A 自动调光 调车机车采用指针式速度表,调车机车正常运行速度不高于60KM/小时。在监控系统中,指针式速度表很难定量地反映出机车的实际运行速度,因此需要加装一个两位的大LE

2、D数字速度表,用于反映机车的实时运行速度。两位大数字LED速度表的实现有很多种方法,在众多的实现方法中,使用单片机进行设计是比较简单方便的设计方法。制作关键是两位大数字LED的驱动方法的选择,对数字LED进行并联动态驱动还是串联静态驱动又是一个两难的选择:并联动态驱动需要使用单片机的口线多,但外围元件相对较少;串联静态显示使用单片机的口线少,可外围元件相对较多。通常情况下,管脚多的单片机附加功能也多、价格高,因此使用管脚少的单片机开发的产品成本比较低。在本设计中,仅实现机车速度检测与显示,功能比较单一;使用三英寸的大LED数码管,驱动电流比较大;并要求具有自动调光功能;由于在监控下使用,静态显

3、示没有动态显示的频闪现象,显示数字稳定清晰,所以选用串联静态显示;考虑以后功能或程序的改变的方便,采用了只有8脚的FLASH 芯片PIC12F629单片机进行设计。一、两位大数字速度表的硬件组成:两位大数字LED机车速度表的结构功能如图一所示:驱动2LED_1LED_2驱动1单片机亮度控制速度信号图一 速度表功能结构图1. 单片机的设计PIC12F629是微芯公司推出的8脚FLASH型单片机,有1K字节的FLASH ROM ,64字节的RAM及128字节的EEPROM,两个计数器,时钟频率高达20 MHz。尽管PIC12F629内部集成有内部4 MHz 1% 高精度振荡器,使用内部振荡器也可以

4、节省两个管脚,但在本设计中,时基是速度正确如否的关键。因此只能使用外部晶振作为本系统的时钟。设计中使用TMR0作为计数器,T0作为外部信号的输入端,这样可以消除使用软件查询引起的循环时间不等造成测量误差,影响速度测量的稳定性和准确性。2. 驱动电路的设计本设计中使用的三英寸大LED数码管的驱动电流在40毫安左右,直接使用串行移位芯片驱动无法达到所需的驱动电流,因此只能增加电流驱动芯片。在移位芯片选择上,如果单片机的端口充裕的话可以选用74LS595进行3线控制,这样可以消除数码管显示内容更新时引起的显示模糊。在本设计中,由于PIC12F629只有6个I/O口,采用外部晶振和T0作为外部信号的输

5、入端,占用了3个端口,剩余的3端口,只有2端口可以作为输出口,因此选用74LS164作为移位芯片,采用ULN2003A进行电流放大。本设计中的大LED数码管采用12伏供电电压,所以在每一个LED数码管脚上增加一个限流电阻。3. 自动调光电路的设计图二 隔离和调光电路由于机车应用环境中光线强度变化很大,所以增加了自动调光电路,避免夜间LED眩光现象的出现。电路结构如图二所示:自动调光电路采用光敏电阻作为光感元件,当光线强时R4光敏电阻的阻值变小,三极管Q1的基极电位降低,三极管的导通能力变弱,集电极的电位升高,场效应管Q2的导通程度增加,LED供电电压增高,LED发光强度增强;反之,LED发光强

6、度减弱。调整W可以改变由于器件的离散性产生LED显示亮度的偏差。4. 系统的电气隔离设计由于速度信号来自机车的供电系统,为了两者不会因为故障接地产生相互影响,加装了图二中U1进行电气隔离,D1避免信号线反接使U1损坏;加接R2分流电阻,是为了在D1误接过高电压时,减少对U1的电流冲击。二、系统的软件设计:本系统控制软件采用C语言编写。主程序如图三所示。在设计过程中采用了结构化程序设计方法,将程序中的延时、检测数据的换算、显示数据的移位输出等程序编写成不同的功能模块,在程序的执行过程中分别调用。另外,在程序设计过程中还需要注意以下几点:1 延时1的延时时间选择要合理。设计中采用TMR0作为计数器

7、,其最大值是255,如果延时1程序延时时间过长,在速度高时会造成在TMR0的溢出,出现速度高时,显示的速度反而小的现象;如果延时1程序延时时间过短,会出现速度检测偏差过大,速度显示不稳定。2 增加延时2延时程序的目的在于减少检测循环的次数,提高显示的稳定性。3 在程序的设计中,暂存上一次的速度值,在下一次的计算中将两次的速度值相比较,如果不相等时再更新显示值,这样既可以提高显示的稳定性,也可减少由于频繁更新显示数据带来的显示模糊现象。开始初始化清计数器延时1延时到读计数器计算速度更新显示延时2NY图三 主程序流程图两位大LED数字速度表经过二十多台调运加装机车近两年的连续使用证明,速度显示准确

8、,性能稳定可靠,不仅为监控系统提供了准确的速度数据,同时为机车司机的安全驾驶提供了方便。参考资料1. C语言程序设计实践教程崔武子 付钪 鞠慧敏 编著北京清华大学出版社2005年8月第一版 2. PIC单片机原理与接口技术陈国先 主编 北京电子工业出版社 2005年8月第2次印刷 Editors note: Judson Jones is a meteorologist, journalist and photographer. He has freelanced with CNN for four years, covering severe weather from tornadoes t

9、o typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint beeps of the worlds first satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the

10、first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a

11、meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the next one: a space capsule hanging from a crane in the New Mexico desert.Its like the set for a George Lucas movie

12、floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched t

13、he balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line we would be go for launch.I feel this mission was created for me because I am also a journalist and a photographer, but above all I live for taking a leap o

14、f faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not stop me from feeling his pain when a gust of swirling wind kicked up and twisted the partially fi

15、lled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment

16、 on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunday.The weather plays an important role in this

17、 mission. Starting at the ground, conditions 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

18、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), he can expect a lot of turbulence.The ballo

19、on will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll back the door.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 s

20、wimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, 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 jumpWhen he jumps, he is expected to reach the speed o

21、f 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 goes too fast or spins out of control, he has a stabilization parachute that

22、 can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a rese

23、rve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might

24、 not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.

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

当前位置:首页 > 教育教学 > 成人教育


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号