CN104835312A - Method for decoding remote controller - Google Patents

Method for decoding remote controller Download PDF

Info

Publication number
CN104835312A
CN104835312A CN201510240627.9A CN201510240627A CN104835312A CN 104835312 A CN104835312 A CN 104835312A CN 201510240627 A CN201510240627 A CN 201510240627A CN 104835312 A CN104835312 A CN 104835312A
Authority
CN
China
Prior art keywords
code
data bit
negative edge
time
mcu
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
CN201510240627.9A
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.)
SHENZHEN ZHENBANG INTELLIGENT TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN ZHENBANG INTELLIGENT 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 SHENZHEN ZHENBANG INTELLIGENT TECHNOLOGY Co Ltd filed Critical SHENZHEN ZHENBANG INTELLIGENT TECHNOLOGY Co Ltd
Priority to CN201510240627.9A priority Critical patent/CN104835312A/en
Publication of CN104835312A publication Critical patent/CN104835312A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a method for decoding a remote controller. The method comprises the following steps: S1, applying a voltage of 5V to a pull-up resistor R1; S2, pressing a remote controller key, transmitting infrared data in real time, receiving and detecting the infrared data in real time by virtue of an infrared receiving tube, so as to obtain a remote controller code; S3, receiving the remote controller code by virtue of an MCU, interrupting a falling edge by virtue of a pin P10, timing by virtue of a timer in the MCU, and recording the time of an interruption point by virtue of the timer when the falling edge is interrupted at every time; extracting time difference of two adjacent falling edge interruption points after the timing is ended, and acquiring a header code, a data code as well as a bit 0 and a bit 1 in the data code; and S4, further detecting high level by virtue of the MCU, determining the ending of the transmission of the remote control code, and ending the decoding. By adopting the method, an external decoder is not needed, and the decoding is carried out by the MCU, so that the cost is reduced, the decoding accuracy is improved, and the operation efficiency is improved.

Description

