基于Java异步串行通信技术的研究
作者:
作者单位:

(四川大学 电气信息学院,成都 610065)

作者简介:

马 赛(1992-),男,北京人,本科,主要从事信号与信息处理方向的研究。[FQ)]

中图分类号:

TP312JA

基金项目:

航空科学基金项目(20100119004);国家级大学生创新创业训练计划项目(201310610109)。


Study of Asynchronous Serial Communication Technology Based on Java Communication API
Author:
Affiliation:

(School of Electrical and Information Engineering, Sichuan University, Chengdu 610065,China)

  • 摘要
  • | |
  • 访问统计
  • |
  • 参考文献 [11]
  • | | | |
  • 文章评论
    摘要:

    Java Communication API是Java平台下用于串口通信程序开发的唯一官方解决方案,Java串口通信程序均可以由官方提供的开发包中的示例程序括展;但以示例程序为基础开发的Java串口通信程序一般都存在着在异步通信模式下无法完整接收长串数据的缺陷;为解决这一问题,根据通信前收发信双方可以约定通信的数据长度这一特点,提出一种对接收到的字节进行计数的方法,以接收的数据长度为指标判断通信是否结束;通过实际编程验证,该方法克服了上述缺陷,具有很好的可行性与实用性,可以广泛应用于各种使用Java Communication API进行开发的场合。

    Abstract:

    Java Communication API is the only official solution for serial communication. Java serial communication program can be developed based on the sample in the Java Communication API developer toolkit, but such program has the defect that it cannot receive long data string continuously in asynchronous mode. In order to solve this problem, according to the characteristic that transceiver both sides know the length of data to be transferred in asynchronous mode, proposed a method which is to count the number of bytes received, using the counted number as the criteria to judge whether the communication is ended. Verified by programming, the method overcomes the shortcoming above. It is proved that the method has good feasibility and practicality, and can be widely used in various programming using the Java Communication API.

    参考文献
    [1] Oracle Corporation.Java Communications API [EB/OL].[2014-2-2].http://www.oracle.com/technetwork/java/index-jsp-141752.html, 2012.
    [2] 丁振凡, 王小明, 吴小元, 等.客车电气绝缘智能检测系统工控机端设计.计算机测量与控制, 2012,20(11):2940-2942.
    [3] 李良, 朱善安.基于Java的串口通信 .电子器件, 2007,(2):714-720.
    [4] 陆颖瑜, 张永林.利用Java实现对云台和镜头的远程控制 .工程设计学报, 2007,(8):324-328.
    [5] 吴兴军, 胡汉春.Java实现计算机与OMRON PLC串口通信.工业仪表与自动化装置, 2010,(1):84-91.
    [6] 李新源, 赵树法, 魏宗寿.基于Java语言的GPS接收机的串口通信程序设计 .铁路计算机应用, 2007,6(5):4-6.
    [7] Oracle Corporation.javax.comm package [EB/OL].[2014-2-2].http://docs.oracle.com/cd/E17802_01/products/products/javacomm/reference/api/javax/comm/package-summary.html, 2004.
    [8] Sun Microsystems.SimpleRead.java[CP/OL].[2014-2-2].
    [9] Oracle Corporation.InputStream (Java Platform SE 6)[EB/OL].[2014-2-3].http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html.[ZK)]
    [10] Eckel B, 陈昊鹏译.Java编程思想.第四版.北京:机械工业出版社, 2007.
    [11] Horstmann C S, Cornell G.JAVA核心技术卷I:基础知识.第8版.叶乃文,等译.北京:机械工业出版社, 2008.
    相似文献
    引证文献
    网友评论
    网友评论
    分享到微博
    发 布
引用本文

马赛,王忠,陈典.基于Java异步串行通信技术的研究计算机测量与控制[J].,2014,22(8):2644-2646,2649.

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2014-05-13
  • 最后修改日期:2014-06-10
  • 在线发布日期: 2014-12-16
文章二维码