教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 实用模板 >

单片机与PC机串口通信的设计(7)

来源:网络收集 时间:2026-07-17
导读: 可以设置16条定时自动发送的数据,以及每条数据发送后的延时时间; 可以同时监控2个串口,利用特制电缆可监听2个串口设备之间的通讯过程; 发送数据时,可自动计算并添加和校验发送; DTR自动控制是为了方便RS485通讯

可以设置16条定时自动发送的数据,以及每条数据发送后的延时时间; 可以同时监控2个串口,利用特制电缆可监听2个串口设备之间的通讯过程; 发送数据时,可自动计算并添加和校验发送;

DTR自动控制是为了方便RS485通讯测试而添加的功能; 方便的查找功能,使你可以轻松搜索接收文本框中的字符; 使用快捷键可快速调用最近五次发送的不同数据。 5.4 结果

通过软件仿真,单片机可以向PC机发送数据,同时接收PC机发来的数据,完全实现了单片机

与PC机之间点对点的通信。由于5.12地震的影响,毕设暂停了一段时间,加之器材室元器件缺少我所需的器件,硬件电的路焊接也就没有完成。

第21页,共37页

6结语

实验表明,此系统完全实现了PC机与单片机之间点对点的通信,方法简单可靠,基本上在需要用到PC机与单片机串行通信的场合均可采用此种方法。随着近年来PC在国内应用范围的日益壮大,在工业控制、数据采集等领域越来越多的采用PC,本文可以算作是一个有益的尝试。当然在实际应用中还需要考虑一些问题,比如进行出错处理的问题,可以在一个要发送的字符串后再发送一个校验和,当收到返回的校验和与发送的校验和不一致时再进行重发,再比如所采用的RS232C传输距离很短,并且抗干扰能力很差,这时需要将总线转换成差分传输的RS485/RS422。另外,稍加改进,就可实现PC机与多片51单片机的串行通信,这时由于共用一条总线,必须给每个单片机分配一个地址,然后由PC机对总线进行仲裁,只有获得总线使用权的单片机才能与上位机进行通信,这里不再赘述。

总之,本文只是为PC和单片机串行通信提供了一个典型的范例,要应用到实际的项目中去,还需要根据实际的情况具体考虑,灵活应用,最终才能形成一个可靠的基于PC与单片机的串行通信系统。

第22页,共37页

参考文献

[1]王福瑞.单片微机测控系统设计大全[M].北京:北京航空航天大学出版社,1998.06 [2]李华.MCS一51系列单片机实用接口技术[M].北京:北京航空航天大学出版社,1993.07 [3]李朝青.PC机与单片机&DSP数据通信技术选编(1)[M].北京:北京航空航天大学出版社,2003.12

[4]刘金伍.单片机应用与实践[M].北京:北京航空航天大学出版社,1995.08 [5]刘大茂.智能仪器:单片机应用系统设计[M].北京:机械工业出版社,1998.04

[6]万福君,潘松峰.单片微机原理系统设计与应用[M].合肥:中国科学技术大学出版社,2001.01 [7][美]安格斯生.串行端口大全[M].精英科技译.北京:中国电力出版社,2001.01

第23页,共37页

附录A 英文资料

Linux PC and 51 series monolithic integrated circuit serial communication design Abstract: Introduced one kind uses Linux operating system PC machine carries on the correspondence through the serial port and the MCS-51 series monolithic integrated circuit the design method, has given the basic hardware principle and the signal procedure design 2 methods. The experiment proved that, this kind of plan simple reliable, the price is inexpensive, was Linux in domain and so on in industry control applications has provided one solution.

Key word: Linux; Monolithic integrated circuit; Serial communication; Industry control.

The monolithic integrated circuit performance stable, the price inexpensive, the function is formidable, in the intelligent instrument, industry equipment as well as in the everyday use electronic consumable obtained the more and more widespread application. In the monolithic integrated circuit input output control, except directly joins small methods and so on outside keyboard and LCD display monitor, generally all and on position machine PC carries on the correspondence through the serial port, but latter method because can realize the long-distance control, and can use the PC machine formidable data processing function as well as the friendly control interface, appears especially importantly. Carries on the control in general use PC machine to the monolithic integrated circuit the situation, all is uses Windows to take on the position machine platform, its merit is the contact surface is friendly, the programming and the operation quite is all easy, the shortcoming is the stability too is bad, this regarding needs the installment which the consecutive number day or several months move, is especially inappropriate. In the request quite harsh situation, all uses the UNIX workstation to take the master control platform generally, if the Hefei synchronization radiation accelerator master control platform uses is the SUN Solaris workstation system, however the UNIX workstation expensive price has limited its use scope greatly. In recent years, along with the Linux swift and violent development, caused it gradually to turn the mainstream operating system from small number of people's toy. Linux is follows the GPL agreement the free source code opening software, anybody all may free obtain its source program from Internet, also may revise its source code under the GPL agreement to adapt the specific application, its movement on ordinary PC, the performance is stable, is suitable for to make the industry control specially, therefore realizes Linux and the monolithic integrated circuit serial communication has the significance extremely, he may be the substitution method which the expensive UNIX workstation one kind may elect. 1 hardware principle …… 此处隐藏:1242字,全部文档内容请下载后查看。喜欢就下载吧 ……

单片机与PC机串口通信的设计(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/520285.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)