CN111130690A - Processing method and device for multiple communication protocols of IR46 smart electric meter - Google Patents
Processing method and device for multiple communication protocols of IR46 smart electric meter Download PDFInfo
- Publication number
- CN111130690A CN111130690A CN201911102560.7A CN201911102560A CN111130690A CN 111130690 A CN111130690 A CN 111130690A CN 201911102560 A CN201911102560 A CN 201911102560A CN 111130690 A CN111130690 A CN 111130690A
- Authority
- CN
- China
- Prior art keywords
- serial port
- data
- port data
- communication
- serial
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0078—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
- H04L1/0083—Formatting with frames or packets; Protocol or part of protocol for error control
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R22/00—Arrangements for measuring time integral of electric power or current, e.g. electricity meters
- G01R22/06—Arrangements for measuring time integral of electric power or current, e.g. electricity meters by electronic methods
- G01R22/061—Details of electronic electricity meters
- G01R22/063—Details of electronic electricity meters related to remote communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/12—Arrangements for detecting or preventing errors in the information received by using return channel
- H04L1/16—Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
- H04L1/1607—Details of the supervisory signal
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/14—Multichannel or multilink protocols
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Power Engineering (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
- Arrangements For Transmission Of Measured Signals (AREA)
Abstract
The embodiment of the invention discloses a method and a device for processing multiple communication protocols of an IR46 intelligent electric meter, wherein the method comprises the following steps: starting a serial port interrupt service program, and reading received serial port data based on the identified serial port interrupt request; starting a main program, judging whether data updating exists on serial port communication or not based on a serial port data processing pointer, and if so, reading serial port data by the main program; matching the serial port data with all communication protocols supported by the meter to obtain a first communication protocol to which the serial port data belongs; analyzing the serial port data according to a first communication protocol to generate a reply frame of the serial port data, and sending the reply frame of the serial port data out through a serial port; and analyzing the next serial port data received by the serial port according to the first communication protocol to generate a reply frame of the next serial port data and sending the reply frame out through the serial port. The method greatly reduces the complexity of serial port data processing, avoids serial port data loss and ensures the communication quality of the IR46 intelligent electric energy meter.
Description
Technical Field
The invention relates to the technical field of communication of electric energy meters, in particular to a method and a device for processing multiple communication protocols of an IR46 intelligent electric meter.
Background
In the field of electric meters, in addition to ensuring the metering accuracy of the electric meters and realizing the electricity stealing prevention function, the communication requirements on the electric meters are more and more strict. At present, the communication modes of the common electric meter comprise near infrared communication, far infrared communication and RS485 communication, the communication distance is different from several meters to hundreds of meters, the communication protocols are basically single, but the requirements of most users cannot be met in the aspect of the communication distance. The new generation of IR46 intelligent electric energy meter solves the problem of insufficient communication distance of the existing electric energy meter, the communication mode comprises GPRS communication, RF communication, RLC carrier communication and the like, and the functions of remote meter reading, remote electric meter switching on and off, remote electric meter recharging and the like can be realized on a system main station.
The remote data interaction of the IR46 intelligent electric energy meter and the system master station is realized based on the data transparent transmission of the communication module, and in practical application, the communication module completes the data transparent transmission on one hand and performs timing data interaction with the IR46 intelligent electric energy meter on the other hand, so that the functions of actively reporting events and actively pushing load curves are realized. However, one communication protocol is used for communication between the IR46 intelligent electric energy meter and the system master station, and the other communication protocol is used for communication between the IR46 intelligent electric energy meter and the communication module, which means that the IR46 intelligent electric energy meter needs to process two communication protocols simultaneously, and if the IR46 intelligent electric energy meter needs to use the communication modules of other manufacturers to communicate with the system master station, the corresponding communication protocols need to be added, so the processing mode of multiple communication protocols becomes the technical difficulty of the IR46 intelligent electric energy meter.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a multi-communication-protocol processing method of an IR46 intelligent electric meter, which is characterized in that a serial port interrupt service program is used for simply reading serial port data, communication protocol matching of the serial port data is carried out in a main program, the complexity of serial port data processing is greatly reduced, abnormal communication protocol matching caused by partial data loss is prevented, and the communication quality of the IR46 intelligent electric meter is guaranteed.
In order to solve the technical problem, the invention provides a method for processing multiple communication protocols of an IR46 smart meter, which comprises the following steps:
starting a serial port interrupt service program, and reading received serial port data based on the identified serial port interrupt request;
starting a main program, judging whether data updating exists on serial port communication or not based on a serial port data processing pointer, and reading the serial port data by the main program if the data updating exists on the serial port communication;
matching the serial port data with all communication protocols supported by a meter to obtain a first communication protocol to which the serial port data belongs;
analyzing the serial port data according to the first communication protocol to generate a reply frame of the serial port data, and sending the reply frame of the serial port data out through a serial port;
and waiting for receiving next serial port data, analyzing the received next serial port data according to the first communication protocol to generate a reply frame of the next serial port data, and sending the reply frame of the next serial port data out through a serial port.
Optionally, the reading the received serial port data based on the identified serial port interrupt request includes:
adding 1 to a first serial port communication cache pointer every time one byte of the serial port data is read, and storing data corresponding to one byte of the serial port data into the serial port communication cache;
and after the complete serial port data is read, generating a second serial port communication cache pointer.
Optionally, the determining whether there is data update in the serial communication based on the serial data processing pointer includes:
the main program judges whether the serial port data processing pointer is consistent with the second serial port communication cache pointer or not;
and when the serial port data processing pointer is judged to be inconsistent with the second serial port communication cache pointer, the main program reads the serial port data.
Optionally, after the main program determines whether the serial data processing pointer is consistent with the second serial communication buffer pointer, the method further includes:
and when the serial port data processing pointer is judged to be consistent with the second serial port communication cache pointer, the main program returns to judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer.
Optionally, the matching the serial port data with all communication protocols supported by a meter to obtain the first communication protocol to which the serial port data belongs includes:
judging whether the serial port data is consistent with frame headers of all communication protocols supported by the meter;
after judging that the serial port data is consistent with frame headers of all communication protocols supported by a meter, acquiring first serial port data, wherein the first serial port data is data left after the serial port data is matched with the frame headers;
and matching the first serial port data with the frame formats of all communication protocols supported by the meter to obtain the first communication protocol to which the serial port data belongs.
Optionally, after determining whether the serial port data is consistent with the frame headers of all communication protocols supported by the meter, the method further includes:
after judging that the serial port data is inconsistent with the frame headers of all communication protocols supported by the meter, the main program discards the data of the current byte of the serial port data and returns to judge whether the data of the next byte of the serial port data is consistent with the frame headers of all communication protocols supported by the meter.
The invention also provides a processing device of multiple communication protocols of the IR46 smart electric meter, which comprises:
the reading module is used for reading the received serial port data based on the identified serial port interrupt request;
the judging module is used for judging whether data updating exists on serial communication or not based on the serial data processing pointer, and if the data updating exists on the serial communication, the main program reads the serial data;
the matching module is used for matching the serial port data with all communication protocols supported by the meter to obtain a first communication protocol to which the serial port data belongs;
the processing module is used for analyzing the serial port data according to the first communication protocol, generating a reply frame of the serial port data and sending the reply frame of the serial port data out through a serial port;
and the interaction module is used for waiting for receiving next serial port data, analyzing the received next serial port data according to the first communication protocol, generating a reply frame of the next serial port data, and sending the reply frame of the next serial port data out through a serial port.
Optionally, the reading module is configured to add 1 to the first serial communication buffer pointer every time one byte of the serial data is read, and store data corresponding to the one byte of the serial data in the serial communication buffer;
and after the complete serial port data is read, generating a second serial port communication cache pointer.
Optionally, the judging module is configured to judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer;
and when the serial port data processing pointer is judged to be inconsistent with the second serial port communication cache pointer, the main program reads the serial port data.
Optionally, the matching module is configured to determine whether the serial port data is consistent with frame headers of all communication protocols supported by the meter;
after judging that the serial port data is consistent with frame headers of all communication protocols supported by a meter, acquiring first serial port data, wherein the first serial port data is data left after the serial port data is matched with the frame headers;
and matching the first serial port data with the frame formats of all communication protocols supported by the meter to obtain the first communication protocol to which the serial port data belongs.
In the embodiment of the invention, when a plurality of communication modules and a system master station carry out serial port communication with the IR46 intelligent electric energy meter, the IR46 intelligent electric energy meter starts a serial port interrupt service program to completely read and store serial port data, and the main program is electrified to carry out matching judgment on the communication protocol of the read serial port data. The IR 46-based intelligent electric energy meter supports multi-channel communication, serial port data are only read without any judgment in the process design of a serial port interrupt service program, the complexity of serial port data processing is reduced, the condition of serial port data loss is avoided under the condition of high baud rate, a communication protocol identification module in the IR46 intelligent electric energy meter can be used for judging the difference of communication protocols used by a plurality of communication modules and a system master station, a main program is started to match the serial port data to a correct communication protocol, and the reliability of communication is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a processing method of multiple communication protocols of an IR46 smart meter disclosed in the embodiment of the present invention.
Fig. 2 is a schematic structural composition diagram of a processing apparatus with multiple communication protocols for an IR46 smart meter disclosed in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a processing method of multiple communication protocols of an IR46 smart meter in an embodiment of the present invention, which specifically includes the following steps:
s101, starting a serial port interrupt service program, and identifying a serial port interrupt request mark;
specifically, a serial port interrupt service program is executed, and whether a serial port receiving interrupt flag RI satisfies RI 1 is judged; if yes, executing step S102;
s102, reading serial port data received by a serial port, storing the serial port data into a serial port communication cache, and updating a first serial port communication cache pointer into a second serial port communication cache pointer;
specifically, assuming that a first serial communication cache pointer when the serial data is not received is a, the number of bytes of the serial data is N, and every time a byte of the serial data is read, adding 1 to the first serial communication cache pointer, storing data corresponding to the byte of the serial data in the serial communication cache, and when the complete serial data is received, generating a second serial communication cache pointer as a + N.
It should be noted that the first serial communication buffer pointer points to an address of the serial communication buffer, and when one byte of the serial data is read, an address offset occurs in the serial communication buffer once, so as to store data corresponding to the one byte of the serial data.
It should be noted that, when the serial port data is read, the serial port interrupt service program clears the serial port reception interrupt flag RI to zero, and waits for receiving the next serial port data.
S103, starting a main program, and judging whether a serial port data processing pointer is consistent with the second serial port communication cache pointer or not; if the serial port communication is consistent with the serial port communication, judging that no data is updated, and executing the step S103; if not, judging that data updating exists in the serial port communication, and executing the step S104;
specifically, assuming that the serial data processing pointer is a, the serial data processing pointer is compared with the second serial communication cache pointer a + N generated in step S102, and it is determined that the two pointers are inconsistent and have a difference of N, so that it is determined that there is data update in the serial communication, and the number of bytes of the serial data is N.
If the serial port data processing pointer is compared with the first serial port communication cache pointer A when the serial port data is not received, the serial port data processing pointer is consistent with the first serial port communication cache pointer at the moment, therefore, no data update on serial port communication is judged, and the main program returns to continuously inquire and judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer.
It should be noted that, under the condition that there is no data update in serial communication, the second serial communication buffer pointer is still the first serial communication buffer pointer when the serial data is not received.
S104, reading the serial port data by the main program;
specifically, the main program sets reading of bytes of the serial port data one by one.
S105, judging whether the serial port data is consistent with frame headers of all communication protocols supported by the meter; if yes, go to step S106; if not, the step S105 is executed;
specifically, it is known that the number of bytes of the serial port data is N, and the serial port data processing pointer is a.
Reading the data of the first byte of the serial port data, judging whether the data are consistent with the frame headers of all communication protocols supported by the meter, and if so, executing the step S106; if the serial port data processing pointer is not consistent with the serial port data processing pointer, the serial port data processing pointer is updated to be A +1, the data of the first byte is lost, the byte number of the serial port data is N-1 at the moment, and the step S105 is executed again;
continuously reading the second byte of the serial port data, judging whether the second byte of the serial port data is consistent with the frame headers of all communication protocols supported by the meter, and if so, executing the step S106; if the serial port data processing pointer is not consistent with the serial port data processing pointer, the serial port data processing pointer is updated to be A +2, the data of the second byte is lost, the byte number of the serial port data is N-2 at the moment, and the step S105 is executed again;
judging in the loop until the M +1 (M +1 < N) th byte of the serial port data is judged to be consistent with all the frame headers of the communication protocols supported by the meter, executing step S106, wherein the serial port data processing pointer is A + M and the byte number of the serial port data is N-M;
it should be noted that, if it is determined that the nth byte of the serial data is inconsistent with the frame headers of all communication protocols supported by the meter, the serial data processing pointer is a + N, and the main program stores that the current serial data processing pointer is a + N and then exits the determination.
It should be noted that, after it is determined that the data of the current byte of the serial port data is inconsistent with the frame headers of all communication protocols supported by the meter, the data of the current byte of the serial port data is discarded, and then the procedure returns to step S105, so as to ensure that the main program reads the data of the next byte of the serial port data at this time.
S106, acquiring first serial port data based on a frame header matching result;
specifically, when the data of the M +1 (M +1 < N) th byte of the serial port data is judged to be consistent with the frame headers of all communication protocols supported by the meter, the first serial port data with the number of bytes N-M is obtained, and the first serial port data is composed of the last N-M bytes of the serial port data with the number of bytes N.
S107, matching the first serial port data with frame formats of all communication protocols supported by a meter to obtain a first communication protocol to which the serial port data belongs;
specifically, given that data corresponding to M +1 th byte to nth byte in the serial port data with the byte number N is the first serial port data, here, the description is still performed by replacing the first byte of the first serial port data with the M +1 th byte of the serial port data, as follows:
according to the step S105, it is determined that the M +1 th byte of the serial data matches the frame headers of all communication protocols supported by the meter, and frame format matching is performed between the M +2 th byte of the serial data and the nth byte of the serial data and all communication protocols supported by the meter to obtain a first communication protocol to which the serial data belongs, where the first communication protocol is one of all communication protocols supported by the meter.
It should be noted that, the current serial port data processing pointer is generated as a + N by adding the corresponding serial port data processing pointer a + M to the byte number N-M of the first serial port data, and the main program records the current serial port data processing pointer a + N. And when the main program executes a new round of cycle judgment, the current serial port data processing pointer A + N is taken as a judgment condition.
It should be noted that, when the first serial port data is matched with the frame formats of all communication protocols supported by the meter, the judgment of the frame end and the check code is included.
And S108, analyzing the serial port data according to the first communication protocol, generating a reply frame of the serial port data, and sending the reply frame of the serial port data out through a serial port.
It should be noted that, the IR46 smart electric energy meter itself has a communication protocol identification module, the communication protocol identification module includes different types of communication protocols, when the IR46 smart electric energy meter selects different communication modes according to the transmission distance, such as GPRS communication, RF communication, RLC carrier communication, etc., since each communication mode corresponds to a different communication protocol type, based on the data transmitted by the different communication protocols, the IR46 smart electric energy meter will correspond to different configurations, i.e., perform different serial data processing.
S109, waiting for receiving next serial port data, analyzing the received next serial port data according to the first communication protocol, generating a reply frame of the next serial port data, and sending the reply frame of the next serial port data out through a serial port.
It should be noted that, after the communication protocol matching is performed on the serial port data, the matched communication protocol is continuously used to process the next serial port data, so as to complete the data interaction.
In a specific implementation process, when a serial port data request is sent to an IR46 intelligent electric energy meter for communication, the IR46 intelligent electric energy meter receives the serial port data based on a serial port interrupt service program, the IR46 intelligent electric energy meter judges the serial port data based on a main program, the serial port data is a communication protocol supported by the serial port data matching meter, a reply frame of the serial port data is sent to a sender according to the communication protocol, and communication between the sender and the IR46 intelligent electric energy meter is established at the moment.
Referring to fig. 2, fig. 2 is a schematic structural composition diagram of a processing apparatus for multiple communication protocols of an IR46 smart meter according to an embodiment of the present invention, where the apparatus includes:
a reading module 201, configured to read received serial port data based on the identified serial port interrupt request;
specifically, the reading module is configured to add 1 to a first serial communication buffer pointer every time a byte of the serial data is read, and store data corresponding to the byte of the serial data in the serial communication buffer; and after the complete serial port data is read, generating a second serial port communication cache pointer.
The judging module 202 is used for judging whether data updating exists on serial communication based on a serial data processing pointer, and if the data updating exists on the serial communication, the main program reads the serial data;
specifically, the judging module is configured to judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer;
when the serial port data processing pointer is judged to be inconsistent with the second serial port communication cache pointer, data updating is carried out on serial port communication, and the main program reads the serial port data;
and when the serial port data processing pointer is judged to be consistent with the second serial port communication cache pointer, indicating that no data is updated in serial port communication, and returning to the main program to judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer.
The matching module 203 is used for matching the serial port data with all communication protocols supported by the meter to obtain a first communication protocol to which the serial port data belongs;
specifically, the matching module is configured to determine whether the serial port data is consistent with frame headers of all communication protocols supported by the meter;
after judging that the serial port data is consistent with frame headers of all communication protocols supported by a meter, acquiring first serial port data, wherein the first serial port data is data left after the serial port data is matched with the frame headers;
and matching the first serial port data with the frame formats of all communication protocols supported by the meter to obtain the first communication protocol to which the serial port data belongs.
It should be noted that, when the serial port data is judged to be matched with the frame headers of all the communication protocols supported by the meter, a loop process exists, and when the first byte of the serial port data does not conform to the frame headers of all the communication protocols supported by the meter, the loop process is directly discarded, the second byte of the serial port data is judged, and the matching process is performed in this loop process until the current byte of the serial port data is judged to be matched with the frame headers of all the communication protocols supported by the meter.
The processing module 204 is configured to analyze the serial port data according to the first communication protocol, generate a reply frame of the serial port data, and send the reply frame of the serial port data through a serial port;
the interaction module 205 is configured to wait for receiving next serial port data, analyze the received next serial port data according to the first communication protocol, generate a reply frame of the next serial port data, and send the reply frame of the next serial port data through a serial port.
It should be noted that, the IR46 smart electric energy meter itself has a communication protocol identification module, the communication protocol identification module includes different types of communication protocols, when the IR46 smart electric energy meter selects different communication modes according to the transmission distance, such as GPRS communication, RF communication, RLC carrier communication, etc., since each communication mode corresponds to a different communication protocol type, based on the data transmitted by the different communication protocols, the IR46 smart electric energy meter will correspond to different configurations, i.e., perform different serial data processing.
In the embodiment of the invention, when a plurality of communication modules and a system master station carry out serial port communication with the IR46 intelligent electric energy meter, the IR46 intelligent electric energy meter starts a serial port interrupt service program to completely read and store serial port data, and the main program is electrified to carry out matching judgment on the communication protocol of the read serial port data. The IR 46-based intelligent electric energy meter supports multi-channel communication, serial port data are only read without any judgment in the process design of a serial port interrupt service program, the complexity of serial port data processing is reduced, the condition of serial port data loss is avoided under the condition of high baud rate, a communication protocol identification module in the IR46 intelligent electric energy meter can be used for judging the difference of communication protocols used by a plurality of communication modules and a main station, a main program is started to match the serial port data to a correct communication protocol, and the reliability of communication is ensured.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic or optical disk, or the like.
In addition, the above detailed description is given to the processing method and apparatus for multiple communication protocols of the IR46 smart meter according to the embodiment of the present invention, and a specific example should be used herein to explain the principle and the implementation of the present invention, and the above description of the embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A method for processing multiple communication protocols of an IR46 smart meter is characterized by comprising the following steps:
starting a serial port interrupt service program, and reading received serial port data based on the identified serial port interrupt request;
starting a main program, judging whether data updating exists on serial port communication or not based on a serial port data processing pointer, and reading the serial port data by the main program if the data updating exists on the serial port communication;
matching the serial port data with all communication protocols supported by a meter to obtain a first communication protocol to which the serial port data belongs;
analyzing the serial port data according to the first communication protocol to generate a reply frame of the serial port data, and sending the reply frame of the serial port data out through a serial port;
and waiting for receiving next serial port data, analyzing the received next serial port data according to the first communication protocol to generate a reply frame of the next serial port data, and sending the reply frame of the next serial port data out through a serial port.
2. The IR46 smart meter multi-communication-protocol processing method according to claim 1, wherein the reading the received serial port data based on the recognized serial port interrupt request includes:
adding 1 to a first serial port communication cache pointer every time one byte of the serial port data is read, and storing data corresponding to one byte of the serial port data into the serial port communication cache;
and after the complete serial port data is read, generating a second serial port communication cache pointer.
3. The processing method of multiple communication protocols of the IR46 smart meter according to claim 2, wherein the determining whether there is data update on the serial communication based on the serial data processing pointer comprises:
the main program judges whether the serial port data processing pointer is consistent with the second serial port communication cache pointer or not;
and when the serial port data processing pointer is judged to be inconsistent with the second serial port communication cache pointer, the main program reads the serial port data.
4. The method for processing the multiple communication protocols of the IR46 smart meter as claimed in claim 3, wherein after the main program determines whether the serial data processing pointer is consistent with the second serial communication buffer pointer, the method further comprises:
and when the serial port data processing pointer is judged to be consistent with the second serial port communication cache pointer, the main program returns to judge whether the serial port data processing pointer is consistent with the second serial port communication cache pointer.
5. The processing method of multiple communication protocols of the IR46 smart meter according to claim 1, wherein the matching the serial data with all communication protocols supported by the meter to obtain the first communication protocol to which the serial data belongs includes:
judging whether the serial port data is consistent with frame headers of all communication protocols supported by the meter;
after judging that the serial port data is consistent with frame headers of all communication protocols supported by a meter, acquiring first serial port data, wherein the first serial port data is data left after the serial port data is matched with the frame headers;
and matching the first serial port data with the frame formats of all communication protocols supported by the meter to obtain the first communication protocol to which the serial port data belongs.
6. The method for processing multiple communication protocols of the IR46 smart meter according to claim 5, wherein after determining whether the serial port data matches the header of all communication protocols supported by the meter, the method further comprises:
after judging that the serial port data is inconsistent with the frame headers of all communication protocols supported by the meter, the main program discards the data of the current byte of the serial port data and returns to judge whether the data of the next byte of the serial port data is consistent with the frame headers of all communication protocols supported by the meter.
7. An apparatus for processing multiple communication protocols of an IR46 smart meter, the apparatus comprising:
the reading module is used for reading the received serial port data based on the identified serial port interrupt request;
the judging module is used for judging whether data updating exists on serial communication or not based on the serial data processing pointer, and if the data updating exists on the serial communication, the main program reads the serial data;
the matching module is used for matching the serial port data with all communication protocols supported by the meter to obtain a first communication protocol to which the serial port data belongs;
the processing module is used for analyzing the serial port data according to the first communication protocol, generating a reply frame of the serial port data and sending the reply frame of the serial port data out through a serial port;
and the interaction module is used for waiting for receiving next serial port data, analyzing the received next serial port data according to the first communication protocol, generating a reply frame of the next serial port data, and sending the reply frame of the next serial port data out through a serial port.
8. The processing device with multiple communication protocols for the IR46 smart meter according to claim 7,
the reading module is used for adding 1 to a first serial port communication cache pointer when reading one byte of the serial port data and storing data corresponding to one byte of the serial port data into the serial port communication cache;
and after the complete serial port data is read, generating a second serial port communication cache pointer.
9. The processing device of multiple communication protocols of the IR46 smart meter in accordance with claim 8,
the judging module is used for judging whether the serial port data processing pointer is consistent with the second serial port communication cache pointer or not;
and when the serial port data processing pointer is judged to be inconsistent with the second serial port communication cache pointer, the main program reads the serial port data.
10. The device with multiple communication protocols for the IR46 intelligent electric energy meter according to claim 9,
the matching module is used for judging whether the serial port data is consistent with frame headers of all communication protocols supported by the meter;
after judging that the serial port data is consistent with frame headers of all communication protocols supported by a meter, acquiring first serial port data, wherein the first serial port data is data left after the serial port data is matched with the frame headers;
and matching the first serial port data with the frame formats of all communication protocols supported by the meter to obtain the first communication protocol to which the serial port data belongs.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911102560.7A CN111130690A (en) | 2019-11-12 | 2019-11-12 | Processing method and device for multiple communication protocols of IR46 smart electric meter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911102560.7A CN111130690A (en) | 2019-11-12 | 2019-11-12 | Processing method and device for multiple communication protocols of IR46 smart electric meter |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111130690A true CN111130690A (en) | 2020-05-08 |
Family
ID=70495509
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911102560.7A Pending CN111130690A (en) | 2019-11-12 | 2019-11-12 | Processing method and device for multiple communication protocols of IR46 smart electric meter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111130690A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111770055A (en) * | 2020-05-29 | 2020-10-13 | 宁波三星医疗电气股份有限公司 | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter |
CN111913905A (en) * | 2020-06-30 | 2020-11-10 | 中国航发南方工业有限公司 | Variable self-adaptive serial port communication method, medium and electronic equipment |
CN114595183A (en) * | 2020-12-07 | 2022-06-07 | 深圳Tcl新技术有限公司 | Serial port data processing method and device, terminal and computer readable storage medium |
CN115334175A (en) * | 2022-09-13 | 2022-11-11 | 浙江正泰物联技术有限公司 | Multi-protocol self-adaptive analysis method, internet of things metering device, equipment and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6105081A (en) * | 1998-06-01 | 2000-08-15 | Advanced Micro Devices, Inc. | UART character matching used for address matching on a register-by-register basis |
CN104052758A (en) * | 2014-07-14 | 2014-09-17 | 威胜集团有限公司 | Self-adaptive method of multiple communication protocols of electric energy meter |
CN104780140A (en) * | 2014-01-12 | 2015-07-15 | 盛吉高科(北京)科技有限公司 | Configurable communication protocol identifying and parsing system |
CN105681134A (en) * | 2016-03-04 | 2016-06-15 | 西安航天动力技术研究所 | General multiple serial port communication protocol detection and identification method |
CN110032535A (en) * | 2018-12-28 | 2019-07-19 | 北京润科通用技术有限公司 | A kind of serial data analysis method and device |
-
2019
- 2019-11-12 CN CN201911102560.7A patent/CN111130690A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6105081A (en) * | 1998-06-01 | 2000-08-15 | Advanced Micro Devices, Inc. | UART character matching used for address matching on a register-by-register basis |
CN104780140A (en) * | 2014-01-12 | 2015-07-15 | 盛吉高科(北京)科技有限公司 | Configurable communication protocol identifying and parsing system |
CN104052758A (en) * | 2014-07-14 | 2014-09-17 | 威胜集团有限公司 | Self-adaptive method of multiple communication protocols of electric energy meter |
CN105681134A (en) * | 2016-03-04 | 2016-06-15 | 西安航天动力技术研究所 | General multiple serial port communication protocol detection and identification method |
CN110032535A (en) * | 2018-12-28 | 2019-07-19 | 北京润科通用技术有限公司 | A kind of serial data analysis method and device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111770055A (en) * | 2020-05-29 | 2020-10-13 | 宁波三星医疗电气股份有限公司 | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter |
CN111913905A (en) * | 2020-06-30 | 2020-11-10 | 中国航发南方工业有限公司 | Variable self-adaptive serial port communication method, medium and electronic equipment |
CN114595183A (en) * | 2020-12-07 | 2022-06-07 | 深圳Tcl新技术有限公司 | Serial port data processing method and device, terminal and computer readable storage medium |
CN115334175A (en) * | 2022-09-13 | 2022-11-11 | 浙江正泰物联技术有限公司 | Multi-protocol self-adaptive analysis method, internet of things metering device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111130690A (en) | Processing method and device for multiple communication protocols of IR46 smart electric meter | |
CN110474756B (en) | Intelligent power grid electricity utilization information acquisition method | |
CN111768608B (en) | Data transmission method and device based on double-core intelligent electric meter and computer equipment | |
CN108833058B (en) | Dynamic data compression and decompression method in communication process of wide area measurement system | |
EP3675398A1 (en) | Check code processing method, electronic device, and storage medium | |
US9209919B2 (en) | Synchronization control system | |
WO2018171641A1 (en) | Method and device for transmitting and receiving network management information, transmitting apparatus and receiving apparatus | |
CN112614331B (en) | Method for reading electric energy meter event and electric energy meter event reading system | |
CN110133338B (en) | Double-core electric energy meter and display method | |
CN103546467A (en) | Method for transmitting Modbus RTU protocol on TCP/IP network | |
CN109151762A (en) | A kind of the asynchronous process system and processing method of high concurrent acquisition data | |
CN109728879B (en) | Synchronous error correction method for serial burst access application layer SLIP protocol message | |
CN110460597B (en) | Control frame pre-compression method based on AS6802 protocol | |
CN113609518B (en) | Message protocol timeout retransmission method and system based on association container map | |
CN112104442B (en) | Message reply method of electric power acquisition terminal | |
CN105471660A (en) | Data acquisition method applicable to new type low orbit satellite platform | |
CN116614326A (en) | Modbus communication method based on single-channel multi-device | |
CN112910838A (en) | Composite protocol analysis method, device, equipment, system and storage medium | |
CN109788065B (en) | Off-line message transmission method and off-line message transmission device based on Beidou system | |
CN115297447B (en) | Long short message merging method, system, equipment and storage medium | |
CN111770055A (en) | Multi-protocol communication frame rapid distinguishing method applied to electric energy meter | |
CN114827287B (en) | Data compression method and system | |
CN115633107A (en) | DL/T719 protocol analysis method and electric quantity acquisition terminal | |
CN116132550A (en) | Data transmission method and device, electronic equipment and storage medium | |
CN112671721A (en) | Message analysis method of intelligent electric energy meter |
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: 20200508 |