CN101895462B - Serial communication gateway - Google Patents

Serial communication gateway Download PDF

Info

Publication number
CN101895462B
CN101895462B CN 201010102053 CN201010102053A CN101895462B CN 101895462 B CN101895462 B CN 101895462B CN 201010102053 CN201010102053 CN 201010102053 CN 201010102053 A CN201010102053 A CN 201010102053A CN 101895462 B CN101895462 B CN 101895462B
Authority
CN
China
Prior art keywords
data
address
packet
gateway
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 201010102053
Other languages
Chinese (zh)
Other versions
CN101895462A (en
Inventor
袁亚军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wanfeng Culture Communication Co Ltd
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN 201010102053 priority Critical patent/CN101895462B/en
Publication of CN101895462A publication Critical patent/CN101895462A/en
Application granted granted Critical
Publication of CN101895462B publication Critical patent/CN101895462B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a serial communication gateway, comprising an Ethernet communication port and a serial communication port. The Ethernet communication port is connected with an upper computer, and the serial communication port connected with a lower computer. The gateway and the lower computer are uniformly numbered. The gateway comprises a configuring module, a data receiving and transmitting module, a preanalyzing module, a transparent data transmitting module and a data analyzing module, wherein the configuring module is used for configuring the gateway address, local data zone and destination/serial port path; the data receiving and transmitting module is used for receiving and transmitting the packets of the Ethernet communication port and serial communication port, wherein the packets comprise a destination address, a data address and a data value; the preanalyzing module is used for extracting the destination address from the packet; the transparent data transmitting module is used for transmitting the packets to the corresponding port; and the data analyzing module is used for processing the data value in the packets according to the data address and local data zone in the packets. The serial communication gateway can expand and support multiple protocols and ensure the quick exchange of the common data through combining the local data zone and the transparent data transmitting module.

Description

Serial communication gateway
Technical field
The present invention relates to a kind of communication gate, relate in particular to a kind of serial communication gateway.
Background technology
Ethernet and on-the-spot universal serial bus are industrial automation field communication modes commonly used, in fact, no matter are field bus or EPA, the situation that has all formed many standards and deposited; Kind of fieldbus surplus existing about 40 in the world at present, like the FIP of France, the ERA of Britain, the ProfiBus of Siemens Siemens; The FINT of Norway, the LONWorks of Echelon company, the InterBus of PhenixContact company, the CAN of RoberBosch company; The HART of Rosemounr company, the Dupline of CarloGarazzi company, the P-net of Denmark ProcessData company; The F-Mux of PeterHans company, and ASI (ActraturSensorInterface), MODBus; SDS, Arcnet, International Standards Organization-foundation fieldbus FF:FieldBusFoundat ion; WorldFIP, BitBus, the DeviceNet of the U.S. and ControlNet or the like.These fieldbus mostly are used for fields such as process automation, field of medicaments, processing and manufacturing, communications and transportation, national defence, space flight, agricultural and building, and in protocol conversion, heterogeneous network access procedure, gateway plays an important role.
Serial communication gateway commonly used at present comprises ethernet communication port that connects host computer and the communication port that is connected slave computer; Serial communication gateway generally all is to transmit packet according to the address, point of destination; Because industry control agreement commonly used is various; The employing data transparency is transmitted, and serial communication gateway only need be done simple FPDP conversion to Ethernet and on-the-spot universal serial bus, does not need concrete resolution data; Therefore can connect various existing field apparatuss, guarantee that gateway has good expanded function.
Above-mentioned serial communication gateway; Because the transmission rate of Ethernet and on-the-spot universal serial bus does not generally match; The rate-constrained of whole communication gate in transmission rate the slowest COM1, in order to guarantee not packet loss of data, serial communication gateway generally all will use message queue to do buffering.Along with improving constantly of communicating requirement, when guaranteeing that gateway has good expanded function, be necessary to provide the quick exchange of communication data commonly used.
Summary of the invention
Technical problem to be solved by this invention provides a kind of serial communication gateway, can expand the support various protocols, can guarantee the quick exchange of frequently-used data again.
The present invention solves the problems of the technologies described above the technical scheme that adopts to provide a kind of serial communication gateway; Comprise ethernet communication port that connects host computer and the communication port that is connected slave computer; Wherein, The unified numbering of said gateway and said slave computer, said gateway comprises configuration module, and gateway address, local data district and point of destination/serial port path configurations is provided; Data transmit-receive module, the packet of transmitting-receiving ethernet communication port and communication port, said packet comprises address, point of destination, data address and data value; Parsing module extracts the address, point of destination in the packet in advance; The data transparency forwarding module if the address, point of destination in the packet is not a gateway address, is transmitted packet to the corresponding port according to address, point of destination in the packet and port path configuration; Data resolution module if the address, point of destination in the packet is a gateway address, is handled the data value in this packet according to data address in the packet and local data district.
Above-mentioned serial communication gateway, wherein, said local data district is the static configuration data district that said configuration module provides.
Above-mentioned serial communication gateway, wherein, said local data district is the dynamic configuration data district that said configuration module provides; Said preparatory parsing module extracts the data address in the packet; If said data address does not belong to the local data district, temporary this packet is in certain threshold value; If collect the read-write requests of different port to this data address, then this data address of dynamic assignment is to the local data district.
Above-mentioned serial communication gateway; Wherein, If the address, point of destination in the packet is specified said serial communication gateway and slave computer simultaneously; Said data transparency forwarding module is transmitted this packet to message queue, when message queue length surpasses threshold value, said data resolution module adopt successively packet in the processing messages formation of local data district until message queue length less than threshold value.
Above-mentioned serial communication gateway, wherein, said local data district is the internal storage data district, restart the back and recover the local data district from fixed memory device to fixed memory device in said gateway timed backup local data district.
The present invention contrasts prior art has following beneficial effect: serial communication gateway provided by the invention; Support various protocols through the expansion of data transparency forwarding module; The quick exchange of frequently-used data be can guarantee again through the local data district, protocol extension and fast data exchange taken into account.In addition, serial communication gateway of the present invention can also use data forwarding module and local data function of exchange simultaneously and adjust data exchange ways automatically according to network service speed.
Description of drawings
Fig. 1 is that serial communication gateway of the present invention connects sketch map;
Fig. 2 is a serial communication gateway structured flowchart of the present invention;
Fig. 3 is a serial communication gateway main flow chart of the present invention;
Fig. 4 is a serial communication gateway dynamic assignment local data of the present invention district flow chart;
Fig. 5 is that the present invention utilizes local data district quick exchange schematic diagram data;
Fig. 6 is that the present invention utilizes data transparency forwarding module swap data sketch map.
Among the figure:
11 host computers, 12 serial communication gateways
13 slave computers, 21 configuration modules
22 data transmit-receive modules, 23 preparatory parsing modules
24 data transparency forwarding modules, 25 data resolution modules
Embodiment
Below in conjunction with accompanying drawing and embodiment the present invention is done further description.
Fig. 1 is that serial communication gateway of the present invention connects sketch map; Fig. 2 is a serial communication gateway structured flowchart of the present invention.
See also Fig. 1 and Fig. 2; Serial communication gateway 12 provided by the invention; Comprise the ethernet communication port that connects host computer 11 and be connected slave computer 13 communication ports, wherein, said gateway 12 and said slave computer 13 unified numberings; Said gateway comprises configuration module 21, and gateway address, local data district and point of destination/serial port path configurations is provided; Data transmit-receive module 22, the packet of transmitting-receiving ethernet communication port and communication port, said packet comprises address, point of destination, data address and data value; Parsing module 23 extracts the address, point of destination in the packet in advance; Data transparency forwarding module 24 if the address, point of destination in the packet is not a gateway address, is transmitted packet to the corresponding port according to address, point of destination in the packet and port path configuration; Data resolution module 25 if the address, point of destination in the packet is a gateway address, is handled the data value in this packet according to data address in the packet and local data district.
Above-mentioned serial communication gateway 12 is supported various protocols through 24 expansions of data transparency forwarding module, through the quick exchange that the local data district can guarantee frequently-used data again, has taken into account protocol extension and fast data exchange.Fig. 1 has provided dual serial communication gate 12, and one of them backs up, and forms redundant system, during actual the use, also can singlely use certainly.
Fig. 3 is a serial communication gateway main flow chart of the present invention.
See also Fig. 3, serial communication gateway main flow of the present invention is following:
Step S301: serial communication gateway system initialization; Configuration module 21 provides gateway address, local data district and port path configuration; Wherein, the port path configuration comprises the station number of serial communication gateway station number and slave computer that each communication port connects, and gets into step S302 then;
Step S302: the packet of data transmit-receive module 22 transmitting-receiving Ethernet interfaces and communication port, communication port can be the fieldbus of using always, receives entering step S303 behind the packet;
Step S303: preparatory parsing module 23, extract the address, point of destination in the packet, get into step S304 then;
Step S304: whether the address, point of destination in the judgment data bag is this gateway address, if get into step S306, otherwise gets into step S305;
Step S305: data transparency forwarding module 24; Transmit packet to the corresponding port according to address, point of destination in the packet and port path configuration; And carry out simple format conversion between Ethernet interface and the communication port, concrete packet is not done to resolve and handle;
Step S306: data resolution module 25 is responsible for the resolution data bag, to read request packet, according to the data address in the packet, searches corresponding value in the local data district and makes up respond packet; To writing request package, according to data address in the packet and data value, search corresponding address variable in the local data district, upgrade the variables corresponding value and make up respond packet;
Repeat above-mentioned steps S302~step S306 and promptly accomplish serial communication gateway main flow processing of the present invention.
Above-mentioned serial communication gateway; Said local data district is the static configuration data district that is provided by said configuration module 21; In the packet of receiving in the serial communication gateway work,, the data address of request visit then exchanges data can't be provided if not belonging to the local data district.
Fig. 4 is a serial communication gateway dynamic assignment local data of the present invention district flow chart.
See also Fig. 4, serial communication gateway dynamic assignment local data of the present invention district flow process is following:
Step S401: the packet of data transmit-receive module 22 transmitting-receiving Ethernet interfaces and communication port, communication port can be the fieldbus of using always, receives entering step S402 behind the packet;
Step S402: preparatory parsing module 23, extract the address, point of destination in the packet, if the address, point of destination is a gateway address, continue to extract the data address in the packet, get into step S403 then;
Step S403: whether the judgment data address is positioned at the local data district, if then give the data resolution module in the main flow, otherwise gets into step S404;
Step S404: continue to judge that gateway has or not the read-write requests that receives from different port,, otherwise get into step S406 if get into step S405;
Step S405: this data address of dynamic assignment is given the data resolution module in the main flow then to the local data district;
Step S406: only receive the request of reading or writing, the temporal data bag, repeating step S401~step S406, if receive a certain data address read or write then this data address of dynamic assignment to the local data district, otherwise surpass threshold value sometime, packet discard.
In addition; Serial communication gateway of the present invention can also use data forwarding module and local data function of exchange simultaneously; Can specify the address, point of destination simultaneously from the request package of host computer 11 is said serial communication gateway and a certain slave computer; Said data transparency forwarding module 24 is transmitted this packet to message queue, promptly when the serial network port communication is smooth and easy, adopts forwarding capability to obtain initial data as far as possible.But when message queue length surpasses threshold value; Said data resolution module 25 adopt successively packet in the processing messages formation of local data district until message queue length less than threshold value; Promptly when the serial network port communication blocks up, utilize the local data district on the gateway that fast data exchange is provided.
Above-mentioned serial communication gateway, said local data district often adopts the internal storage data district, and local data district like hard disk or USB flash disk, automatically from fixed memory device recovered after restarting to fixed memory device by said gateway timed backup local data district.
In order further to describe the exchanges data flow process of gateway of the present invention, be example with Modbus agreement commonly used below, specify the process that gateway of the present invention utilizes local data district exchange Modbus data.
Fig. 5 is that the present invention utilizes local data district quick exchange schematic diagram data.
See also Fig. 5; Controller Controller links to each other with serial communication gateway 12 through Ethernet interface as host computer 11; The Modbus serial device links to each other with serial communication gateway 12 through the RS485 communication port as slave computer 13, and wherein, controller Controller and Modbus serial device are as the Master of main website; Serial communication gateway 12 utilizes local data district ModbusData that fast data exchange is provided as slave station Slave.The Modbus communication mode comprises broadcast type and replys formula that wherein, the request package form is following:
The address, point of destination Function code Initial address is high-order The initial address low level The register number is high-order Register is counted low level Byte count Data Checksum CRC
The respond packet form is following:
The address, point of destination Function code Initial address is high-order The initial address low level The register number is high-order Register is counted low level Checksum CRC
The address, point of destination of standard Modbus agreement is a byte, is said serial communication gateway and a certain slave computer in order to specify the address, point of destination simultaneously, and the present invention can be appointed as the slave computer station number with wherein low four, and Gao Siwei specifies gateway address.If slave computer equipment surpasses 16, can the extended address byte be 2 byte also then.
The data variable of ModbusData; It is the register number; Comprise coiled type state variable (Coil status), input switch amount (Input status), input register variable (Input register); Internal register variable (Holding register) and extended register variable (Extended register), concrete data address is distributed as follows:
Coil?status:1-9999
Input?status:10001-19999
Input?register:30001-39999
Holding?register:40001-49999
Extended?register:600001-665535
Local data district ModbusData is according to can be according to the use needs, or static state or the above-mentioned data field of dynamic-configuration.
Controller Controller goes up communication module ModnetM and sends the Modbus/TCP request package, and Modbus/TCP is that Modbus forms the TCP information frame according to the Modbus call format, like step 1.; Comprise address, point of destination, data address and request command in the request package; Wherein, the address, point of destination is the station number of serial communication gateway 12, and serial communication gateway 12 is received request package; Utilize ModbusData to make up respond packet, 2. like step.In like manner, the Modbus serial device sends the Modbus request package, like step 3.; Comprise address, point of destination, data address and request command in the request package; Wherein, the address, point of destination is the station number of serial communication gateway 12, and serial communication gateway 12 is received request package; Utilize ModbusData to make up respond packet, 4. like step.Controller Controller and Modbus serial device; One-period property is read the ModbusData on the serial communication gateway 12; Another periodically writes the ModbusData on the serial communication gateway 12, promptly accomplishes the fast data exchange between controller Controller and Modbus serial device.
Fig. 6 is that the present invention utilizes data transparency forwarding module swap data sketch map.
See also Fig. 6; After serial communication gateway 12 is received the request package on the host computer 11, like step 1., carry out simple port format conversion; Be about to convert Modbus to based on serial ports based on the Modbus/TCP of Ethernet; Preparatory parsing module on the serial communication gateway 12 23 extracts the address, point of destination of request package then, and shuts the binding relationship of each serial port and purpose station number according to Home Network, transmits the slave computer 13 that request package is given correspondence from the corresponding port; Be Modbus Serial Device, 2. like step; The Modbus serial device, after promptly slave computer 13 is received the Modbus request package that forwards, the response bag, like step 3., serial communication gateway 12 transmitted response bags are given host computer 11, like step 4..Through above-mentioned steps 1.~4., host computer 11 is accomplished an exchanges data with slave computer 13.
Though the present invention discloses as above with preferred embodiment; Right its is not that any those skilled in the art are not breaking away from the spirit and scope of the present invention in order to qualification the present invention; When can doing a little modification and perfect, so protection scope of the present invention is when being as the criterion with what claims defined.

Claims (4)

1. a serial communication gateway comprises it is characterized in that ethernet communication port that connects host computer and the communication port that is connected slave computer, the unified numbering of said gateway and said slave computer, and said gateway comprises:
Configuration module provides gateway address, local data district and point of destination/serial port path configurations;
Data transmit-receive module, the packet of transmitting-receiving ethernet communication port and communication port, said packet comprises address, point of destination, data address and data value;
Parsing module extracts the address, point of destination in the packet in advance;
The data transparency forwarding module if the address, point of destination in the packet is not a gateway address, is transmitted packet to the corresponding port according to address, point of destination in the packet and port path configuration;
Data resolution module if the address, point of destination in the packet is a gateway address, is handled the data value in this packet according to data address in the packet and local data district;
If the address, point of destination in the packet is specified said serial communication gateway and slave computer simultaneously; Said data transparency forwarding module is transmitted this packet to message queue; When message queue length surpasses threshold value, said data resolution module adopt successively packet in the processing messages formation of local data district until message queue length less than threshold value.
2. serial communication gateway according to claim 1 is characterized in that, said local data district is the static configuration data district that said configuration module provides.
3. serial communication gateway according to claim 1 is characterized in that, said local data district is the dynamic configuration data district that said configuration module provides; Said preparatory parsing module extracts the data address in the packet; If said data address does not belong to the local data district, temporary this packet is in certain threshold value; If collect the read-write requests of different port to this data address, then this data address of dynamic assignment is to the local data district.
4. according to the described arbitrary serial communication gateway of claim 1 to 3, it is characterized in that said local data district is the internal storage data district, restart the back and recover the local data district from fixed memory device to fixed memory device in said gateway timed backup local data district.
CN 201010102053 2010-01-28 2010-01-28 Serial communication gateway Expired - Fee Related CN101895462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010102053 CN101895462B (en) 2010-01-28 2010-01-28 Serial communication gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010102053 CN101895462B (en) 2010-01-28 2010-01-28 Serial communication gateway

Publications (2)

Publication Number Publication Date
CN101895462A CN101895462A (en) 2010-11-24
CN101895462B true CN101895462B (en) 2012-12-19

Family

ID=43104535

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010102053 Expired - Fee Related CN101895462B (en) 2010-01-28 2010-01-28 Serial communication gateway

Country Status (1)

Country Link
CN (1) CN101895462B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098800B (en) * 2010-12-28 2014-09-10 中兴通讯股份有限公司 Processing device and processing system for mobile gateway, and method for processing data
CN102938728B (en) * 2012-10-18 2015-08-19 北京经纬纺机新技术有限公司 A kind of Modbus TCP/IP turns the implementation method of the gateway of Modbus serial
CN105282019B (en) * 2014-12-29 2018-11-02 中国科学院沈阳自动化研究所 Data gateway based on service can configure method and system
CN105812346B (en) * 2015-12-12 2019-03-29 重庆川仪自动化股份有限公司 A kind of data interactive method of serial equipment and ethernet device
CN107276870B (en) * 2017-06-15 2020-08-28 上海一诺仪表有限公司 Data transmission method and device of instrument lower computer
CN110166481A (en) * 2019-06-03 2019-08-23 易事特智能化系统集成有限公司 A kind of power equipment protocol conversion system and method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1482782A (en) * 2003-06-20 2004-03-17 上海大学 Method and apparatus for protocol switch between MODBUS/TCP industrial Ethernet and device network field bus
CN1848826A (en) * 2006-04-30 2006-10-18 中国移动通信集团公司 Family gateway equipment
CN101482643A (en) * 2009-02-23 2009-07-15 中国科学院光电技术研究所 Two-dimensional large-caliber quick control reflector

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1482782A (en) * 2003-06-20 2004-03-17 上海大学 Method and apparatus for protocol switch between MODBUS/TCP industrial Ethernet and device network field bus
CN1848826A (en) * 2006-04-30 2006-10-18 中国移动通信集团公司 Family gateway equipment
CN101482643A (en) * 2009-02-23 2009-07-15 中国科学院光电技术研究所 Two-dimensional large-caliber quick control reflector

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王银玲 等.基于单片机的以太网与RS485通信网关的设计.《工矿自动化》.2008,(第4期),92-94. *

Also Published As

Publication number Publication date
CN101895462A (en) 2010-11-24

Similar Documents

Publication Publication Date Title
JP7024047B2 (en) EtherCAT master-slave integrated bridge controller and control method
CN101895462B (en) Serial communication gateway
US8478908B2 (en) Fieldbus gateway using virtual serial filedbus port and data transmission method thereof
CN101917316B (en) Communication method and device for high-speed real-time industrial Ethernet
CN101454763B (en) Gateway for data transfer between serial buses
US9467309B2 (en) Network distributor
US7900115B2 (en) Replacement messages for identifying and preventing errors during the transmission of realtime-critical data
CN105187283A (en) Industrial control network slave station communication method and device based on EtherCAT protocol
CN212163361U (en) Two main station controller communication systems
CN102035688B (en) Design method for rapidly controlling network link access
CN103746783A (en) Extended communication method based on Modbus communication protocol
CN102843288A (en) Method for transmitting data packets
CN104009976A (en) Real-time communication method and equipment used among multiple main station systems
US20100146225A1 (en) Acyclic data transfer via a field bus coupler
CN111587560A (en) Master-slave bus system and method for operating a bus system
CN102238055A (en) Downloading method and system based on MDIO (Management Data Input/Output) interface
CN102255800A (en) Method for converting data format between IP (Internet Protocol) data packages on CAN (Control Area Network) bus and CAN messages
CN101415027B (en) Communication module based on HDLC protocol, and control method for data real time forwarding and storage
CN103248547A (en) Fast data capture method for slave station in Modbus RTU (remote terminal unit) and slave station
US6907488B1 (en) Serial data transmission via a bus system
US20110142074A1 (en) Serial communication module with multiple receiver/transmitters
CN103346943A (en) Method and system of data transmission
CN101753486A (en) Industrial automation field bus gateway equipment
US8554966B2 (en) Method for data exchange
CN202093355U (en) Programmable logic controller (PLC) Ethernet communication module

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: SHANGHAI WANFENG CULTURAL TRANSMISSION CO., LTD.

Free format text: FORMER OWNER: YUAN YAJUN

Effective date: 20150225

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 201101 MINHANG, SHANGHAI TO: 200335 CHANGNING, SHANGHAI

TR01 Transfer of patent right

Effective date of registration: 20150225

Address after: 200335, Shanghai, Changning District, No. 33, Canton Road, industry and Trade District, B room, North third floor

Patentee after: Shanghai Wanfeng Culture Communication Co., Ltd.

Address before: 201101 Shanghai Minhang District City 1597 Longming Road No. 51 Lane 401

Patentee before: Yuan Yajun

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20121219

Termination date: 20190128