CN102938197A - Method for decoding infrared remote control by means of input capture interrupt mode - Google Patents

Method for decoding infrared remote control by means of input capture interrupt mode Download PDF

Info

Publication number
CN102938197A
CN102938197A CN2012104368672A CN201210436867A CN102938197A CN 102938197 A CN102938197 A CN 102938197A CN 2012104368672 A CN2012104368672 A CN 2012104368672A CN 201210436867 A CN201210436867 A CN 201210436867A CN 102938197 A CN102938197 A CN 102938197A
Authority
CN
China
Prior art keywords
pulsewidth
value
input capture
state machine
decoding
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
CN2012104368672A
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.)
HEFEI YIDUAN COMMUNICATION TECHNOLOGY Co Ltd
Original Assignee
HEFEI YIDUAN COMMUNICATION TECHNOLOGY 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 HEFEI YIDUAN COMMUNICATION TECHNOLOGY Co Ltd filed Critical HEFEI YIDUAN COMMUNICATION TECHNOLOGY Co Ltd
Priority to CN2012104368672A priority Critical patent/CN102938197A/en
Publication of CN102938197A publication Critical patent/CN102938197A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method for decoding infrared remote control by means of an input capture interrupt mode and relates to a method for decoding the infrared remote control. The method comprises the steps of allocating an input capture timer into a singlechip main program, starting the input capture timer and enabling interrupt; obtaining a capture time value through interrupt trigger; comparing the capture time value and the last capture time value and calculating interval between the capture time value and the last capture time value; enabling a state machine to compare whether the pulse width accords with the front end of a guidance code; determining whether the front end of the guidance code is a code head; enabling the state machine to be in a decoding state and compare whether the pulse width accords with coding rules; storing a coding value in a coding variable; storing the captured value in the variable to be used in the next comparison; and clearing a sign bit, and turning over the edge trigging mode to make preparations for the next capture. By means of the method, only one input capture channel of the timer is occupied, and a central processing unit (CPU) can do other work, so that few system resources are occupied, an executive program has high efficiency, the expansibility is good, and influence on other tasks of a system is small.

Description

The method of input capture interrupt mode decoding infrared remote control
Technical field:
The present invention relates to the method for decoding infrared remote control, relate in particular to the input capture mode infrared method of decoding.
Background technology:
So-called infrared remote control system mainly is made of the two large divisions: the infrared coding radiating portion, the infrared decoding receiving unit, the infrared emission part is mainly by keyboard, the infrared coding chip, power supply, infrared transmitting tube forms, the infrared decoding part is by infrared receiving circuit, infrared decoding, power supply and application circuit form, the specialized hardware decoding chip that tradition is used, its function is fixed, the corresponding a kind of special-purpose decoding chip of a kind of coded format, very flexible, and mostly adopt now coded signal is inputted single-chip microcomputer, utilize single-chip microcomputer to decode, decoding software can be according to the actual needs of oneself, design various functions, and can suitably adjust, increase the function of existing circuit, by revising software, can adapt to various remote control coding chip, and software decode adopts query method usually, and namely single-chip microcomputer is constantly inquired about the level variation of infrared port, and it takies a large amount of CPU time and resource, when there is bit error rate height in other task situation in system, its step following (seeing Fig. 1):
Step 100: initialization, GP configuring IO is the infrared encoded signal signal input part;
Step 101: waiting signal is high level, opens the time that timer is measured high level, until run into low level, judges whether to meet the requirement of pulsewidth, does not meet then to abandon and thinks noise signal;
Step 102: measure low level width, do verification;
Step 103: the above-mentioned test that circulates, until all positions are all decoded complete.
Exist following defective in this query method decoding process:
1, the query method principle is the state that the port of CPU is being inquired about port always, is detecting width and the counting of pulse always, comes the ranging pulse width with the method, decodes according to coding rule again.
2, a large amount of cpu resource of query method consumption, or prohibit interruption, if opened interruption, being difficult to obtain correct time, system further expands difficulty.
Summary of the invention:
In order to solve the existing problem of background technology, the invention provides a kind of method of input capture interrupt mode decoding infrared remote control, comprise that step is as follows:
Configuration input capture timer starts the input capture timer in the single-chip microcomputer master routine, opens interruption;
Down trigger is obtained and is caught constantly value;
Value compares with catching last time constantly, calculates two minor ticks, namely is pulsewidth;
Whether state machine comparison pulsewidth meets the preamble code front end;
Be confirmed whether it is harbour;
State machine enters decoded state and compares pulsewidth whether meet coding rule;
Coding variable save encoded radio;
The value of catching deposits variable in, for next time relatively;
Prepare for catching next time along triggering mode in clear flag position, flipping side.
Whether described state machine comparison pulsewidth meets the preamble code front end, is then to be confirmed whether to be harbour, otherwise the clear flag position, flipping side is prepared for catching next time along triggering mode.
Described being confirmed whether is harbour, is then to enter decoded state, compares pulsewidth and whether meets the preamble code front end otherwise return.
Described state machine enters decoded state and compares pulsewidth whether meet coding rule, is then encoded radio to be saved in the coding variable, otherwise namely thinks clutter, abandons.
The every preservation first encoding of described coding variable value, bits of coded counting number value adds 1, until figure place meets the predictive encoding figure place, decoding is finished, state machine jumps to idle condition.
The inventive method, used a timer, this timer has the input capture function, when signal occurs to become along saltus step, can automatically record the moment when edge transition occurs, and triggering is interrupted, only in interrupt handling routine, process double moment value, calculate the signal pulsewidth with this, again decoding, input capture are exactly one or several identical edges of check, repeatedly calculate and average, again according to must computing obtaining the cycle information of inputting waveform, each passage can only be configured at every turn not be that rising edge is exactly negative edge according to difference.
The present invention adopts input capture interrupt mode decoding infrared remote control, only need take the input capture passage of a timer, and CPU can do other work, and occupying system resources is few, and executive routine efficient is high, and favorable expandability is little on the impact of other task of system.
Description of drawings:
Fig. 1 is the process flow diagram of the inventive method.
Embodiment:
With reference to Fig. 1, performing step of the present invention is as follows:
S1: configuration input capture timer in the single-chip microcomputer master routine, start the input capture timer, open interruption;
S2: down trigger is obtained and is caught constantly value.
S3: and caught the moment value last time relatively, calculate two minor ticks, namely be pulsewidth.
S4: state machine is in idle condition, and this moment, relatively whether pulsewidth met the preamble code front end, was then to change S5 over to, withdrawed from otherwise change S8 over to.
S5: be confirmed whether it is harbour, be then to enter decoded state, otherwise change S4 over to.
S6: state machine is in decoded state, this moment, relatively whether pulsewidth met: the coding rule of data " 0 " or data " 1 " or data " F ", be that then encoded radio displacement enters in the coding variable and preserves, bits of coded counting number value adds 1, until figure place meets the predictive encoding figure place, decoding is finished, state machine jumps to idle condition, i.e. S4, otherwise think clutter, abandon, change S7 over to.
S7: the value of catching deposits variable in, for next time relatively.
S8: prepare for catching next time along triggering mode in clear flag position, flipping side.

