CN105278918A - Reading method of register and register using reading method - Google Patents
Reading method of register and register using reading method Download PDFInfo
- Publication number
- CN105278918A CN105278918A CN201510673664.9A CN201510673664A CN105278918A CN 105278918 A CN105278918 A CN 105278918A CN 201510673664 A CN201510673664 A CN 201510673664A CN 105278918 A CN105278918 A CN 105278918A
- Authority
- CN
- China
- Prior art keywords
- communication
- register
- reading manner
- read method
- time
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 230000006854 communication Effects 0.000 claims abstract description 56
- 238000004891 communication Methods 0.000 claims abstract description 55
- 230000011218 segmentation Effects 0.000 claims description 32
- 238000010586 diagram Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
Abstract
The invention discloses a reading method of a register and the register using the reading method, wherein the reading method comprises the following steps of (1) calculating the total communication time Tsum1 of a primary request respond in a non-segmented reading mode; (2) calculating the total communication time Tsum2 of the primary request respond in a segmented reading mode; and (3) comparing the Tsum1 and the Tsum2, and determining whether to use the non-segmented mode or the segmented reading mode according to the number value of vacant addresses. The reading method related by the invention can help people to judge whether to use the segmented reading or non-segmented reading mode in the Modbus-RTU communication, so that the proper reading mode is preferentially selected; and the communication efficiency during the register reading is effectively improved.
Description
Technical field
The present invention relates to digital independent field, be specifically related to a kind of read method of register; The invention still further relates to a kind of register, be specifically related to a kind of discontinuous address space holding register adopting this read method.
Background technology
In Modbus communications protocol content; due to reserved or other reason; from the input register of machine or the address space of holding register discontinuous often; vacant a part of address of frequent meeting intermittent in address space; like this when host computer is to monitoring in real time from machine and constantly reading its running status in bus, the data reading mode for discontinuous address space just becomes the key affecting its communication efficiency.Traditional reading manner for discontinuous address space register mainly comprises the following two kinds mode: mode one, not segmentation is read, namely once read all the elements from lowest address to maximum address, comprise and reserving or the content of vacant intermediate address due to other reason, and only resolve significant part in institute's reading of content; Mode two, segmentation is read, and namely reads the data content of each contiguous segmentation part in discontinuous address space respectively one by one.
Consider slave addresses in reading order, function code, start address, register length, the impact of the factors such as check byte, when the vacant scope of address narrow (between as two significant addresses only a vacant address), mode one can improve communication efficiency relative to mode two, but when the vacant scope in address is wider (between as two significant address segmentations vacant 100 addresses), although mode two needs twi-read, but the communication time produced (comprises the time shared by Twice requests frame, time shared by twice response frame, dead times before dead times and two responses before two requests) be often less than the communication time (time shared by a claim frame that mode one produces, time shared by a response frame, dead time before a request, dead time before a response).In sum, these two kinds of modes, are applicable to the vacant situation in different addresses respectively, therefore need the vacant situation according to address space and in conjunction with concrete communication process parameter optimum selecting reading manner.
Summary of the invention
A kind of read method of register is provided in the embodiment of the present invention and adopts the register of this read method, to solve the problem that cannot effectively read when the address space of register occurs vacant in prior art.
For achieving the above object, the invention provides a kind of read method of register, it comprises the following steps: 1) calculate the total communication time Tsum1 once asking to respond taking not segmentation reading manner; 2) the total communication time Tsum2 once asking to respond taking segmentation reading manner is calculated; 3) compare Tsum1 and Tsum2, determine to adopt not segmentation reading manner or segmentation reading manner according to the individual numerical value of idle address.
As preferably, the total communication time responded once is asked to comprise the front dead time T1 of request, response front dead time T2, claim frame holding time and response frame holding time.
As preferably, as e1> (Br/16) (104/Br+T1+T2), select segmentation reading manner, wherein, e1 is vacant address number, and Br is the baud rate of serial communication.
As preferably, under Modbus-RTU communication mode, the claim frame of read input register and holding register is fixed as 8 bytes, and response frame is 5+2*n byte, and wherein, n is expressed as the address number once read.
As preferably, the communication T.T. responded of once asking of not segmentation reading manner is: Tsum1=(16/Br) * (n1+e1+n2)+(104/Br+T1+T2), wherein, n1 and n2 is the number of two sections of effective addresses.
As preferably, the communication T.T. responded of once asking of segmentation reading manner is: Tsum2=(16/Br) * n1+ (104/Br+T1+T2)+(16/Br) * n2+ (104/Br+T1+T2).
As preferably, ask front dead time T1 to be determined by upper machine communication main frame, the front dead time T2 of response is determined from machine by slave computer communication.
The present invention also provides discontinuous address space holding register in a kind of Modbus-RTU communication, and it adopts the read method in technique scheme.
The read method that the present invention relates to can help to judge to adopt segmentation to read still not segmentation reading manner in Modbus-RTU communication, thus the reading manner that optimum selecting is suitable, effectively improve communication efficiency when reading register.
Accompanying drawing explanation
Fig. 1 is the communication T.T. schematic diagram asking in the read method that the present invention relates to respond;
Fig. 2 is with vacant Modbus communication protocol address configuration schematic diagram in the read method that the present invention relates to.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in further detail, but not as a limitation of the invention.
Fig. 1 shows in communication the communication time schematic diagram of asking response, as can be seen from Figure 1 once asks the time responded to comprise request front dead time, claim frame holding time, response front dead time, response frame holding time.Therefore, when calculating the communication T.T. of once asking to respond, first the baud rate of communication of setting up serial ports is Br, before front dead time and response are asked in setting simultaneously, the dead time is set to T1 and T2 respectively, setting claim frame holding time is Trequest, response frame holding time is Tresponse, then once ask the communication T.T. responded to be Tsum, it is expressed as follows:
Tsum=T1+T2+Trequest+Tresponse。
Under Modbus-RTU communication mode, the claim frame of read input register and holding register is fixed as 8 bytes, response frame is 5+2*n byte (n is expressed as the address number once read), and the frame format of claim frame, response frame is respectively as shown in table 1, table 2:
Table 1 claim frame form
Device address | Function code | Start address | Data bulk | CRC check code |
1 Byte | 1 Byte | 2 Bytes | 2 Bytes | 2 Bytes |
Table 2 response frame form
Device address | Function code | Byte number | Valid data | CRC check code |
1 Byte | 1 Byte | 1 Byte | n Bytes | 2 Bytes |
Then:
Claim frame holding time Trequest=(8/Br) * 8
Response frame holding time Trequest=(8/Br) * (5+2*n)
So once ask respond communication T.T. be:
Tsum=T1+T2+Trequest+Tresponse=(16/Br)*n+(104/Br+T1+T2)
General in the communication of specifically monitored system, the baud rate Br of serial communication is fixing, before request, dead time T1 can be determined by host computer (host computer communication), before response, dead time T2 is determined by slave computer (communication is from machine), this shows, once ask the address number n of communication T.T. and the read access responded linear.
Fig. 2 shows the vacant Modbus communication protocol address configuration of band, and wherein, the number of two sections of effective addresses is respectively n1 and n2, and address number vacant is therebetween e1.The embodiment of the present invention can according to the vacant situation of address space, consider the baud rate of serial communication simultaneously and ask the front dead time and the dead time before responding, by comparing communication T.T., preferentially make a choice in not segmentation reading manner and segmentation reading manner.
When reading the register of non-address continuous space under Modbus communications protocol, namely occurring that the communication T.T. account form in specific vacant situation is as follows:
Take not segmentation reading manner once ask respond communication T.T. be:
Tsum1=(16/Br)*(n1+e1+n2)+(104/Br+T1+T2)
Take segmentation reading manner once ask respond communication T.T. be:
Tsum2=(16/Br)*n1+(104/Br+T1+T2)+(16/Br)*n2+(104/Br+T1+T2)
By above-mentioned formula, we adopt not segmentation reading manner and segmentation reading manner in the difference on T.T. that communicates under can judging to occur specific vacant situation.By comparing Tsum1 and Tsum2, calculate when Tsum1>Tsum2 (namely segmentation reading manner is better than not segmentation reading manner), namely, time e1> (Br/16) (104/Br+T1+T2), the communication T.T. of not segmentation reading manner relatively communication T.T. of segmentation reading manner is shorter.
Therefore, for the specific communication adopting Modbus/RTU pattern, when before baud rate Br, request, dead time T1 and the front dead time T2 of response is fixing (generally, these parameters are all fixing), the number of idle address is when being greater than (Br/16) (104/Br+T1+T2), select segmentation reading manner to read register, otherwise adopt not segmentation reading manner to read register.
Embodiments of the invention are only the descriptions carried out the preferred embodiment of the present invention; not design of the present invention and scope are limited; under the prerequisite not departing from design philosophy of the present invention; the various modification that in this area, engineering technical personnel make technical scheme of the present invention and improvement; protection scope of the present invention all should be fallen into; the technology contents of request protection of the present invention, all records in detail in the claims.
Claims (8)
1. a read method for register, is characterized in that, comprises the following steps: 1) calculate the total communication time Tsum1 once asking to respond taking not segmentation reading manner; 2) the total communication time Tsum2 once asking to respond taking segmentation reading manner is calculated; 3) more described Tsum1 and described Tsum2, determines not segmentation reading manner or described segmentation reading manner described in employing according to the individual numerical value of idle address.
2. read method according to claim 1, is characterized in that, the described total communication time responded of once asking comprises the front dead time T1 of request, response front dead time T2, claim frame holding time and response frame holding time.
3. read method according to claim 2, is characterized in that, as e1> (Br/16) (104/Br+T1+T2), select described segmentation reading manner, wherein, e1 is vacant address number, and Br is the baud rate of serial communication.
4. read method according to claim 3, is characterized in that, under Modbus-RTU communication mode, the claim frame of read input register and holding register is fixed as 8 bytes, response frame is 5+2*n byte, and wherein, n is expressed as the address number once read.
5. read method according to claim 4, it is characterized in that, the communication T.T. responded of once asking of described not segmentation reading manner is: Tsum1=(16/Br) * (n1+e1+n2)+(104/Br+T1+T2), wherein, n1 and n2 is the number of two sections of effective addresses.
6. read method according to claim 5, it is characterized in that, the communication T.T. responded of once asking of described segmentation reading manner is: Tsum2=(16/Br) * n1+ (104/Br+T1+T2)+(16/Br) * n2+ (104/Br+T1+T2).
7. the read method any one of claim 1-6 described in claim, is characterized in that, before described request, dead time T1 is determined by upper machine communication main frame, and before described response, dead time T2 is determined from machine by slave computer communication.
8. a discontinuous address space holding register in Modbus-RTU communication, is characterized in that, have employed the read method described in above-mentioned any one claim.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510673664.9A CN105278918B (en) | 2015-10-15 | 2015-10-15 | The read method of register and the register using the read method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510673664.9A CN105278918B (en) | 2015-10-15 | 2015-10-15 | The read method of register and the register using the read method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105278918A true CN105278918A (en) | 2016-01-27 |
CN105278918B CN105278918B (en) | 2017-12-08 |
Family
ID=55147988
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510673664.9A Expired - Fee Related CN105278918B (en) | 2015-10-15 | 2015-10-15 | The read method of register and the register using the read method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105278918B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106781403A (en) * | 2017-02-23 | 2017-05-31 | 湖南工业大学 | A kind of communication technology of the remote data transmission based on LORA and GPRS |
CN106843807A (en) * | 2016-12-22 | 2017-06-13 | 天津力神特种电源科技股份公司 | The adjustment method that vehicle-mounted Li-ion batteries piles are quickly analyzed and positioned |
CN111884915A (en) * | 2020-07-17 | 2020-11-03 | 杭州电子科技大学 | Method for improving efficiency of acquiring modbus equipment by gateway |
CN112073280A (en) * | 2020-09-07 | 2020-12-11 | 合肥阳光新能源科技有限公司 | Communication method and device based on Modbus protocol and communication equipment |
CN112256617A (en) * | 2020-10-23 | 2021-01-22 | 福州富昌维控电子科技有限公司 | Method and terminal for improving serial port communication efficiency of equipment |
CN112291101A (en) * | 2020-11-06 | 2021-01-29 | 珠海格力电器股份有限公司 | Communication node and communication framing optimization method of upper computer to lower computer |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5862391A (en) * | 1996-04-03 | 1999-01-19 | General Electric Company | Power management control system |
US20090287803A1 (en) * | 2008-05-13 | 2009-11-19 | Square D Company | Automated discovery of devices in large utility monitoring systems |
CN101739328A (en) * | 2009-12-16 | 2010-06-16 | 台安科技(无锡)有限公司 | Method for enhancing speed of PC in monitoring singlechip through ModBus protocol |
CN103546467A (en) * | 2013-10-23 | 2014-01-29 | 上海爱控自动化设备有限公司 | Method for transmitting Modbus RTU protocol on TCP/IP network |
CN104038499A (en) * | 2014-06-17 | 2014-09-10 | 宁波三星电气股份有限公司 | MODBUS RTU protocol based data transmission method |
CN104052631A (en) * | 2014-05-22 | 2014-09-17 | 中兴通讯股份有限公司 | Equipment information collecting method, device and system |
CN104407983A (en) * | 2014-12-02 | 2015-03-11 | 上海电器科学研究院 | Modbus address remapping method used for electric quantity module |
CN104486185A (en) * | 2014-12-12 | 2015-04-01 | 中广核工程有限公司 | Control system communication method and system for nuclear power plant |
CN104601420A (en) * | 2014-12-31 | 2015-05-06 | 江西清华泰豪三波电机有限公司 | Method for flexibly reading power station data by utilizing Modbus |
-
2015
- 2015-10-15 CN CN201510673664.9A patent/CN105278918B/en not_active Expired - Fee Related
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5862391A (en) * | 1996-04-03 | 1999-01-19 | General Electric Company | Power management control system |
US20090287803A1 (en) * | 2008-05-13 | 2009-11-19 | Square D Company | Automated discovery of devices in large utility monitoring systems |
CN101739328A (en) * | 2009-12-16 | 2010-06-16 | 台安科技(无锡)有限公司 | Method for enhancing speed of PC in monitoring singlechip through ModBus protocol |
CN103546467A (en) * | 2013-10-23 | 2014-01-29 | 上海爱控自动化设备有限公司 | Method for transmitting Modbus RTU protocol on TCP/IP network |
CN104052631A (en) * | 2014-05-22 | 2014-09-17 | 中兴通讯股份有限公司 | Equipment information collecting method, device and system |
CN104038499A (en) * | 2014-06-17 | 2014-09-10 | 宁波三星电气股份有限公司 | MODBUS RTU protocol based data transmission method |
CN104407983A (en) * | 2014-12-02 | 2015-03-11 | 上海电器科学研究院 | Modbus address remapping method used for electric quantity module |
CN104486185A (en) * | 2014-12-12 | 2015-04-01 | 中广核工程有限公司 | Control system communication method and system for nuclear power plant |
CN104601420A (en) * | 2014-12-31 | 2015-05-06 | 江西清华泰豪三波电机有限公司 | Method for flexibly reading power station data by utilizing Modbus |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106843807A (en) * | 2016-12-22 | 2017-06-13 | 天津力神特种电源科技股份公司 | The adjustment method that vehicle-mounted Li-ion batteries piles are quickly analyzed and positioned |
CN106781403A (en) * | 2017-02-23 | 2017-05-31 | 湖南工业大学 | A kind of communication technology of the remote data transmission based on LORA and GPRS |
CN111884915A (en) * | 2020-07-17 | 2020-11-03 | 杭州电子科技大学 | Method for improving efficiency of acquiring modbus equipment by gateway |
CN112073280A (en) * | 2020-09-07 | 2020-12-11 | 合肥阳光新能源科技有限公司 | Communication method and device based on Modbus protocol and communication equipment |
CN112256617A (en) * | 2020-10-23 | 2021-01-22 | 福州富昌维控电子科技有限公司 | Method and terminal for improving serial port communication efficiency of equipment |
CN112256617B (en) * | 2020-10-23 | 2021-04-20 | 福州富昌维控电子科技有限公司 | Method and terminal for improving serial port communication efficiency of equipment |
CN112291101A (en) * | 2020-11-06 | 2021-01-29 | 珠海格力电器股份有限公司 | Communication node and communication framing optimization method of upper computer to lower computer |
Also Published As
Publication number | Publication date |
---|---|
CN105278918B (en) | 2017-12-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105278918A (en) | Reading method of register and register using reading method | |
CN107347205B (en) | A kind of network slice selection method, apparatus and system | |
US10114749B2 (en) | Cache memory system and method for accessing cache line | |
CN104410557A (en) | Dynamic networking method and communication method based on RS-485 | |
CN109343965A (en) | Resource adjusting method, device, cloud platform and server | |
CN101447894B (en) | Identification of physical address of partial node, network configuration and maintaining method, and network system | |
CN105320561A (en) | Task management method and system | |
CN105119793A (en) | Identifier distribution method of sensor network CAN bus frame format | |
WO2011102698A2 (en) | Method and apparatus for device synchronization and power conservation in a wireless communication system | |
CN103560915A (en) | Method and system for managing resources in cloud computing system | |
KR20140037229A (en) | Identifier assignment method and device in wireless local area network | |
CN105320570A (en) | Resource management method and system | |
CN106533973A (en) | Method and system for distributing service message, and equipment | |
CN106792986A (en) | A kind of radio reception device number of users management method and device | |
CN104615065B (en) | Data processing method and device for train network control system | |
CN115474107A (en) | Intelligent electric energy meter communication method and device, equipment and storage medium | |
CN105592141A (en) | Connection number control method and device | |
CN104346404A (en) | Method, equipment and system for accessing data | |
CN102591594A (en) | Data processing method and equipment | |
CN105471955A (en) | Writing method of distributed file system, client device and distributed file system | |
CN102523107B (en) | The method and device of balanced network management system service end and client computing pressure | |
CN103684950B (en) | Multisensor multiplex bus system and method | |
TW201234897A (en) | Cooperative apparatus and resource block allocation method thereof for use in wireless network | |
CN104519145A (en) | An address resource managing method, system and DHCP server | |
CN106301889B (en) | A kind of port numbers rapid-setting method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
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: 20171208 |