串口到CAN总线转换器的设计
摘 要 CAN总线是近些年新兴的一种串行现场总线,由于CAN总线的信号传输时间短,受干扰的概率低。当节点错误严重时,具有自动关闭功能,以切断该节点与总线的联系,是总线上的其他节点及通信不受影响,具有将强的抗干扰能力。以上优点使CAN总线成为最有前途的现场总线之一。 RS422是一种较早的集成式串行通讯协议,使用广泛,很多变频器、可编程控制器和各种智能仪表都带有RS422接口。如果将其接入到CAN总线网络中去,更换所有仪器仪表显然很不明智。最为简单的是设计一种转换器,它可以把RS422总线转换成性能更好的、稳定性更强的CAN总线,我们这次要设计的就是一种从RS422到CAN转换的器件。它可以将仪表上传输过来的数据转换成CAN协议下的数据,并将其与发送到其他节点;也可以将总线上其他节点上的数据传输到带有RS422的仪器仪表中。这种转化器的价格低廉,性能优异,在船体的网络设计中有很广泛的实际应用。 关键词:CAN总线;转换器;单片机 ABSTRACT The CAN bus is a kind of new developing serial filedbus in recent years, because the signal transmission time of the CAN bus is short, the probability interfered is low. When the nodal mistake is serious, close the function automatically, in order to cut off the connection between this node and the bus, it does not influence other node and communication of the bus, have better anti-interference ability. The above-mentioned advantages make the CAN bus become one of the most promising filedbus. RS422 is a kind of earlier integrating type serial communication agreement, and use extensively. A lot of frequency converters, programmable controller and various kinds of intelligent instruments have RS422 connect. If insert it to the CAN bus network, it is obviously very unwise to change all instrument and apparatus. The simplest one way is to design a kind of converter, it can change RS422 bus into the CAN bus. What we will design is a kind of device changed from RS422 to CAN. It can change the data under the RS422 agreement into the data under the CAN agreement, and sends it to other nodes; The CAN bus transmit the data to other nodes on the bus to the instrument and apparatus with RS422 too. This kind of transformation device is cheap, so there is very extensive practical application in the design of the hull. Key words: CAN; converter; Single_Chip Microcomputer 目 录 第一章 绪论 ...................................................1 1.1 组合导航的产生与发展....................................1 1.2 CAN总线和RS422总线在组合导航中的作用..................2 1.3 RS422总线介绍 ..........................................3 1.3.1串行通讯和RS422系列标准............................3 1.3.2 RS422电气规定......................................5 1.4 CAN总线介绍............................................6 1.4.1现场总线形成与发展..................................6 1.4.2 CAN总线工作方式与特点..............................8 1.5 RS422到CAN总线转换器设计..............................11 1.5.1 RS422到CAN总线转换器意义.........................11 1.5.2 RS422到CAN总线转换器设计要求.....................12 1.5.3 RS422到CAN总线转换器设计方案.................... 13 1.6本章小结................................................13 第二章 转换器硬件设计.......................................15 2.1单片机及所用器件简介....................................15 2.1.1 C8051F040单片机的特点和应用.......................16 2.1.2 PCA82C250总线收发器...............................19 2.1.3通讯扩展器件TL16C554..............................22 2.1.4 RS422转换器件MAX1490A............. ..............25 2.2 电路设计软件PROTEL 99的使用方法........................26 2.2.1 PROTEL 99简介.....................................26 2.2.2电路板设计步骤....................................27 2.2.3硬件电路原理图的设计..............................28 2.3本章小结................................................28 第三章 转换器的软件设计.....................................31 3.1 单片机软件程序设计过程..................................31 3.2 所需器件的软件和协议应用........................ .......31 3.3 配置CAN寄存器.........................................33 3.3.1 CAN报文对象初始化处理.............................34 3.3.2 发送与接受对象的配置..............................35 3.3.3 中断处理..........................................37 3.3.4 TL16C554初始化....................................38 3.4 转换器工作原理流程图....................................40 3.5系统程序设计............................................43 3.5.1主程序............................................43 3.5.2子程序部分........................................44 3.5.3 两个中断子程序....................................44 3.6本章小节................................................44 第四章 换器的调试..........................................46 结论 ..........................................................48 参考文献.....................................................49 致谢...........................................................50 附录...........................................................51
[1] [2] 下一页 |