A kind of method of remote control decoding
Technical field
The present invention relates to telecontrol engineering field, particularly relate to a kind of method of remote control decoding.
Background technology
At present, the method comparatively commonly used remote control decoding uses oscillograph to receive its waveform, carries out Decoding Analysis by its waveform.Need like this to have equipment oscillographic while, also need artificially to carry out rigorous analysis to the waveform on oscillograph, not only spend larger energy and manpower when decoded data is more especially, but also need to use high precision oscillograph, cost is high, and error is greatly, time-consuming.
Summary of the invention
The object of this invention is to provide a kind of method of remote control decoding, reduce costs, improve decoding accuracy rate, raise the efficiency.
Technical scheme of the present invention is a kind of method of remote control decoding, the hardware unit that the method adopts comprises infrared receiving tube, the MCU of described infrared receiving tube of being connected by resistance R2 and simultaneously connect the pull-up resistor R1 of described infrared receiving tube and resistance R2, and described method comprises the steps:
S1, add 5V voltage to pull-up resistor R1;
S2, press remote controller key, send infrared data in real time, described infrared receiving tube receives and detects infrared data in real time, obtains remote controller code;
After S3, MCU receive described remote controller code, by pin P 10generation negative edge interrupts, and meanwhile, the timer in described MCU starts timing, and described timer, when each negative edge interrupts, records the time of the point of interruption; After timing terminates, get the mistiming of often adjacent two negative edge points of interruption, then draw 0 and 1 in first code and numeric data code and numeric data code; And
S4, described MCU continue high level to be detected, and determine that remote control mode sends and terminate, decoding terminates.
Telepilot often presses primary key, pin P 10by detecting, can obtain a remote controller code, this remote controller code is divided into first code and numeric data code, and first code is front, and numeric data code, rear, has a lot of data bit in described numeric data code, and each data bit can only be 0 or 1; Telepilot often presses primary key, the pin P in receiving end MCU 10can produce at least 3 negative edges to interrupt, timer falls in each of the lower puts the time of record along break period.By getting the mistiming of often adjacent two negative edge points of interruption, the time span of first code can be calculated, the type of each data bit in numeric data code and the duration of each data bit, finally realizing complete decoding.Without the need to external demoder, MCU decodes voluntarily, reduces cost, improves decoding accuracy rate, increases work efficiency.
Further, described step S3 comprises the steps:
S301, pin P 10be set to negative edge interrupt mode, when not having button to press, pin P 10high level detected, when there being button to press, pin P 10start to produce negative edge to interrupt, and the level of saltus step detected, start timer timing simultaneously; Then, if do not have new negative edge to interrupt producing, pin P 10high level detected, if there is new negative edge to interrupt producing, the time of the second time point of interruption is deducted the time of the first time point of interruption by MCU, obtains the numerical value T of first code s, then remove described count value T s;
If S302 does not have new negative edge to interrupt producing, pin P 10high level detected; If there is new negative edge to interrupt producing, interrupts starting from third time negative edge, deduct the time of a front point of interruption with the time of a rear point of interruption, just draw the mistiming of the twice negative edge interruption in adjacent front and back, be i.e. the count value T of a data bit in numeric data code n, n>=1, gets positive integer;
S303, by doing the mistiming that twice negative edge in adjacent front and back interrupts, drawing the count value of all data bit in described numeric data code, and determining that each data bit is 0 or 1; And
S304, as pin P 10after setting-up time, when not receiving new negative edge again, fall count value T clearly n, timeing closing device, this end of decoding.
Further, the count value of all meter digitals in the numeric data code that MCU obtains is divided into data bit 0 and data bit 1, and what count value was larger is data bit 1, and what count value was less is data bit 0; The count value of data bit 1 meets formula:
A*0.9<= T A<= A*1.1
In formula, A represents the setting value of data bit 1, T arepresent the detected value of data bit 1;
The count value of data bit 0 meets formula:
B*0.9<= T B<= B*1.1
In formula, B represents the setting value of data bit 0, T brepresent the detected value of data bit 0.
Further, A is 2.24ms, B is 1.1ms.
Further, R 1for 4k Ω, R 2for 1k Ω.
Further, the setting-up time in step S304 is 100ms.
Beneficial effect: the technical program is without the need to external demoder, and MCU decodes voluntarily, reduces cost, improves decoding accuracy rate, increases work efficiency.
Accompanying drawing explanation
Fig. 1 is the workflow diagram of an embodiment of the present invention;
Fig. 2 is the annexation schematic diagram of the another kind of embodiment of the present invention;
Fig. 3 is the level signal figure of the another kind of embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, preferably embodiment of the present invention is described in further detail:
See Fig. 1 to 3, a kind of method of remote control decoding, the hardware unit that the method adopts comprises infrared receiving tube, the MCU of described infrared receiving tube of being connected by resistance R2 and simultaneously connect the pull-up resistor R1 of described infrared receiving tube and resistance R2, this pull-up resistor R 1resistance be 4k Ω, resistance R 2resistance be 1k Ω, described method comprises the steps:
S1, add 5V voltage to pull-up resistor R1;
S2, press remote controller key, send infrared data in real time, described infrared receiving tube receives and detects infrared data in real time, obtains remote controller code;
After S3, MCU receive described remote controller code, by pin P 10generation negative edge interrupts, and meanwhile, the timer in described MCU starts timing, and described timer, when each negative edge interrupts, records the time of the point of interruption; After timing terminates, get the mistiming of often adjacent two negative edge points of interruption, then draw 0 and 1 in first code and numeric data code and numeric data code; And
S4, described MCU continue high level to be detected, and determine that remote control mode sends and terminate, decoding terminates.
Telepilot often presses primary key, pin P 10by detecting, can obtain a remote controller code, this remote controller code is divided into first code and numeric data code, and first code is front, and numeric data code, rear, has a lot of data bit in described numeric data code, and each data bit can only be 0 or 1; Telepilot often presses primary key, the pin P in receiving end MCU 10can produce at least 3 negative edges to interrupt, timer falls in each of the lower puts the time of record along break period.By getting the mistiming of often adjacent two negative edge points of interruption, the time span of first code can be calculated, the type of each data bit in numeric data code and the duration of each data bit, finally realizing complete decoding.Without the need to external demoder, MCU decodes voluntarily, reduces cost, improves decoding accuracy rate, increases work efficiency.
See Fig. 1, described step S3 comprises the steps:
S301, pin P 10be set to negative edge interrupt mode, when not having button to press, pin P 10high level detected, when there being button to press, pin P 10start to produce negative edge to interrupt, and the level of saltus step detected, start timer timing simultaneously; Then, if do not have new negative edge to interrupt producing, pin P 10high level detected, if there is new negative edge to interrupt producing, the time of the second time point of interruption is deducted the time of the first time point of interruption by MCU, obtains the count value T of first code s, then remove described count value T s;
If S302 does not have new negative edge to interrupt producing, pin P 10high level detected; If there is new negative edge to interrupt producing, interrupts starting from third time negative edge, deduct the time of a front point of interruption with the time of a rear point of interruption, just draw the mistiming of the twice negative edge interruption in adjacent front and back, be i.e. the count value T of a data bit in numeric data code n, n>=1, gets positive integer;
S303, by doing the mistiming that twice negative edge in adjacent front and back interrupts, drawing the count value of all data bit in described numeric data code, and determining that each data bit is 0 or 1; And
S304, as pin P 10after setting-up time, when not receiving new negative edge again, fall count value T clearly n, timeing closing device, this end of decoding.
The count value of all meter digitals in the numeric data code that MCU obtains is divided into data bit 0 and data bit 1, and what count value was larger is data bit 1, and what count value was less is data bit 0; The count value of data bit 1 meets formula:
A*0.9<= T A<= A*1.1
In formula, A represents the setting value of data bit 1, T arepresent the detected value of data bit 1;
The count value of data bit 0 meets formula:
B*0.9<= T B<= B*1.1
In formula, B represents the setting value of data bit 0, T brepresent the detected value of data bit 0.
Preferably, A is 2.24ms, B is 1.1ms.
In specific implementation process, setting value and detected value see the following form:
A(ms) T A(ms) B(ms) T B(ms)
First group of numerical value 2.24 2.016 1.1 0.99
Second group of numerical value 2.24 2.214 1.1 1.13
3rd group of numerical value 2.24 2.333 1.1 1.24
4th group of numerical value 2.24 2.464 1.1 1.21
Preferably, the setting-up time in step S304 is 100ms.
The present embodiment is without the need to external demoder, and MCU decodes voluntarily, reduces cost, improves decoding accuracy rate, increases work efficiency.
Above content is in conjunction with concrete preferred implementation further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, some simple deduction or replace can also be made, all should be considered as belonging to protection scope of the present invention.

