用于智慧酒店客房控制系统的CAN总线协议研究
2018-10-24王娟包志华杨永杰
王娟 包志华 杨永杰
摘 要: 以STM32单片机为背景,结合智慧酒店客房控制系统的现状,提出一套基于CAN总线的客房控制系统的研究方案。该系统通过CAN总线将每个监控节点连接起来,实时与上位机进行数据交互;监控节点采用内置CAN控制器的STM32F103C8T6作为主控制器,在此基础上自定义了CAN总线应用层协议,形成一个完整的主从通信方案。运行结果表明,此系统稳定性高,成本低,具有广阔的应用前景。
关键词: CAN总线; 智慧控制系统; 酒店客房; STM32F103C8T6; 监控节点; 通信方案
中图分类号: TN915.04?34; TP274 文献标识码: A 文章编号: 1004?373X(2018)20?0104?03
Abstract: A research scheme of the guest room control system based on the CAN bus is proposed by taking the STM32 microcontroller as the background and combining the current status of the intelligent hotel guest room control system. In the system, every monitoring node is connected by using the CAN bus, so as to conduct data interaction with the upper computer in real time. In the monitoring node, the STM32F103C8T6 with the CAN controller embedded is taken as the main controller, and on this basis, the application layer protocol of the CAN bus is defined, so as to form a complete master?slave communication scheme. The operating results show that the system has a high stability, low cost, and broad application prospect.
Keywords: CAN bus; intelligent control system; hotel guest room; STM32F103C8T6; monitoring node; communication scheme
0 引 言
目前,现有与酒店客房控制相關的产品普遍采用RS 485总线通信,其特点决定了它的实时性与可靠性不高,且随着参与通信的设备类型与数量的迅速增多,RS 485总线通信的不足之处日益显现[1]。本文采用CAN总线来完成控制模块与设备间的信息通信,利用CAN总线的高速率、高可靠性、低出错率以及总线冲突预防机制,来提高通信过程的稳定与高效,实现多节点同时监控[2]。
由于CAN总线在物理层和数据链路层上自带内部协议,没有规定应用层,本身并不完整。在基于CAN BUS的分布式客房控制系统中,有些附加功能需要一个高层协议来实现,因此有必要建立一个高层协议,能够在 CAN 网络中实现统一的通信模式,执行网络管理功能,以及提供设备功能描述方式。目前真正占领市场的两个应用层协议是:DeviceNet协议和CANOpen协议[3]。DeviceNet协议适应于工业自动化控制;CANOpen协议适应于产品部件内部的嵌入式网络,在汽车、电梯、医疗仪器以及船舶运输等领域均有广泛的应用,但是这些协议针对的主要是工控领域,在物联网和楼宇控制领域并没有这样的协议存在,本文的协议由此应运而生。……
