CN108509366A - A kind of embedded intelligence serial port implementing method - Google Patents

A kind of embedded intelligence serial port implementing method Download PDF

Info

Publication number
CN108509366A
CN108509366A CN201810240528.4A CN201810240528A CN108509366A CN 108509366 A CN108509366 A CN 108509366A CN 201810240528 A CN201810240528 A CN 201810240528A CN 108509366 A CN108509366 A CN 108509366A
Authority
CN
China
Prior art keywords
serial ports
opens
serial
embedded intelligence
turn
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.)
Pending
Application number
CN201810240528.4A
Other languages
Chinese (zh)
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.)
Chengdu Techman Software Co Ltd
Original Assignee
Chengdu Techman Software Co Ltd
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 Chengdu Techman Software Co Ltd filed Critical Chengdu Techman Software Co Ltd
Priority to CN201810240528.4A priority Critical patent/CN108509366A/en
Publication of CN108509366A publication Critical patent/CN108509366A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • G06F13/4286Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a handshaking protocol, e.g. RS232C link
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a kind of embedded serial port detection methods, comprise the steps of:Identical with the target serial ports type serial ports of detection, and count and preservation can use serial ports list;It opens the serial ports not detected in an available serial ports list and is sent to Handshake Protocol;Judge whether serial ports has return information;There is no return information then to turn to close current serial ports, continues to detect;If whether return information meets protocol specification;Then serial ports is opened successfully, starts to communicate.Further include whether monitor the serial communication after opening normal, it is abnormal then current serial ports is closed and restarted open again, opens and successfully then continue to communicate, opening unsuccessfully then returns to error message.The present invention is applied to automatically opening and monitoring for serial ports, is convenient for users to operate.

Description

A kind of embedded intelligence serial port implementing method
Technical field
The present invention relates to electronic communication field more particularly to a kind of embedded intelligence serial ports detection methods.
Background technology
When software is required for serial communication before being operated to computer serial port or built-in terminal serial ports in conventional method, Operating personnel are first wanted to find the serial ports for belonging to the built-in terminal in computer equipment manager, in the process computer itself Serial interface is had, other serial communication equipment is also had and is inserted into computer, operator cannot quickly and accurately find out embedding Serial ports corresponding to embedded system;After being correctly found embedded affiliated serial ports, corresponding equipment of serial number, then logical software are recorded The interface that interface provides, opens the serial ports manually, finally realizes sending and receiving by serial data, searches and open serial ports It is relatively loaded down with trivial details, and user must also have certain Computer Basic Knowledge to open equipment manager, to allow user It is operated when using embedded system relatively difficult.The invention also further solves serial ports after opening, by open Serial ports is realized in communication process can grasp serial ports working condition in real time, abnormal to simple serial ports to be repaired by software, Success repair after can normal use serial ports is carried out to user and abnormal information alert occurs if serial ports cannot be repaired successfully.
To solve the above-mentioned problems, the present invention proposes a kind of embedded intelligence serial ports detection method.
Invention content
To solve the above-mentioned problems, the present invention proposes a kind of embedded intelligence serial ports detection method.
Specifically, a kind of embedded intelligence serial ports detection method, comprises the steps of:
S1 detects identical with target serial ports type serial ports, and counts and preservation can use serial ports list;
S2 opens the serial ports not detected in an available serial ports list and is sent to Handshake Protocol;Whether judge serial ports There is return information;There is no return information then to turn S4;
S3, judges whether return information meets protocol specification;Meet, turns S5;
S4 closes current serial ports;Judge to have detected whether serial ports quantity is more than the serial ports number counted;It is no, then turn S2;It is then to turn S8;
S5, serial ports are opened successfully, are started to communicate, are turned S6;
Whether S6, it is normal to monitor the serial communication, and serial ports normally then turns S7, abnormal then current serial ports is closed and restarted beat again It opens, opens and successfully turn S5, opening unsuccessfully turns S8;
S7, communicates normal termination, and return communication completes information;Process terminates;
S8, abnormal ending return to error message;Process terminates.
Preferably, Handshake Protocol is sent described in S2 and judges to be additionally provided with waiting between whether serial ports has return information Time judges by accident for preventing.
Preferably, the protocol specification described in S3 is the protocol specification of user's selection or the agreement that system automatically selects Specification.
Preferably, S1 is gone to after opening failure described in S6, restarts serial ports detection.
Preferably, further include prompt message and help information in the error message returned in the S8;The prompt message Failure information or serial ports exception information are opened including serial ports.
Preferably, S5 serial ports is normally opened and is started in communication process, and system can be with secondary communication protocol handshaking party Formula communicated in serial ports monitoring state, serial ports normally then turns S7, abnormal then current serial ports is closed and restarted beat again It opens, opens and successfully turn S5, opening unsuccessfully turns S8.
The beneficial effects of the present invention are:The present invention can automatically open the affiliated serial ports of built-in terminal, exclude computer In other available and non-targeted built-in terminal serial ports, do not need user go manually open computer in equipment manager look into It sees serial ports numbering equipment, finds out available serial ports number in current computer automatically by software, and do not verified.It simplifies User's operation improves user to system usage experience.
Description of the drawings
Fig. 1 is the flow chart of the present invention.
Specific implementation mode
For a clearer understanding of the technical characteristics, objects and effects of the present invention, now control illustrates this hair Bright specific implementation mode.
A kind of embedded intelligence serial ports detection method, comprises the steps of:
S1 detects identical with target serial ports type serial ports, and counts and preservation can use serial ports list;Herein for serial ports type Judgement, either the hardware equipment information based on serial ports, can also be the identification information provided based on drive software;
S2 opens the serial ports not detected in an available serial ports list and is sent to Handshake Protocol;Whether judge serial ports There is return information;It prevents from judging by accident, can suitably increase certain stand-by period herein.There is no return information then to turn S4;
S3, judges whether return information meets protocol specification;Meet, turns S5;Protocol specification herein can be user's selection Protocol specification or system automatically select and matched protocol specification.
S4 closes current serial ports;Judge to have detected whether serial ports quantity is more than the serial ports number counted;It is no, then turn S2;It is, Then turn S8;
S5, serial ports are opened successfully, are started to communicate, are turned S6;
Whether S6, it is normal to monitor the serial communication, and serial ports normally then turns S7, abnormal then current serial ports is closed and restarted beat again It opens, opens and successfully turn S5, opening unsuccessfully turns S8;As a preferred option, S1 can be gone to after opening failure, restarts serial ports Detection;But the cycle-index at this should be given and limit, and to avoid repetitive cycling, cause the stand-by period long.
S7, communicates normal termination, and return communication completes information;Process terminates;
S8, abnormal ending return to error message;Process terminates.
Preferably, further include prompt message and help information in the error message returned in the S8;The prompt message Failure information or serial ports exception information are opened including serial ports.Such as:Prompt user checks whether that the serial ports is normally inserted into Arrive computer etc..
As preferred embodiment, the opening side of serial communication the status monitoring step and S1-S5 of wherein step S6-S8 Formula phase is independent, i.e. step S6-S8 can be applied to the serial ports that monitoring has already turned on and communicates, but the unfolding mode of its serial ports is not necessarily For the unfolding mode of S1-S5.
It should be noted that for each embodiment of the method above-mentioned, for simple description, therefore it is all expressed as to a system The combination of actions of row, but those skilled in the art should understand that, the application is not limited by the described action sequence, because For according to the application, certain some step can be performed in other orders or simultaneously.Secondly, those skilled in the art also should Know, embodiment described in this description belongs to preferred embodiment, involved action and unit not necessarily this Shen It please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in some embodiment Part, may refer to the associated description of other embodiment.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in computer read/write memory medium In, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, ROM, RAM etc..
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly It encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.