Claims (6)

1. the method for a remote control decoding, the hardware unit that the method adopts comprises infrared receiving tube, the MCU of described infrared receiving tube of being connected by resistance R2 and simultaneously connect the pull-up resistor R1 of described infrared receiving tube and resistance R2, it is characterized in that, described method comprises the steps:
S1, add 5V voltage to pull-up resistor R1;
S2, press remote controller key, send infrared data in real time, described infrared receiving tube receives and detects infrared data in real time, obtains remote controller code;
After S3, MCU receive described remote controller code, by pin P 10generation negative edge interrupts, and meanwhile, the timer in described MCU starts timing, and described timer, when each negative edge interrupts, records the time of the point of interruption; After timing terminates, get the mistiming of often adjacent two negative edge points of interruption, then draw 0 and 1 in first code and numeric data code and numeric data code; And
S4, described MCU continue high level to be detected, and determine that remote control mode sends and terminate, decoding terminates.
2. the method for remote control decoding according to claim 1, is characterized in that, described step S3 comprises the steps:
S301, pin P 10be set to negative edge interrupt mode, when not having button to press, pin P 10high level detected, when there being button to press, pin P 10start to produce negative edge to interrupt, and the level of saltus step detected, start timer timing simultaneously; Then, if do not have new negative edge to interrupt producing, pin P 10high level detected, if there is new negative edge to interrupt producing, the time of the second time point of interruption is deducted the time of the first time point of interruption by MCU, obtains the numerical value T of first code s, then remove described count value T s;
If S302 does not have new negative edge to interrupt producing, pin P 10high level detected; If there is new negative edge to interrupt producing, interrupts starting from third time negative edge, deduct the time of a front point of interruption with the time of a rear point of interruption, just draw the mistiming of the twice negative edge interruption in adjacent front and back, be i.e. the count value T of a data bit in numeric data code n, n>=1, gets positive integer;
S303, by doing the mistiming that twice negative edge in adjacent front and back interrupts, drawing the count value of all data bit in described numeric data code, and determining that each data bit is 0 or 1; And
S304, as pin P 10after setting-up time, when not receiving new negative edge again, fall count value T clearly n, timeing closing device, this end of decoding.
3. the method for remote control decoding according to claim 2, is characterized in that: the count value of all meter digitals in the numeric data code that MCU obtains is divided into data bit 0 and data bit 1, and what count value was larger is data bit 1, and what count value was less is data bit 0; The count value of data bit 1 meets formula:
A*0.9<= T A<= A*1.1
In formula, A represents the setting value of data bit 1, T arepresent the detected value of data bit 1;
The count value of data bit 0 meets formula:
B*0.9<= T B<= B*1.1
In formula, B represents the setting value of data bit 0, T brepresent the detected value of data bit 0.
4. the method for remote control decoding according to claim 3, is characterized in that: A is 2.24ms, B is 1.1ms.
5. the method for remote control decoding according to claim 4, is characterized in that: R 1for 4k Ω, R 2for 1k Ω.
6. the method for remote control decoding according to claim 2, is characterized in that: the setting-up time in step S304 is 100ms.
CN201510240627.9A 2015-05-13 2015-05-13 Method for decoding remote controller Pending CN104835312A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510240627.9A CN104835312A (en) 2015-05-13 2015-05-13 Method for decoding remote controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510240627.9A CN104835312A (en) 2015-05-13 2015-05-13 Method for decoding remote controller

