摘要
目的设计了一种应用于智能穿戴设备的串行通信协议,以满足穿戴设备和移动平台之间数据透明传输的需求。方法根据传输数据的内容将通信帧分为数据帧、命令帧和响应帧,设计了帧内容的格式;使用转义字符的方法实现数据的透明传输;通信协议用C语言进行了实现,给出单字节发送和接收的程序处理流程图;借助单片机实验板(从机)和串口调试助手软件(主机),对协议进行了验证测试。结果从主机端发送命令帧,然后接收来自从机端的响应帧和数据帧。从测试结果看,从机能够按命令做出正确的响应;同时,当采样数据内容中出现了协议字符时,能够按照协议规定对数据字符进行转换后再行发送。结论协议解决了数据透明传输的需求,尽管引入转义字符后会降低一部分通信的效率,但提高了通信的可靠性。
Objective A serial communication protocol for the smart wearable device was designed and aimed to meet requirement of the transparent transmission between the wearable device and mobile platform.Methods The communication frame was divided into three types:data frame,command frame and respond frame according to transmission content.The format of frame content was specified.The transparent transmission of data was realized by the escape character.The protocol was implemented with the C programming language and the program flowchart of a single byte sending and receiving was provided.Finally,the communication protocol was tested in the single chip microcontroller experimental board(Slave)combined with the software of the serial port debugging aid(Master).Results The command frame was send from Master and then received the respond frame and data frame from Slave.Slave could respond correctly to command frame from Master.Meanwhile,the sampling data could first translate according to the rule of protocol when the escape character was found and then sent.Conclusions This communication protocol solved the problem of transparent transmission.Although the efficiency of communication may decrease after the introduction of escape character,the reliability of communication increased.
作者
范能胜
张怀岺
FAN Nengsheng;ZHANG Huailing(School of Biomedical Engineering, Guandong Medical University, Dongguan, Guandong Province 523808)
出处
《北京生物医学工程》
2020年第4期431-436,共6页
Beijing Biomedical Engineering
基金
国家自然科学基金(81871433)资助。
关键词
穿戴设备
串行通信
通信协议
数据帧
透明传输
wearable device
serial communication
communication protocol
data frame
transparent transmission