Claims (6)

1. a kind of embedded intelligence serial ports detection method, which is characterized in that comprise the steps of:
S1 detects identical with target serial ports type serial ports, and counts and preservation can use serial ports list;
S2 opens the serial ports not detected in an available serial ports list and is sent to Handshake Protocol;Whether judge serial ports There is return information;There is no return information then to turn S4;
S3, judges whether return information meets protocol specification;Meet, turns S5;
S4 closes current serial ports;Judge to have detected whether serial ports quantity is more than the serial ports number counted;It is no, then turn S2;It is then to turn S8;
S5, serial ports are opened successfully, are started to communicate, are turned S6;
Whether S6, it is normal to monitor the serial communication, and serial ports normally then turns S7, abnormal then current serial ports is closed and restarted beat again It opens, opens and successfully turn S5, opening unsuccessfully turns S8;
S7, communicates normal termination, and return communication completes information;Process terminates;
S8, abnormal ending return to error message;Process terminates.
2. a kind of embedded intelligence serial ports detection method as described in claim 1, which is characterized in that send and shake hands described in S2 Agreement and judge to be additionally provided with the stand-by period between whether serial ports has return information, be judged by accident for preventing.
3. a kind of embedded intelligence serial ports detection method as described in claim 1, which is characterized in that the agreement described in S3 Specification is the protocol specification of user's selection or the protocol specification that system automatically selects.
4. a kind of embedded intelligence serial ports detection method as described in claim 1, which is characterized in that open and lose described in S6 S1 is gone to after losing, and restarts serial ports detection.
5. a kind of embedded intelligence serial ports detection method as described in claim 1, which is characterized in that the mistake returned in the S8 Further include prompt message and help information in false information;The prompt message includes that serial ports opens failure information or serial ports letter extremely Breath.
6. a kind of embedded intelligence serial ports detection method as described in claim 1, which is characterized in that S5 serial ports is normally beaten It opens and starts the serial ports monitoring state in being communicated with secondary communication protocol handshake method in communication process, serial ports is normal Then turn S7, it is abnormal then current serial ports is closed and restarted open again, it opens and successfully turns S5, opening unsuccessfully turns S8.
CN201810240528.4A 2018-03-22 2018-03-22 A kind of embedded intelligence serial port implementing method Pending CN108509366A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810240528.4A CN108509366A (en) 2018-03-22 2018-03-22 A kind of embedded intelligence serial port implementing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810240528.4A CN108509366A (en) 2018-03-22 2018-03-22 A kind of embedded intelligence serial port implementing method

