基于 CAN 总线通信协议的设计与实现 窦鹏 刘胜永 (广西工学院电子信息与控制工程系,广西柳州 545006) 中图分类号:TN915 文献标识码:B 摘要: 本文以 C8051F120 单片机为背景,在 CAN 技术规范的基础上提出了一种基于单 片机的 CAN 应用层协议。文中首先设计了一种数据传递格式,它解决了 CAN 规范 只能传递小于 8 字节数据的缺点,实现了大于 8 字节数据的准确传输。并在此基础上,建 立了可靠的收发机制、管理机制和错误处理机制共同维护协议的运转,实现了 CAN 总线 数据方便快捷的传输。 关键词: CAN 总线通信协议 C8051F120 The Design and Realization of Can munication protocol Based on C8051F120 DouPeng LiuShengYong (Dept. of Electric Information and Control Engineering, Guangxi University of Technology, Liuzhou 545006, China) Abstract: This paper proposed a CAN protocol of application layer based on CAN specification with the background of C8051F120 microcontroller. At first, has designed a data format in transfering, which can transfer data more than 8 bytes based on CAN specification and makes up for the shortage of CAN protocol of application layer based on the data structure, and has established the reliable receiving and dispatching mechanism, the management mechanism and the error processing mechanism and so on, which maintains the protocol work smoothly and attains the convenient and prompt transmission through CAN bus. Keyword: CAN;BUS; Communication Protocol; 8051F120 1