CN102495813B - Mining embedded multi-serial-port inquiring method - Google Patents
Mining embedded multi-serial-port inquiring method Download PDFInfo
- Publication number
- CN102495813B CN102495813B CN201110398189.0A CN201110398189A CN102495813B CN 102495813 B CN102495813 B CN 102495813B CN 201110398189 A CN201110398189 A CN 201110398189A CN 102495813 B CN102495813 B CN 102495813B
- Authority
- CN
- China
- Prior art keywords
- serial ports
- serial
- data
- port
- query request
- 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
Links
Landscapes
- Computer And Data Communications (AREA)
Abstract
The invention discloses a mining embedded multi-serial-port inquiring method, which is characterized in that: a first-in first-out (FIFO) queue of a serial-port chip is used for defining serial-port data interruption as a dormancy mode, a serial-port data inquiring mode is defined as an activation mode, a serial port is defined as a three-layer structure and is divided into a physical buffering area, a virtual buffering area and serial port performance, a physical parameter of the serial port is defined as the largest, then the parameters of the serial port virtual buffering area are adjusted through the statistics analysis of the serial port performance so as to improve the serial port performance. The multi-serial-port inquiring method is applied to a coal mine serial-port control device and is proved to be stable and valid.
Description
Technical field
The invention belongs to mining embedded multi-serial-port technical field, introduced a kind of high efficiency many serial-port inquiring methods, by the statistical study of serial ports performance, change in real time serial ports parameter, thereby improve serial ports performance.
Background technology
China's coal mines enterprise is numerous, has adopted a large amount of low speed serial equipments under coal mine, can adopt serial server that these low speed serial equipments are coupled together, or carry out data and gather and control.
Under coal mine, there is following situation:
(1) humidity;
(2) tunnel wind is large and hotter;
(3) often have a power failure, and power off time is long, until accumulator discharges, voltage is often unstable;
(4) dust is large.
Serial server and opertaing device adopt the mode that serial ports interrupts to receive serial data, the limited serial ports that can not support parallel large quantity of serial ports interrupt resources, often interrupt and frequent interruption because the interference on serial ports interrupt line causes some mistakes, have the factor of job insecurity.
Summary of the invention
The object of the invention is to overcome the shortcoming of above-mentioned prior art, a kind of mining embedded multi-serial-port inquiring method is provided, the method is anti-interference, and supports the software inquiry of parallel large quantity serial ports simultaneously.
The object of the invention is to solve by the following technical programs:
1. this mining embedded multi-serial-port inquiring method, this querying method comprises: 1) use the First Input First Output FIFO of serial port chip, the capacity of physical buffer district FIFO is initialized as to maximal value; 2) all serial ports are defined as to a unified data structure, for each serial ports generates a virtual buffering region; 3) serial ports mode of operation is divided into dormancy and activates 2 kinds of states, and data query is enable mode, and data are interrupted for park mode; 4) adopt port numbers priority algorithm, all activation serial ports are generated to a query request, polling cycle is T; 5) calculate the data throughout M of all serial ports; 5) take out current poll port numbers from query request, each poll reads in length L and reads in the data of each port by each serial data, if each inquiry can be read data, the actual data length of reading is V, be defined as effective query one time, do not read data, be defined as once invalid inquiry, for each serial ports generates a search efficiency value K, computing formula is K=V/L.
2. described 2) in, serial ports physical buffer district is maximum fixed length N, and the each reading data length L in serial ports virtual buffering region is elongated, and in the time that serial ports has data, each serial ports receives L byte successively, and L defaults to 1, computing formula L=N*K.
3. described 3) in, increase serial ports performance index S, if serial ports does not have data for a long time continuously, serial ports performance index does not stop to successively decrease, by 0 o'clock, will dormancy, leave query request; Once there be data, serial ports performance index will be filled it up with, and serial ports will activate, and then joins in query request.
4. described 4) in, port numbers priority algorithm is: serial ports completes effective query one time, and serial ports port numbers can be placed on the front of next query request, and serial ports does not complete effective query one time, and serial ports port numbers can be placed on the back of next query request.
5. described serial ports is defined as to three-decker, be respectively: physical buffer district, virtual buffering region and serial ports performance, physical buffer district is physical parameter district, physical parameter is all arranged to maximum, virtual buffering region is variable element district, and the parameter of the analysis and regulation virtual buffering region by serial ports performance is to improve serial ports performance.
Physical buffer district | Serial ports physical base address |
The maximum fixed length N in physical buffer district | |
Virtual buffering region | Serial ports regulation is read in length L |
The actual reading data length of serial ports V | |
Serial ports performance | Serial ports performance index S |
Serial ports load factor C | |
Serial ports search efficiency K | |
Serial data handling capacity M |
6. the concrete steps of whole querying method described in:
A), according to serial ports port numbers priority algorithm, all activated serial ports is generated to a query request;
B) from query request, get current poll port numbers, poll is worked as front port;
C) serial ports reads the degree of depth, reads L byte, and actual reading data length is V, deposits serial ports virtual buffering region in;
D) the search efficiency K=V/L of calculating serial ports, data throughout M=M+V;
E) performance index of calculating serial ports, if serial ports performance index is 0, serial ports, in dormant state, changes serial ports mode of operation into data interrupt mode.
That f) recalculates serial ports reads degree of depth L=N*K
G) open interruption, if dormancy serial ports generation data are interrupted, dormancy serial ports is activated, close and interrupt.
H) processing host order
I) return a).
The present invention has following beneficial effect:
The present invention uses the fifo queue FIFO of serial port chip, serial data is interrupted being defined as park mode, serial data query pattern is defined as to enable mode, serial ports is defined as to three-decker, is divided into physical buffer district, virtual buffering region and serial ports performance, the physical parameter of serial ports is defined as to maximum, then by the statistical study of serial ports performance, adjust the parameter of serial ports virtual buffering region, thereby improve in real time serial ports performance.This many serial ports software querying method is applied to colliery serial ports opertaing device, proves effectively stable.
Brief description of the drawings
Fig. 1 is FB(flow block) of the present invention.
Embodiment
Mining embedded multi-serial-port inquiring method of the present invention, comprising:
1) the First Input First Output FIFO of use serial port chip, is initialized as maximal value by the capacity of physical buffer district FIFO;
2), on the basis in physical buffer district, for each serial ports generates a virtual buffering region, and carry out serviceability statistics; Serial ports physical buffer district is maximum fixed length N, and the each reading data length L in serial ports virtual buffering region is elongated, and in the time that serial ports has data, each serial ports receives L byte, computing formula L=N*K successively.
3) serial ports mode of operation is divided into dormancy and activates two states, and data query is enable mode, and data are interrupted for park mode; Calculate serial ports performance index S, if serial ports does not have data for a long time continuously, serial ports performance index does not stop to successively decrease, by 0 o'clock, will dormancy, and leave query request, serial ports accumulation performance index SN can add 1; Once there be data, serial ports performance index will be filled it up with, and serial ports will activate, and then joins in query request.
4) adopt port numbers priority algorithm, all activation serial ports are generated to a query request, polling cycle is T.Port numbers priority algorithm is: serial ports completes effective query one time, and serial ports port numbers can be placed on the front of next query request, and serial ports does not complete effective query one time, and serial ports port numbers can be placed on the back of next query request; If this search efficiency of serial ports is 1, serial ports load factor > 0.5, this reading data length L of serial ports > K/2, inquires about 2 times in next time.
5) take out current poll port from query request, each poll reads in length L and reads in the data of each port by each serial data, if each inquiry can be read data, the actual data length of reading is V, be defined as effective query one time, if do not read data, be defined as once invalid inquiry, for each serial ports generates a search efficiency value K, computing formula is K=V/L;
6) calculate the data throughout M of all serial ports, calculate the load factor of serial ports.
Described serial ports is defined as three-decker by the present invention, described three-decker is concrete as table 1, be respectively: physical buffer district, virtual buffering region and serial ports performance, physical buffer district is physical parameter district, physical parameter is all arranged to maximum, virtual buffering region is variable element district, and the parameter of the analysis and regulation virtual buffering region by serial ports performance is to improve serial ports performance.Serial ports accumulation search efficiency KN=∑ K
i(i is the i time mouthful of search efficiency).
Table 1:
Physical buffer district | Serial ports physical base address |
The maximum fixed length N in physical buffer district | |
Virtual buffering region | Serial ports regulation is read in length L |
The actual reading data length of serial ports V | |
Serial ports performance | Serial ports performance index S |
Serial ports load factor C | |
Serial ports search efficiency K | |
Serial data handling capacity M |
Referring to Fig. 1, the whole query logic of the present invention is as follows:
A), according to serial ports port numbers priority algorithm, all activated serial ports is generated to a query request;
B) from query request, get current poll port numbers, poll is worked as front port;
C) serial ports reads the degree of depth, reads L byte, and actual reading data length is V, deposits serial ports virtual buffering region in;
D) the search efficiency K=V/L of calculating serial ports, data throughout M=M+V;
E) performance index of calculating serial ports, if serial ports performance index is 0, serial ports, in dormant state, changes serial ports mode of operation into data interrupt mode.
That f) recalculates serial ports reads degree of depth L=N*K
G) open interruption, if dormancy serial ports generation data are interrupted, dormancy serial ports is activated, close and interrupt.
H) processing host order
I) return a).
Embodiment:
In KJ279 downhole personnel management system, two-way card data substation adopts 4 serial port chip TL16C554, and four ports can access maximum 60 card reader, and Software for Design adopts this many serial port check modes, at present working stability under coal mine.
Claims (2)
1. a mining embedded multi-serial-port inquiring method, is characterized in that, this querying method comprises:
1) the First Input First Output FIFO of use serial port chip, is initialized as maximal value by the capacity of physical buffer district FIFO;
2), on the basis in physical buffer district, for each serial ports generates a virtual buffering region, and carry out serviceability statistics; Serial ports physical buffer district is maximum fixed length N, and the each reading data length L in serial ports virtual buffering region is elongated, and in the time that serial ports has data, each serial ports receives L byte, computing formula L=N*K successively;
3) serial ports mode of operation is divided into dormancy and activates two states, and data query is enable mode, and data are interrupted for park mode; Calculate serial ports performance index S, if serial ports does not have data for a long time continuously, serial ports performance index does not stop to successively decrease, by 0 o'clock, will dormancy, and leave query request, serial ports accumulation performance index SN can add 1; Once there be data, serial ports performance index will be filled it up with, and serial ports will activate, and then joins in query request;
4) adopt port numbers priority algorithm, all activation serial ports are generated to a query request, polling cycle is T; Port numbers priority algorithm is: serial ports completes effective query one time, and serial ports port numbers can be placed on the front of next query request, and serial ports does not complete effective query one time, and serial ports port numbers can be placed on the back of next query request;
5) take out current poll port from query request, each poll reads in length L and reads in the data of each port by each serial data, if each inquiry can be read data, the actual data length of reading is V, be defined as effective query one time, if do not read data, be defined as once invalid inquiry, for each serial ports generates a search efficiency value K, computing formula is K=V/L;
6) calculate the data throughout M of all serial ports;
Above described serial ports is defined as to three-decker, be respectively: physical buffer district, virtual buffering region and serial ports performance, physical buffer district is physical parameter district, physical parameter is all arranged to maximum, virtual buffering region is variable element district, and the parameter of the analysis and regulation virtual buffering region by serial ports performance is to improve serial ports performance.
2. mining embedded multi-serial-port inquiring method according to claim 1, is characterized in that, the concrete steps of described whole querying method:
A), according to serial ports port numbers priority algorithm, all activated serial ports is generated to a query request;
B) from query request, get current poll port numbers, poll is worked as front port;
C) serial ports reads the degree of depth, reads L byte, and actual reading data length is V, deposits serial ports virtual buffering region in;
D) the search efficiency K=V/L of calculating serial ports, data throughout M=M+V;
E) performance index of calculating serial ports, if serial ports performance index is 0, serial ports, in dormant state, changes serial ports mode of operation into data interrupt mode;
That f) recalculates serial ports reads degree of depth L=N*K;
G) open interruption, if dormancy serial ports generation data are interrupted, dormancy serial ports is activated, close and interrupt;
H) processing host order;
I) return a).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110398189.0A CN102495813B (en) | 2011-12-02 | 2011-12-02 | Mining embedded multi-serial-port inquiring method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110398189.0A CN102495813B (en) | 2011-12-02 | 2011-12-02 | Mining embedded multi-serial-port inquiring method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102495813A CN102495813A (en) | 2012-06-13 |
CN102495813B true CN102495813B (en) | 2014-07-23 |
Family
ID=46187638
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110398189.0A Expired - Fee Related CN102495813B (en) | 2011-12-02 | 2011-12-02 | Mining embedded multi-serial-port inquiring method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102495813B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107229591B (en) * | 2017-06-22 | 2020-08-18 | 湖南省力宇燃气动力有限公司 | Multi-serial port communication method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6345241B1 (en) * | 1999-02-19 | 2002-02-05 | International Business Machines Corporation | Method and apparatus for simulation of data in a virtual environment using a queued direct input-output device |
CN101237346A (en) * | 2008-02-29 | 2008-08-06 | 中兴通讯股份有限公司 | Network processor and method for network processor to read and write serial port |
CN101908031A (en) * | 2010-07-23 | 2010-12-08 | 四川九洲电器集团有限责任公司 | FPGA-based enhanced serial port |
CN101989249A (en) * | 2009-08-07 | 2011-03-23 | 深圳达实智能股份有限公司 | Serial port data receiving method of single chip microcomputer |
-
2011
- 2011-12-02 CN CN201110398189.0A patent/CN102495813B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6345241B1 (en) * | 1999-02-19 | 2002-02-05 | International Business Machines Corporation | Method and apparatus for simulation of data in a virtual environment using a queued direct input-output device |
CN101237346A (en) * | 2008-02-29 | 2008-08-06 | 中兴通讯股份有限公司 | Network processor and method for network processor to read and write serial port |
CN101989249A (en) * | 2009-08-07 | 2011-03-23 | 深圳达实智能股份有限公司 | Serial port data receiving method of single chip microcomputer |
CN101908031A (en) * | 2010-07-23 | 2010-12-08 | 四川九洲电器集团有限责任公司 | FPGA-based enhanced serial port |
Also Published As
Publication number | Publication date |
---|---|
CN102495813A (en) | 2012-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103150258B (en) | Writing, reading and garbage collection method of solid-state memory system | |
CN102868763A (en) | Energy-saving dynamic adjustment method of virtual web application cluster in cloud computing environment | |
CN102404412A (en) | Energy saving method and system for cloud compute data center | |
Vishnu et al. | Designing energy efficient communication runtime systems: a view from PGAS models | |
CN104360963A (en) | Heterogeneous hybrid memory method and device oriented to memory computing | |
CN102521179A (en) | Achieving device and achieving method of direct memory access (DMA) reading operation | |
CN102495813B (en) | Mining embedded multi-serial-port inquiring method | |
CN201804331U (en) | Date deduplication system based on co-processor | |
CN103218254B (en) | A kind of AFC (Automatic Fare Collection) data processing method of many queues | |
CN103593304B (en) | The quantization method of effective use based on LPT device model caching | |
CN102184141A (en) | Method and device for storing check point data | |
CN202795333U (en) | Magnetic disk redundancy array high-speed read-write control circuit structure in server | |
Höpfner et al. | Towards an Energy-Consumption Based Complexity Classification for Resource Substitution Strategies. | |
CN104765572A (en) | Energy-saving virtual storage server system and scheduling method | |
CN202443462U (en) | Device for assisting upper computer to search free block in page mapping unit block | |
CN202583967U (en) | LBE (Location Based Entertainment) bus monoboard computer based on processor MPC5200B | |
CN104461941A (en) | Memory system structure and management method | |
CN104536939A (en) | Method for configurable energy-saving dispatching of multi-core embedded cache | |
CN101901192B (en) | On-chip and off-chip data object static assignment method | |
CN202502613U (en) | Building energy consumption data collector | |
CN104699520B (en) | A kind of power-economizing method based on virtual machine (vm) migration scheduling | |
CN205620997U (en) | Many high speed interface's high -speed serial bus storage device | |
CN204576487U (en) | Parallel computation multiplexing Mux | |
CN203350968U (en) | 3G network billing machine | |
CN204087080U (en) | A kind of computer host box of improvement |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20140723 Termination date: 20181202 |
|
CF01 | Termination of patent right due to non-payment of annual fee |