Publications (1)

Publication Number Publication Date
CN104835312A true CN104835312A (en) 2015-08-12

Family

ID=53813172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510240627.9A Pending CN104835312A (en) 2015-05-13 2015-05-13 Method for decoding remote controller

Country Status (1)

Country Link
CN (1) CN104835312A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107545719A (en) * 2016-06-24 2018-01-05 深圳市芯智科技有限公司 A kind of infrared remote control decoding method for display
CN109166301A (en) * 2018-11-05 2019-01-08 福建师范大学 A kind of infrared communication coding/decoding method of embedded system
CN117351691A (en) * 2023-12-05 2024-01-05 深圳市众鑫创展科技有限公司 Infrared control device, system, data transmission method, medium, and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6693968B1 (en) * 1999-06-02 2004-02-17 Motorola, Inc. Digital portable or mobile radio
CN101404113A (en) * 2008-11-06 2009-04-08 成都九洲电子信息系统有限责任公司 Method for implementing infrared remote control decoding by software in embedded system
CN101944287A (en) * 2009-07-03 2011-01-12 炬力集成电路设计有限公司 Decoding method and decoder for infrared remote control
CN102779405A (en) * 2012-07-10 2012-11-14 杭州海康威视数字技术股份有限公司 Digital video recorder, infrared remote control receiving device and method
CN102945599A (en) * 2012-11-17 2013-02-27 福州大学 Self-adaptive multi-system infrared decoding method, module and control circuit applying module

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6693968B1 (en) * 1999-06-02 2004-02-17 Motorola, Inc. Digital portable or mobile radio
CN101404113A (en) * 2008-11-06 2009-04-08 成都九洲电子信息系统有限责任公司 Method for implementing infrared remote control decoding by software in embedded system
CN101944287A (en) * 2009-07-03 2011-01-12 炬力集成电路设计有限公司 Decoding method and decoder for infrared remote control
CN102779405A (en) * 2012-07-10 2012-11-14 杭州海康威视数字技术股份有限公司 Digital video recorder, infrared remote control receiving device and method
CN102945599A (en) * 2012-11-17 2013-02-27 福州大学 Self-adaptive multi-system infrared decoding method, module and control circuit applying module

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘晓明等: "两种红外遥控解码技术的探讨", 《测控技术》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107545719A (en) * 2016-06-24 2018-01-05 深圳市芯智科技有限公司 A kind of infrared remote control decoding method for display
CN109166301A (en) * 2018-11-05 2019-01-08 福建师范大学 A kind of infrared communication coding/decoding method of embedded system
CN117351691A (en) * 2023-12-05 2024-01-05 深圳市众鑫创展科技有限公司 Infrared control device, system, data transmission method, medium, and program product
CN117351691B (en) * 2023-12-05 2024-03-22 深圳市众鑫创展科技有限公司 Infrared control device, system, data transmission method, medium, and program product

