首页> 中文期刊> 《电子设计工程》 >一种基于状态机的串口通信协议的设计与实现

一种基于状态机的串口通信协议的设计与实现

         

摘要

为解决串口通信中的数据传输容易出错、可靠性差、安全性不高且容错能力低等问题,设计并实现了一种基于状态机的串口通信协议,并将此协议应用到称重仪表的上位机通信中。本文介绍了串口通信协议的数据包格式以及其通信状态机,并给出了协议实现的部分示例代码及算法流程图。在数据包格式定义中通过设置起始标志、数据长度、校验、结束标志等字段,保证数据传输的正确性;并在数据包接收过程中引入状态机方法,简化编程模型的同时,提高了通信过程的可靠性、安全性以及数据传输的容错能力。%A serial port communication protocol based on state machine which is designed and implemented in order to solve the problems such as data transmission errors,poor reliability,low security and fault tolerance,is applied to a weighing instrument's PC communication.This paper mainly describes the serial port communication protocol data packet format and its communication state machine,and also gives some code of the protocol and algorithm flow chart Start flag,data length,calibration,and end flag are set to ensure the correctness of data transmission.And state machine is used in the data packet receiving course to simplify programming model,and improve the reliability,security and fault tolerance.

著录项

相似文献

  • 中文文献
  • 外文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号