Publications (1)

Publication Number Publication Date
CN108509366A true CN108509366A (en) 2018-09-07

Family

ID=63378035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810240528.4A Pending CN108509366A (en) 2018-03-22 2018-03-22 A kind of embedded intelligence serial port implementing method

Country Status (1)

Country Link
CN (1) CN108509366A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109634884A (en) * 2018-10-19 2019-04-16 珠海格力电器股份有限公司 PORT COM connection method and device
CN111083756A (en) * 2019-11-29 2020-04-28 深圳市云天智能终端有限公司 Communication channel switching method of dual communication modules

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279831A (en) * 2011-08-09 2011-12-14 西安辉炜信息科技有限公司 Automatic registering method of serial communication terminal
CN104502806A (en) * 2015-01-09 2015-04-08 山东康威通信技术股份有限公司 System and method for fault location based on aerial cable hybrid line transient state quantity signals
CN104811359A (en) * 2015-04-10 2015-07-29 深圳市元征科技股份有限公司 Serial port communication method and terminal
CN105739464A (en) * 2016-01-27 2016-07-06 四川长虹电器股份有限公司 Main control communication method used for intelligent household electrical appliances
US20160357692A1 (en) * 2013-11-20 2016-12-08 Feitian Technologies Co., Ltd Recognition method communication mode

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279831A (en) * 2011-08-09 2011-12-14 西安辉炜信息科技有限公司 Automatic registering method of serial communication terminal
US20160357692A1 (en) * 2013-11-20 2016-12-08 Feitian Technologies Co., Ltd Recognition method communication mode
CN104502806A (en) * 2015-01-09 2015-04-08 山东康威通信技术股份有限公司 System and method for fault location based on aerial cable hybrid line transient state quantity signals
CN104811359A (en) * 2015-04-10 2015-07-29 深圳市元征科技股份有限公司 Serial port communication method and terminal
CN105739464A (en) * 2016-01-27 2016-07-06 四川长虹电器股份有限公司 Main control communication method used for intelligent household electrical appliances

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109634884A (en) * 2018-10-19 2019-04-16 珠海格力电器股份有限公司 PORT COM connection method and device
CN111083756A (en) * 2019-11-29 2020-04-28 深圳市云天智能终端有限公司 Communication channel switching method of dual communication modules
CN111083756B (en) * 2019-11-29 2022-03-18 深圳市云天智能终端有限公司 Communication channel switching method of dual communication modules

Similar Documents

Publication Publication Date Title
CN103365701B (en) Work method of analog card reader and analog communication system
CN100365994C (en) Method and system for regulating ethernet
CN109584393A (en) Work attendance method, device and Time Attendance Device
WO2017072664A1 (en) System and method for establishing a trusted diagnosis/debugging agent over a closed commodity device
CN108509366A (en) A kind of embedded intelligence serial port implementing method
CN106961658B (en) Internet of things home appliance equipment off-line restoration methods and networking module
CN108833447B (en) Network camera weak password detection method and system
CN108052094A (en) A kind of extension card identification method, device and frequency converter
CN104809046B (en) A kind of application program networking control method and application program networking control device
CN112965908A (en) Communication test method, communication test device, communication equipment and storage medium
CN109976767A (en) Software method for burn-recording and device
CN108510287A (en) Judgment method, electronic device and the computer readable storage medium that client pays a return visit
CN109214908A (en) A kind of monitoring method and relevant apparatus
CN109918143A (en) OpenPOWER platform starts information display method and relevant apparatus
CN107145447A (en) Detect method, device and the electronic equipment of memory overflow
CN107623581A (en) Service list generation method, apparatus and system, acquisition, report method and device
CN107340841A (en) Method, terminal and the computer-readable recording medium of fast initialization diagnostic equipment
CN108307414A (en) Wi-Fi connection abnormality eliminating method, device, terminal and the storage medium of application program
CN110365558A (en) A kind of fault handling method, apparatus and system
CN113466688A (en) Motor parameter identification method, device, motor, system and storage medium
CN110497862A (en) A kind of initial method of skylight of vehicle, device and mobile unit
CN107277163A (en) A kind of long-range mapping method of equipment and device
CN108600050A (en) Order transmission method, device, computer equipment and readable storage medium storing program for executing
CN102752365B (en) The method and apparatus of information processing
CN101136756A (en) Electric self-checking method, system and BMC chip on network long-range control host machine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180907