串口_以太网关转换器设计及其在通信供电监控系统中的应.pdf
III Abstract Abstract Serial-Ethernet Converter Design and Its Related Communication Power Monitoring System This text designs a serial-Ethernet converter,serial-Ethernet converter is the equipment that can realize serial interface to connect with RJ-45 interface each other.That is when the serial equipment sends data to Ethernet first through level when after conversion then press Ethernet transfer protocol(TCP/IP)of serial data encapsulation make it become Ethernet frame format packet,then send to Ethernet;Instead,will receive Ethernet frame format packet parsed and packaging,through the level after converting into serial interface,thus completing the serial data and Ethernet frame format data conversion,further realized will not have network interface of communication equipment through the device itself of serial access Ethernet function.The converter mainly consists of four modules:level conversion module,the controller module,network interface module and memory module.Serial conversion module is mainly by the DB9 serial interface and MAX232 level needle of transition chip.One for all kinds of electrical equipment DB9 namely in the extensive use of RS-232 serial interface,it is whole converter and serial equipment of physical interface.Because digital components level single chip for TTL level and serial interface for RS-232 standard levels,in order to make equipment and SCM can be reliably between on serial communication,design using special chip MAX232 for level conversion.Converter using AT89C52 as micro controller,in the network interface terminal,through to the network interface chip micro-controller is RTL8019AS control to achieve data frame format conversion;Based on RS-232 end,use MAX232 realize TTL level conversion.In converter work,but will all sorts of transmission and conversion of data stored in 62256,by 93C46 and latches 74HC573 constitute memory unit module.In system work have large amount of data to each interface chip processor and RAM,use external to deal with the purpose of which is to improve the MCU data transmission speed and for complex TCP/IP IV protocol processing ability.Because the packet maximum Ethernet can reach more than 1,500 bytes,though the AT89C52 single interior has 8K bytes of Flash memory,but the SCM or cannot storage so big and quantity packets,when large amounts of data sent to the microcontroller will make SCM appear processing power shortfall,only on external RAM,to make SCM can high throughput data.Meanwhile external RAM also used as input and output buffer the serial port.This design in external is added latches 62256 74HC573 and ROM 24C512 to help controller and need to handle data storage past.Serial link layer serial data transceiver function complete network layer,serial ports as part of the TCP/IP application layer,realizes the encapsulation of the serial port frame.Ethernet serial port to transform data transmission is serial link layer receive data from serial equipment serial port,to network layer,the layer of serial data frames finish packaging and put people send buffer,waiting for the Ethernet send control instruction,receive send allow instructions,then open the TCP bag,and until the next step by step to send,physical data transmission of bit torrent,finish.Ethernet data to the serial data flow,is to Ethernet link layer data frame up layered unpack process.Will receive the Ethernet frame,in turn,remove the agreement of each layer of the application layer data,head decomposition serial number field value according to,and sends messages to the corresponding equipment,complete reserve data sending control.Converter communication mainly includes microcontroller AT89C52 single serial port communication and the data communications network interfaces.When receiving data,the first determine whether have started a,no,do not begin to receive,if any,began receiving;Receiving process to decide whether it is receiving enough data,not enough,then ten,data bits continue into buffer,if enough,then began receiving empty buffer,next frame data.In the start sending data,the first judge before calibration and correctly,correctly began to send.When sending process inspection data sending buffer for null,if not null continue to send,is empty will cease to send.Because some of the unit of longer communication equipment network,automation degree is not high,cant directly connected to the Ethernet RJ-45 interface and further connected to the Internet.Through a serial port-Ethernet interface converter design,can be in not eliminated the original communication equipment,will existing serial system through the converter access to Ethernet,and further access the Internet,save the industrial V production costs.This converter the basic principle of design is based on micro controller to network interface chip AT89C52 RTL8019AS control in the corresponding software help achieve conversion function.Is a TCP/IP protocol processing,including physical layer,the transport layer,network layer auto-merging applications and TCP/IP,the ARP,and many other agreement processing.In the conversion process,conversion is the key,this includes data format,voltage level physics switching,etc.Hardware mainly includes serial interface and the Ethernet interface,USES the monolithic as systems control center,in order to increase the system for data processing ability and improve the data processing speed,still designed a memory module.Software program and partly by serial of network interfaces program.Software design work mainly includes microcontroller initialization of serial communication and data sending and receiving treatment,the network interface initialization and RTL8019AS for data sending and receiving treatment.Through this serial-Ethernet switches can make this unit monitoring network optimized,monitoring network system transformation of expansion from the original complex hardware connection into IP expansion model,make monitoring network reconstruction cost reduced greatly,reduce fixed asset investment,reduce maintenance cost,improve work efficiency and realize the sharing information.Key Words:Converters,Serial ports,Ethernet,AT89C52,RTL8019AS,TCP/IP I 目目 录录 第 1 章 绪 论.1 1.1 课题研究的背景.1 1.2 转换器的发展现状.1 1.3 转换器的设计原理.2 1.3.1 硬件组成模块.2 1.3.2 系统软件组成.3 1.4 本文研究的主要内容.4 第 2 章 转换器硬件设计.5 2.1 设计环境与工具简介.5 2.2 系统硬件组成.5 2.3 串口转换模块.6 2.3.1 串口参数配置.6 2.3.2 接口电路.7 2.4 微控制器模块.7 2.4.1 AT89C52 简介.7 2.4.2 接口电路.9 2.5 存储器模块设计.10 2.5.1 功能描述.11 2.5.2 对 62256 的读/写操作.12 2.5.3 模块接口电路设计.13 2.6 网络接口模块.14 2.6.1 RTL8019AS 以太网控制器的参数配置.14 2.6.2 工作原理与控制方法.17 2.6.3 数据发送与接收过程.17 2.6.4 接口电路.18 II 第 3 章 转换器软件设计.20 3.1 开发工具与设计环境简介.20 3.1.1 C 语言使用说明.20 3.1.2 Keil C51 简介.20 3.2 总体工作流程分析.21 3.3 串口模块程序设计.22 3.3.1 定时器/计数器与四种工作方式.22 3.3.2 程序设计.25 3.4 网络接口程序设计.26 3.4.1 以太网帧协议.26 3.4.2 程序设计.27 第 4 章 转换器在通信供电监控系统中的应用.32 4.1 通信供电设备集中监控系统网络总体结构.32 4.2 通信供电设备集中监控系统内容及功能介绍.33 4.2.1 集中监控的内容.33 4.2.2 集中监控的功能.34 4.3 通信供电设备集中监控系统结构组成.36 4.3.1 集中监控系统的数据采集系统.36 4.3.2 集中监控系统的传输系统.37 4.3.3 集中监控系统的软件系统.37 4.4 转换器在监控网改造中的应用.38 第 5 章 结束语.39 参考文献.41 致 谢.43