Claims (5)

1. the method for an input capture interrupt mode decoding infrared remote control comprises that step is as follows:
Configuration input capture timer starts the input capture timer in the single-chip microcomputer master routine, opens interruption;
Down trigger is obtained and is caught constantly value;
Value compares with catching last time constantly, calculates two minor ticks, namely is pulsewidth;
Whether state machine comparison pulsewidth meets the preamble code front end;
Be confirmed whether it is harbour;
State machine enters decoded state and compares pulsewidth whether meet coding rule;
Coding variable save encoded radio;
The value of catching deposits variable in, for next time relatively;
Prepare for catching next time along triggering mode in clear flag position, flipping side.
2. method according to claim 1 is characterized in that, whether described state machine comparison pulsewidth meets the preamble code front end, is then to be confirmed whether to be harbour, otherwise the clear flag position, flipping side is prepared for catching next time along triggering mode.
3. method according to claim 1 is characterized in that, described being confirmed whether is harbour, is then to enter decoded state, compares pulsewidth and whether meets the preamble code front end otherwise return.
4. method according to claim 1 is characterized in that, described state machine enters decoded state and compare pulsewidth whether meet coding rule, is then encoded radio to be saved in the coding variable, otherwise namely thinks clutter, abandons.
5. method according to claim 4 is characterized in that, the every preservation first encoding of described coding variable value, and bits of coded counting number value adds 1, until figure place meets the predictive encoding figure place, decoding is finished, state machine jumps to idle condition.
CN2012104368672A 2012-10-26 2012-10-26 Method for decoding infrared remote control by means of input capture interrupt mode Pending CN102938197A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012104368672A CN102938197A (en) 2012-10-26 2012-10-26 Method for decoding infrared remote control by means of input capture interrupt mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012104368672A CN102938197A (en) 2012-10-26 2012-10-26 Method for decoding infrared remote control by means of input capture interrupt mode

Publications (1)

Publication Number Publication Date
CN102938197A true CN102938197A (en) 2013-02-20

Family

ID=47697089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012104368672A Pending CN102938197A (en) 2012-10-26 2012-10-26 Method for decoding infrared remote control by means of input capture interrupt mode

Country Status (1)