Similar Documents

Publication Publication Date Title
CN102354443B (en) Wireless infrared (IR) remote control device and operating method thereof
CN104835312A (en) Method for decoding remote controller
CN101630299B (en) Analysis and trigger method of I2C serial bus signal
CN102368076B (en) Card feeding speed testing method and device
CN106021165A (en) LIN bus decoding, triggering and analyzing technology
CN104361374A (en) Collecting and processing system and method of radio-frequency signals
CN204246794U (en) A kind of shooting counter for basketball training
WO2022121409A1 (en) Communication control method and apparatus for air conditioner, and communication system and readable storage medium
CN103760514A (en) Rapid detection method and device of electric energy meter
CN102063785B (en) Method for automatically emitting infrared remote control signals and system thereof
CN101739805A (en) Method for releasing message by remote keying
CN101860402B (en) Parallel data transmission method for reducing EMI
CN204389097U (en) A kind of manometer based on RFID technology of Internet of things
CN204242207U (en) A kind of Acquire and process system of radiofrequency signal
CN201387424Y (en) Intelligent ultrasonic test device for concrete fire disaster damage characters
CN202694547U (en) Broadband coded signal detection circuit and wireless remote control signal decoding circuit thereof
CN102939595A (en) Signal processing apparatus and signal processing method thereof
CN109634168B (en) Method for processing sensor pulse signal
CN105512068A (en) UART simulation method achieving baud-rate self-adoption
CN204731331U (en) A kind of flip flop equipment of SPDIF interface signal
CN204066468U (en) A kind of frame drum trainer
CN104730306A (en) Automatic decoding threshold setting method and oscilloscope with automatic decoding threshold setting function
CN204314322U (en) A kind of device of quick test spinning frame front roller rotating speed
CN219642291U (en) Timing equipment based on voice recognition
CN203493654U (en) Detection device of psychomotor speed

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518000 Guangdong province Shenzhen Guangming New District Gongming street Gongming South Avenue Geya Technology Building 3 building 1-4 layer

Applicant after: Shenzhen Zhenbang intelligent Polytron Technologies Inc

Address before: 518000 Guangdong, Nanshan District, Taoyuan, Longjing street, industrial zone, building A, building 2, building A, building on the ground floor, building B, building, building 6, building C, block B, building, building No. 3

Applicant before: SHENZHEN ZHENBANG INTELLIGENT TECHNOLOGY CO., LTD.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20150812