CN110969832A - Infrared code decoding method - Google Patents
Infrared code decoding method Download PDFInfo
- Publication number
- CN110969832A CN110969832A CN201911021932.3A CN201911021932A CN110969832A CN 110969832 A CN110969832 A CN 110969832A CN 201911021932 A CN201911021932 A CN 201911021932A CN 110969832 A CN110969832 A CN 110969832A
- Authority
- CN
- China
- Prior art keywords
- decoding
- infrared
- infrared code
- waveform
- duration 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000005516 engineering process Methods 0.000 description 4
- 238000013500 data storage Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G08—SIGNALLING
- G08C—TRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
- G08C23/00—Non-electrical signal transmission systems, e.g. optical systems
- G08C23/04—Non-electrical signal transmission systems, e.g. optical systems using light waves, e.g. infrared
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Optical Communication System (AREA)
Abstract
The invention provides a decoding method of an infrared code in the technical field of infrared control, which comprises the following steps: step S10, initializing an infrared receiving pin of the singlechip; step S20, when an infrared code is input, the single chip microcomputer detects the duration time of high and low levels of each period of the infrared code waveform by using an infrared receiving pin, and codes and stores each duration time; and S30, decoding the infrared code to be decoded by the singlechip by using the stored duration. The invention has the advantages that: the decoding difficulty of the infrared code is reduced, the accuracy of sending the waveform is improved, the storage capacity of data is reduced, and then the reliability of decoding the infrared code is greatly improved, and the decoding cost is reduced.
Description
Technical Field
The invention relates to the technical field of infrared control, in particular to a decoding method of an infrared code.
Background
With the development of the internet of things and sensor technology, the infrared data communication technology is a wireless connection technology widely used in the world at present, is supported by numerous hardware and software platforms, and is a technology for realizing wireless data receiving and transmitting by performing interconversion between data electric pulses and infrared pulses.
Conventionally, due to the fact that protocols adopted by various manufacturers are different and a uniform coding format is not available, when a learning type infrared remote controller conducts infrared code learning, decoding complexity is greatly increased, and the sent waveform is prone to be inaccurate; and protocols of different manufacturers need to be stored locally for decoding infrared codes of the manufacturers, so that the stored data volume is large.
Therefore, how to provide a decoding method for an infrared code, which reduces the decoding difficulty of the infrared code, improves the accuracy of sending a waveform, reduces the storage amount of data, and further improves the reliability of decoding the infrared code and reduces the decoding cost becomes a problem to be solved urgently.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method for decoding an infrared code, which reduces the difficulty in decoding the infrared code, improves the accuracy of sending out a waveform, reduces the storage amount of data, and further improves the reliability of decoding the infrared code and reduces the decoding cost.
The invention is realized by the following steps: a decoding method of infrared codes comprises the following steps:
step S10, initializing an infrared receiving pin of the singlechip;
step S20, when an infrared code is input, the single chip microcomputer detects the duration time of high and low levels of each period of the infrared code waveform by using an infrared receiving pin, and codes and stores each duration time;
and S30, decoding the infrared code to be decoded by the singlechip by using the stored duration.
Further, the step S10 is specifically: the initial state of the infrared receiving pin of the singlechip is set to a high level state.
Further, the step S20 specifically includes:
step S21, when the state of the infrared receiving pin is changed to low level state, the waveform of the input infrared code is detected;
and step S22, the single chip microcomputer detects the duration time of the high and low levels of each period of the waveform, codes and stores the duration time of the high and low levels of each period of the waveform, and codes and marks the decoding type of each period according to the duration time.
Further, in the step S20, the waveform is at a high level or a low level.
Further, the step S30 is specifically:
the single chip microcomputer detects the duration time of high and low levels of each period of the waveform of the infrared code to be decoded, judges whether the single chip microcomputer stores a corresponding decoding type according to the duration time of the high and low levels of each period, and decodes the infrared code to be decoded according to the stored corresponding decoding type if the single chip microcomputer stores the corresponding decoding type; if not, the process proceeds to step S20.
The invention has the advantages that:
by detecting the duration time of high and low levels of each period of the infrared code waveform and defining the waveforms with different duration times as different decoding types, the corresponding decoding types can be judged only according to the duration time of the high and low levels of each period of the waveform without knowing a specific protocol adopted by each manufacturer, so that the decoding difficulty of the infrared code is greatly reduced, and the decoding reliability of the infrared code is improved; the waveform is sent out through the stored duration, so that the accuracy of sending the waveform is greatly improved; as only the duration of each waveform needs to be stored, the protocol of each manufacturer does not need to be stored, a lead code does not need to be identified, and the data storage is carried out without pressing the format of 'user code 1+ user code 2+ key code bar', the storage capacity of data is greatly reduced, the required storage space is reduced, and the decoding cost is reduced.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
Fig. 1 is a flowchart of a first embodiment of the present invention.
FIG. 2 is a flowchart of a second embodiment of the present invention.
Detailed Description
The technical scheme in the embodiment of the application has the following general idea:
when the infrared code is learned, a specific protocol is not distinguished, but the duration of a waveform formed by combining high levels and low levels in the infrared code is defined as a decoding type, and the waveform decoding types with the same duration are also the same.
Referring to fig. 1, a preferred embodiment of a method for decoding an infrared code according to the present invention includes the following steps:
step S10, initializing an infrared receiving pin of the singlechip;
step S20, when an infrared code (infrared pulse) is input, the single chip microcomputer detects the duration time of high and low levels of each period of the infrared code waveform by using an infrared receiving pin, and codes and stores each duration time;
and S30, decoding the infrared code to be decoded by the singlechip by using the stored duration.
The step S10 specifically includes: setting the initial state of an infrared receiving pin of the singlechip to be a high level state; when an infrared code is input, the infrared receiving pin is changed from high level to low level.
The step S20 specifically includes:
step S21, when the state of the infrared receiving pin is changed to low level state, the waveform of the input infrared code is detected; the state of the infrared receiving pin is changed from an initial high level state to a low level state, which shows that an infrared code is input at the moment;
and step S22, the single chip microcomputer detects the duration time of the high and low levels of each period of the waveform, codes and stores the duration time of the high and low levels of each period of the waveform, and codes and marks the decoding type of each period according to the duration time.
In step S20, the waveform is at a high level (bit 1) or a low level (bit 0). While the conventional waveform is logic 0 or logic 1; the waveforms of the logic 0 or the logic 1 both include a high level and a low level; the waveform of the present invention is more concise and clearer than the conventional one.
The step S30 specifically includes: the single chip microcomputer detects the duration time of high and low levels of each period of the waveform of the infrared code to be decoded, judges whether the single chip microcomputer stores a corresponding decoding type according to the duration time of the high and low levels of each period, and decodes the infrared code to be decoded according to the stored corresponding decoding type if the single chip microcomputer stores the corresponding decoding type; if not, the process proceeds to step S20.
Referring to fig. 2, a second preferred embodiment of the method for decoding an infrared code according to the present invention includes the following steps:
step S1, setting the initial state of the infrared receiving pin of the singlechip to be a high level state;
step S2, judging whether the initial state of the infrared receiving pin is changed from a high level state to a low level state, if so, indicating that the infrared signal is detected, and entering step S3; if not, go to step S1;
step S3, the single chip microcomputer detects the duration time of the high and low levels of the first period of the infrared code, marks the duration time as a decoding type 0, and records the duration time of the high and low levels of the first period as data 0;
step S4, the single chip microcomputer detects the duration time of the high and low levels of the next period, whether the decoding type is marked or not is judged according to the duration time, and if yes, the step S5 is executed; if not, go to step S7;
step S5, acquiring the corresponding decoding type according to the duration, and recording the duration of the high and low levels of the period;
step S6, judging whether the input of the infrared code is finished, if so, finishing the process; if not, go to step S4;
step S7, mark it as decoding type n, record the duration of the high-low level of the cycle as data n, and go to step S6; where n is the last decoding type plus 1.
In summary, the invention has the advantages that:
by detecting the duration time of high and low levels of each period of the infrared code waveform and defining the waveforms with different duration times as different decoding types, the corresponding decoding types can be judged only according to the duration time of the high and low levels of each period of the waveform without knowing a specific protocol adopted by each manufacturer, so that the decoding difficulty of the infrared code is greatly reduced, and the decoding reliability of the infrared code is improved; the waveform is sent out through the stored duration, so that the accuracy of sending the waveform is greatly improved; as only the duration of each waveform needs to be stored, the protocol of each manufacturer does not need to be stored, a lead code does not need to be identified, and the data storage is carried out without pressing the format of 'user code 1+ user code 2+ key code bar', the storage capacity of data is greatly reduced, the required storage space is reduced, and the decoding cost is reduced.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.
Claims (5)
1. A decoding method of infrared codes is characterized in that: the method comprises the following steps:
step S10, initializing an infrared receiving pin of the singlechip;
step S20, when an infrared code is input, the single chip microcomputer detects the duration time of high and low levels of each period of the infrared code waveform by using an infrared receiving pin, and codes and stores each duration time;
and S30, decoding the infrared code to be decoded by the singlechip by using the stored duration.
2. A method of decoding an infrared code as claimed in claim 1, characterized in that: the step S10 specifically includes: the initial state of the infrared receiving pin of the singlechip is set to a high level state.
3. A method of decoding an infrared code as claimed in claim 1, characterized in that: the step S20 specifically includes:
step S21, when the state of the infrared receiving pin is changed to low level state, the waveform of the input infrared code is detected;
and step S22, the single chip microcomputer detects the duration time of the high and low levels of each period of the waveform, codes and stores the duration time of the high and low levels of each period of the waveform, and codes and marks the decoding type of each period according to the duration time.
4. A method of decoding an infrared code as claimed in claim 1, characterized in that: in step S20, the waveform is at a high level or a low level.
5. A method of decoding an infrared code as claimed in claim 1, characterized in that: the step S30 specifically includes:
the single chip microcomputer detects the duration time of high and low levels of each period of the waveform of the infrared code to be decoded, judges whether the single chip microcomputer stores a corresponding decoding type according to the duration time of the high and low levels of each period, and decodes the infrared code to be decoded according to the stored corresponding decoding type if the single chip microcomputer stores the corresponding decoding type; if not, the process proceeds to step S20.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911021932.3A CN110969832A (en) | 2019-10-25 | 2019-10-25 | Infrared code decoding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911021932.3A CN110969832A (en) | 2019-10-25 | 2019-10-25 | Infrared code decoding method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110969832A true CN110969832A (en) | 2020-04-07 |
Family
ID=70029867
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911021932.3A Pending CN110969832A (en) | 2019-10-25 | 2019-10-25 | Infrared code decoding method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110969832A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100141472A1 (en) * | 2008-12-09 | 2010-06-10 | Mstar Semiconductor, Inc. | Decoding Method and Apparatus for Infrared Remote Control Commands |
CN101814233A (en) * | 2010-04-08 | 2010-08-25 | 郑州炜盛电子科技有限公司 | Decoding method of infrared remote control software |
CN101989379A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能***有限公司 | Learning method and transmitting method of infrared cod signal and remote controller |
CN103390341A (en) * | 2013-07-15 | 2013-11-13 | 东南大学 | Touch technology-based universal infrared learning remote-control device and control method thereof |
CN106781425A (en) * | 2017-01-18 | 2017-05-31 | 福建省光速达物联网科技股份有限公司 | A kind of method of IR remote controller Signal Compression storage |
CN110223499A (en) * | 2019-06-18 | 2019-09-10 | 广州中安电工高新科技股份有限公司 | A kind of infrared decoding method and device |
-
2019
- 2019-10-25 CN CN201911021932.3A patent/CN110969832A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100141472A1 (en) * | 2008-12-09 | 2010-06-10 | Mstar Semiconductor, Inc. | Decoding Method and Apparatus for Infrared Remote Control Commands |
CN101989379A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能***有限公司 | Learning method and transmitting method of infrared cod signal and remote controller |
CN101814233A (en) * | 2010-04-08 | 2010-08-25 | 郑州炜盛电子科技有限公司 | Decoding method of infrared remote control software |
CN103390341A (en) * | 2013-07-15 | 2013-11-13 | 东南大学 | Touch technology-based universal infrared learning remote-control device and control method thereof |
CN106781425A (en) * | 2017-01-18 | 2017-05-31 | 福建省光速达物联网科技股份有限公司 | A kind of method of IR remote controller Signal Compression storage |
CN110223499A (en) * | 2019-06-18 | 2019-09-10 | 广州中安电工高新科技股份有限公司 | A kind of infrared decoding method and device |
Non-Patent Citations (2)
Title |
---|
人工智能开发: ""单片机如何接收红外遥控信号"", 《HTTPS://JINGYAN.BAIDU.COM/ARTICLE/5BBB5A1BDC7CB513EBA1793D.HTML》 * |
音乐缥缈迷人: "51单片机红外解码", 《HTTPS://ZHIDAO.BAIDU.COM/QUESTION/272883540.HTML》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8295407B2 (en) | Decoding method and apparatus for infrared remote control commands | |
US20070018708A1 (en) | Method and apparatus for determining optimal delay time and computer-readable storage medium storing optimal delay time determining program | |
US20130343431A1 (en) | Method and device for searching for neighboring bluetooth devices | |
US10608778B2 (en) | Data transmission method and terminal | |
CN103229444A (en) | Coding/decoding method, device and system | |
CN107015715B (en) | Touch sensing system applied to touch panel and data transmission method thereof | |
CN110969832A (en) | Infrared code decoding method | |
CN109818713B (en) | Subcarrier modulated Miller code decoding method, apparatus and device and storage medium | |
CN110795112A (en) | Multi-channel IC burning method, device and system | |
JP2008028641A (en) | Data transmission device | |
US9491110B2 (en) | Method and device for securing data packets to be transmitted via an interface | |
CN115086454B (en) | Method, system and storage medium for self-adaptive galvanometer control signal interface | |
CN111984582A (en) | PCIE link training method, equipment and medium | |
CN111611186A (en) | Transmission control method and device in embedded chip | |
US20130086016A1 (en) | Interface-adaptive data exchange | |
JPH0918461A (en) | Data receiver | |
US20060015297A1 (en) | Temporal correlation of messages transmitted by a microprocessor monitoring circuit | |
KR20080068339A (en) | Infrared receiving error detecting method of cell phone | |
JP2560648Y2 (en) | Decoding device for two-phase encoded data | |
CN118209151A (en) | TC 234-based sensor identification method and system | |
CN115061968B (en) | Interface processor and interface processing system | |
US7716539B2 (en) | Serial communication control system | |
JP6779113B2 (en) | Waveform measuring device | |
US8009770B2 (en) | Decoder for 4QAM-NR and method thereof | |
TWI393086B (en) | Infrared signal decoding system and method |
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 |
Application publication date: 20200407 |
|
RJ01 | Rejection of invention patent application after publication |