Country Link
CN (1) CN102938197A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714690A (en) * 2013-12-23 2014-04-09 乐视致新电子科技(天津)有限公司 Method and device for resolving physical codes from remote control coded pulses
CN107545719A (en) * 2016-06-24 2018-01-05 深圳市芯智科技有限公司 A kind of infrared remote control decoding method for display
CN107580702A (en) * 2015-04-14 2018-01-12 高通股份有限公司 The virtual GPIO of enhancing with multimode modulation
CN109003435A (en) * 2018-10-25 2018-12-14 中环天仪股份有限公司 A kind of decoding circuit and implementation method of infrared remote-controlled signal
CN111052690A (en) * 2017-10-26 2020-04-21 欧姆龙株式会社 Data acquisition method and data acquisition device
CN111427416A (en) * 2020-03-09 2020-07-17 深圳市锐同技术有限公司 Infrared decoding method based on analog capture

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404113A (en) * 2008-11-06 2009-04-08 成都九洲电子信息系统有限责任公司 Method for implementing infrared remote control decoding by software in embedded system
US20100117853A1 (en) * 2007-04-18 2010-05-13 Tte Technology, Inc. Infra-red (ir) decoding circuit
CN102457268A (en) * 2010-10-15 2012-05-16 北京德威特电力系统自动化有限公司 Implementation method for 32-bit capture register
CN102522996A (en) * 2011-12-08 2012-06-27 北京握奇数据系统有限公司 Decoding method and decoding device of FM0 coded data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100117853A1 (en) * 2007-04-18 2010-05-13 Tte Technology, Inc. Infra-red (ir) decoding circuit
CN101404113A (en) * 2008-11-06 2009-04-08 成都九洲电子信息系统有限责任公司 Method for implementing infrared remote control decoding by software in embedded system
CN102457268A (en) * 2010-10-15 2012-05-16 北京德威特电力系统自动化有限公司 Implementation method for 32-bit capture register
CN102522996A (en) * 2011-12-08 2012-06-27 北京握奇数据系统有限公司 Decoding method and decoding device of FM0 coded data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
何乃味: "单片机定时器捕获模式解码红外遥控器的方法", 《现代电子技术》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714690A (en) * 2013-12-23 2014-04-09 乐视致新电子科技(天津)有限公司 Method and device for resolving physical codes from remote control coded pulses
CN103714690B (en) * 2013-12-23 2018-03-06 乐视致新电子科技(天津)有限公司 The method and device of physics code is parsed from remote control code pulse
CN107580702A (en) * 2015-04-14 2018-01-12 高通股份有限公司 The virtual GPIO of enhancing with multimode modulation
CN107580702B (en) * 2015-04-14 2021-03-26 高通股份有限公司 Enhanced virtual GPIO with multi-mode modulation
CN107545719A (en) * 2016-06-24 2018-01-05 深圳市芯智科技有限公司 A kind of infrared remote control decoding method for display
CN111052690A (en) * 2017-10-26 2020-04-21 欧姆龙株式会社 Data acquisition method and data acquisition device
CN109003435A (en) * 2018-10-25 2018-12-14 中环天仪股份有限公司 A kind of decoding circuit and implementation method of infrared remote-controlled signal
CN111427416A (en) * 2020-03-09 2020-07-17 深圳市锐同技术有限公司 Infrared decoding method based on analog capture

Similar Documents

Publication Publication Date Title
CN102938197A (en) Method for decoding infrared remote control by means of input capture interrupt mode
CN102467477B (en) Baud rate self-adapting Modbus relay and Baud rate self-adapting system and method
CN103645725B (en) A kind of robot teaching method for planning track and system
CN105959143B (en) A kind of FlexRay bus protocol analysis system and method based on digital fluorescence oscilloscope
US8677367B2 (en) Execution order decision device
RU2018109361A (en) METHODS AND SYSTEMS FOR DETERMINING THE LOCATION OF THE DEVICE FOR CLEANING THE ORAL CAVITY
Ghasemieh et al. Survivability evaluation of fluid critical infrastructures using hybrid Petri nets
CN110910629B (en) Infrared remote control signal decoding method and system based on single chip microcomputer and metering device
CN107707446A (en) A kind of SENT bus encoding/decodings, triggering and analysis method based on FPGA
CN102540213B (en) Dynamic grouping and satellite selecting method based on self adaption
CN105356972A (en) Low-power-consumption RFID-tag-based PIE decoding method and decoder using the same
CN106682553A (en) Strip-card software decoding method
CN107506676A (en) A kind of RFID anti-collision method estimated based on dynamic detection point and label
CN103942425A (en) Data processing method and device
CN109344078A (en) Using the embedded real-time operating system time performance test method of FPGA
CN105654004A (en) Intelligent gating barcode decoding method and chip
CN103218219A (en) Compact function trace
US20140153623A1 (en) Device for auto baud rate detection
CN104392600A (en) Method for storing by collecting different infrared frequencies
CN109977737A (en) A kind of character recognition Robust Method based on Recognition with Recurrent Neural Network
CN103869156B (en) A kind of two mixing time difference measurement method and measuring system
CN105956178B (en) Key node extracting method based on gate level circuit emulation
CN106249851B (en) Input information determination method and device
CN103678136B (en) Data race false positive reduction method based on control flow
CN108469987A (en) It is a kind of that system is verified based on the interruption for interrupting controlling stream graph

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130220