CN111627200B - Signal modulation method and circuit based on infrared protocol and remote control terminal - Google Patents

Signal modulation method and circuit based on infrared protocol and remote control terminal Download PDF

Info

Publication number
CN111627200B
CN111627200B CN202010412077.5A CN202010412077A CN111627200B CN 111627200 B CN111627200 B CN 111627200B CN 202010412077 A CN202010412077 A CN 202010412077A CN 111627200 B CN111627200 B CN 111627200B
Authority
CN
China
Prior art keywords
infrared
pulse
type
infrared protocol
protocol
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.)
Active
Application number
CN202010412077.5A
Other languages
Chinese (zh)
Other versions
CN111627200A (en
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.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner 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 Allwinner Technology Co Ltd filed Critical Allwinner Technology Co Ltd
Priority to CN202010412077.5A priority Critical patent/CN111627200B/en
Publication of CN111627200A publication Critical patent/CN111627200A/en
Application granted granted Critical
Publication of CN111627200B publication Critical patent/CN111627200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C23/00Non-electrical signal transmission systems, e.g. optical systems
    • G08C23/04Non-electrical signal transmission systems, e.g. optical systems using light waves, e.g. infrared
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B10/00Transmission systems employing electromagnetic waves other than radio-waves, e.g. infrared, visible or ultraviolet light, or employing corpuscular radiation, e.g. quantum communication
    • H04B10/11Arrangements specific to free-space transmission, i.e. transmission through air or vacuum
    • H04B10/114Indoor or close-range type systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B10/00Transmission systems employing electromagnetic waves other than radio-waves, e.g. infrared, visible or ultraviolet light, or employing corpuscular radiation, e.g. quantum communication
    • H04B10/50Transmitters
    • H04B10/516Details of coding or modulation
    • H04B10/524Pulse modulation

Landscapes

  • Physics & Mathematics (AREA)
  • Electromagnetism (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • General Physics & Mathematics (AREA)
  • Selective Calling Equipment (AREA)
  • Optical Communication System (AREA)

Abstract

The invention discloses a signal modulation method, a circuit and a remote control terminal based on an infrared protocol, wherein the method comprises the following steps: receiving an infrared control command, and determining an infrared protocol type according to target control equipment of the infrared control command; according to the infrared protocol type, encoding the infrared control command to obtain a plurality of pulse encoding data, wherein the pulse encoding data comprises a pulse type and a pulse duration; and controlling a built-in PWM module to output the infrared protocol waveform of the pulse type within the pulse duration through one of overtime callback of a software timer or hardware timing interrupt according to the type of the carrying system. The invention realizes the infrared protocol modulation and transmission through the built-in PWM module and the timer, has low influence on CPU load in the transmission process, does not influence the response and processing of other interrupts, and can support various protocols.

Description

Signal modulation method and circuit based on infrared protocol and remote control terminal
Technical Field
The invention relates to the technical field of infrared communication, in particular to a signal modulation method and circuit based on an infrared protocol and a remote control terminal.
Background
In an internet of things system of an intelligent home, as an intelligent device of a control center, many peripheral devices such as an air conditioner, a television, a fan, a motorized curtain and the like need to be controlled and used, and therefore, the control center needs to support various infrared protocols. The intelligent device serving as the control center generally carries an operating system, needs to process various algorithms which consume a CPU, and needs to accurately acquire and respond to external signals in real time.
Software simulation in a mode that the intelligent device of the control center supports various infrared protocols at present generally depends on a delay function of CPU busy waiting such as delay, and the infrared protocol signals are simulated by circularly delaying and switching GPIO high and low levels, so that the infrared protocol signals cannot be preempted by other tasks in the sending process, including hardware interruption, which may cause part of interruption blockage requiring real-time response, and influence the work of other modules of the system.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a signal modulation method based on an infrared protocol, which can realize software simulation and has low load on a CPU.
The invention also provides a signal transmitting circuit based on the infrared protocol, which uses the signal modulation method based on the infrared protocol.
The invention also provides a remote control terminal comprising the signal transmitting circuit based on the infrared protocol.
The signal modulation method based on the infrared protocol according to the embodiment of the first aspect of the invention comprises the following steps: receiving an infrared control command, and determining an infrared protocol type according to target control equipment of the infrared control command; according to the infrared protocol type, encoding the infrared control command to obtain a plurality of pulse encoding data, wherein the pulse encoding data comprises a pulse type and a pulse duration; and controlling a built-in PWM module to output the infrared protocol waveform of the pulse type within the pulse duration through one of overtime callback of a software timer or hardware timing interrupt according to the type of the carrying system.
The signal modulation method based on the infrared protocol provided by the embodiment of the invention at least has the following beneficial effects: the infrared coding is realized by software without a special infrared coding and signal modulation hardware unit, the infrared protocol modulation and transmission are realized by a built-in PWM module and a timer, the influence of the transmission process on the CPU load is low, the response and the processing of other interrupts are not influenced, and various protocols can be supported.
According to some embodiments of the invention, the method of obtaining pulse encoded data comprises: acquiring signal characteristics of a guide area and signal characteristics of a data area according to the frame format characteristics of the infrared protocol type; and acquiring the pulse coding data of a plurality of guide areas according to the signal characteristics of the guide areas, and acquiring the pulse coding data of a plurality of data areas according to the signal characteristics of the data areas and the infrared control command.
According to some embodiments of the invention, if the carrying system is Linux or Andriod, the PWM module is controlled to output the infrared protocol waveform through timeout callback of a Linux kernel high-precision timer.
According to some embodiments of the present invention, if the onboard system is an RTOS, the PWM module is controlled to output the infrared protocol waveform through hardware timer interrupt.
According to some embodiments of the invention, the method of outputting the infrared protocol waveform comprises: and the PWM module sequentially reads the pulse coded data in one of the overtime callback of a software timer or the hardware timing interruption, configures the PWM duty ratio according to the pulse type and sets the overtime time according to the pulse duration.
According to some embodiments of the present invention, if the pulse type belongs to a carrier type, configuring a PWM duty cycle according to a carrier phase corresponding to the infrared protocol type; and if the pulse type belongs to the level type, configuring the duty ratio of PWM to be 0 or 1 according to the infrared protocol type.
According to some embodiments of the invention, a method of configuring a PWM duty cycle according to the pulse type comprises: if the pulse type belongs to the carrier type, configuring a PWM duty ratio according to a carrier phase corresponding to the infrared protocol type; and if the pulse type belongs to the level type, configuring the duty ratio of PWM to be 0 or 1 according to the infrared protocol type.
According to some embodiments of the invention, the method of outputting an infrared protocol waveform further comprises: before the PWM module outputs the infrared protocol waveform, setting the frequency of the PWM module according to the infrared protocol type, enabling the PWM module, initializing a software timer or the hardware timer, and setting a first timing; and when the PWM module is detected to finish processing the pulse coding data, closing the hardware timer and the PWM module.
According to some embodiments of the invention, the first timing is 1 ms.
The signal transmitting circuit based on the infrared protocol according to the second aspect of the invention comprises: a master control CPU, configured to control the PWM port to output the infrared protocol waveform in the method according to the embodiment of the second aspect of the present invention; the infrared transmitting device is used for transmitting the infrared protocol waveform; and the driving device is respectively connected with the PWM port of the main control CPU and the input end of the infrared emission device and is used for driving the infrared emitter to send the infrared protocol waveform.
The signal transmitting circuit based on the infrared protocol has the following beneficial effects: the infrared protocol modulation and transmission are realized through the built-in PWM output module and the timer, the influence on the CPU load in the transmission process is low, the response and the processing of other interrupts are not influenced, and various protocols can be supported; only a universal main control CPU chip is needed, and the production cost is reduced.
The remote control terminal according to the third aspect of the present invention includes the signal transmitting circuit based on the infrared protocol according to the second aspect of the present invention.
The remote control terminal according to the embodiment of the invention at least has the following beneficial effects: the infrared protocol modulation and transmission are realized through the built-in PWM module and the timer, the influence on the CPU load in the transmission process is low, the response and the processing of other interrupts are not influenced, and various protocols can be supported; only a general master control CPU chip is needed, and the production cost is effectively reduced.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic illustration of the steps of a method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of IR encoded logic bits in a method according to an embodiment of the invention;
FIG. 3 is a diagram illustrating an IR encoded frame format in a method according to an embodiment of the invention;
FIG. 4 is a block diagram of software in a method of an embodiment of the invention;
FIG. 5 is a software flow diagram of infrared modulated transmission in a method of an embodiment of the present invention;
fig. 6 is a hardware circuit block diagram of an infrared transmitting circuit of an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and larger, smaller, larger, etc. are understood as excluding the number, and larger, smaller, inner, etc. are understood as including the number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
Referring to fig. 1, a method of an embodiment of the present invention includes the following steps. Receiving an infrared control command, wherein the infrared control command comprises the following steps: the object to be operated (i.e. the target control device) and the corresponding command content determine the infrared protocol type according to the target control device, and ensure that the infrared control command is forwarded according to the infrared protocol type adopted when the target control device receives the signal. And according to the infrared protocol type, segmenting and encoding the infrared control command to obtain a plurality of pulse encoding data, wherein each pulse encoding data comprises a corresponding pulse type and pulse duration, and the pulse encoding data form a complete infrared signal data to be transmitted. According to the type of the carrying system, the built-in PWM module is controlled to process pulse coding data one by one through one of overtime callback of a software timer or hardware timing interruption, infrared protocol waveforms of corresponding pulse types are output within the pulse duration, the pulse coding data corresponding to the infrared control command are processed, and therefore a complete infrared signal data waveform is generated.
The process of encoding the infrared control command according to the infrared protocol type comprises the following steps: acquiring signal characteristics of a guide area and signal characteristics of a data area according to frame format characteristics of an infrared protocol type, wherein the data area comprises an address area and a command area; and acquiring pulse coded data of a plurality of guide areas according to the signal characteristics of the guide areas, and acquiring pulse coded data of a plurality of data areas according to the signal characteristics of the data areas and the infrared control command.
Referring to fig. 2, taking the NEC protocol as an example, one frame of NEC infrared command frame consists of a boot code, an address field, and a command field; the pilot code includes a 9ms carrier and a 4.5ms low level. Each bit of data, as seen in fig. 3, is represented by a 560us carrier and a low level at different times, the length of the low level defining a logic 1 and a logic 0. The signal of the pilot zone has different formats according to different protocol types, and for the NEC protocol, the pilot zone can be divided into two pulse encoding data, wherein the pulse type of the first pulse encoding data belongs to a carrier type, the pulse time is 9ms, the pulse type of the other pulse encoding data belongs to a level type, the pulse time is 4.5ms, and the pulse type is a low-level subtype. For NEC protocol, a data area (including an address field and a command field) may be understood as several logical bits of data, each logical bit of data including two pulse-encoded data, the first pulse-encoded data having a pulse type belonging to a carrier type and a pulse time of 560 us. The second pulse type of the pulse-coded data belongs to the level type and is a low-level subtype, if the logic bit is 1, the corresponding pulse time is 2.25ms-560us, otherwise, if the logic bit is 0, the corresponding pulse time is 1.12ms-560 us. For other types of protocols, the division can be performed according to a similar method as described above to obtain a plurality of pulse encoded data, where each pulse encoded data includes a pulse type and a pulse time. Obviously, if the carrier frequencies or duty cycles in the protocol frame format are not identical, they can be divided into different carrier subtypes. In some embodiments of the present invention, the pulse-coded data may include only the pulse type and pulse time, or may directly include pulse-related characteristic data, such as frequency duty cycle.
Referring to fig. 4, the infrared application layer determines the type of the infrared protocol according to the infrared control command and calls the infrared coding interface to perform infrared protocol coding. The infrared coding interface transmits the infrared control command, the infrared protocol type and other parameters to the infrared coding library. The infrared protocol coding library converts the infrared control command into a plurality of pulse coding data according to the infrared protocol type, wherein the pulse coding data comprise the pulse type and the pulse time. And then the infrared coding interface layer transmits the obtained pulse coding data to an infrared transmission driving module, and the driving module calls a PWM module and a corresponding timer to complete the modulation of the infrared protocol waveform. In the embodiment of the invention, if the carried system is Linux or Andriod, the overtime callback of a Linux kernel high-precision timer (whose response precision is within 20 us) is used for controlling the PWM module to output the infrared protocol waveform; if the loaded system is RTOS, the PWM module is controlled to output an infrared protocol waveform (the precision is in the us level) through hardware timing interruption.
In the method according to one embodiment of the present invention, an operating system of a Linux kernel such as Linux or Andriod is used as a loading system, and the output of the infrared protocol waveform is realized by using timeout callback of a Linux kernel high-precision timer, referring to fig. 5. After receiving the infrared pulse coding data, initializing the PWM module, including setting the PWM frequency, enabling the PWM module, and initializing a Linux kernel high-precision timer, wherein the first timing is set to be 1 ms. And after the timing reaches 1ms, entering software timeout callback. And in software timeout tuning, judging whether the pulse coding data of the frame is sent out or not at each time, and if not, acquiring the pulse coding data of the time, including the pulse type and the pulse time. If the pulse type belongs to the carrier type, the duty ratio of the PWM module is configured to output a corresponding waveform, if the pulse type is not the carrier type, the pulse type is a level type, taking an NEC protocol as an example, a low level should be output, and at this time, the duty ratio of the PWM is set to 0%. If the level type is a high level, setting the duty ratio of the PWM to 100% (namely 1); and sets the timeout time according to the pulse duration. And if the pulse coding data of the frame is found to be completely transmitted in the software timeout callback, returning the corresponding state to the infrared transmitting function. And (4) the infrared sending function detects the sending completion state, and the Linux kernel high-precision timer and the PWM module are closed.
In the method according to another embodiment of the present invention, a real-time system such as an RTOS is used as a mounted system, and the output of the infrared protocol waveform is realized by using the timer interrupt of the hardware timer. The method comprises the following steps: initializing the PWM module, including setting PWM frequency, enabling the PWM module, initializing a corresponding hardware timer, and setting a first timing. And entering hardware timing interruption, configuring the duty ratio of the PWM module according to the pulse type, and setting the duty ratio as timeout time according to the pulse duration until all the pulse coding data of the frame are sent. And when detecting that the pulse coding data of the frame is sent, closing the corresponding hardware timer and the PWM module.
The signal transmitting circuit based on the infrared protocol of the embodiment of the present invention, referring to fig. 6, includes: the master control CPU is used for controlling the PWM port to output the infrared protocol waveform by using the method; an infrared emitting device for emitting an infrared protocol waveform; and the driving device is respectively connected with the PWM port of the main control CPU and the input end of the infrared emission device and is used for driving the infrared emitter to send the infrared protocol waveform.
The remote control terminal comprises the signal transmitting circuit based on the infrared protocol, and is used for receiving the infrared control command, transmitting the corresponding infrared protocol waveform and controlling the corresponding target control equipment. The remote control terminal of the embodiment of the invention comprises, but is not limited to, an intelligent sound box, a remote controller and the like.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

Claims (7)

1. A method for modulating a signal based on an infrared protocol, comprising:
receiving an infrared control command, and determining an infrared protocol type according to target control equipment of the infrared control command;
according to the infrared protocol type, encoding the infrared control command to obtain a plurality of pulse encoding data, wherein the pulse encoding data comprises a pulse type and a pulse duration;
controlling a built-in PWM module to output the infrared protocol waveform of the pulse type within the pulse duration through one of overtime callback of a software timer or hardware timing interrupt according to the type of a carrying system, and the method comprises the following steps: if the carrying system is Linux or Andriod, controlling the PWM module to output the infrared protocol waveform through overtime callback of a Linux kernel high-precision timer; if the carrying system is RTOS, controlling the PWM module to output the infrared protocol waveform through hardware timing interruption, wherein the output method of the infrared protocol waveform comprises the following steps: and the PWM module sequentially reads the pulse coded data in one of the overtime callback of a software timer or the hardware timing interruption, configures the PWM duty ratio according to the pulse type and sets the overtime time according to the pulse duration.
2. The method for signal modulation based on infrared protocol according to claim 1, wherein the method for obtaining pulse-coded data comprises:
acquiring signal characteristics of a guide area and signal characteristics of a data area according to the frame format characteristics of the infrared protocol type;
and acquiring the pulse coding data of a plurality of guide areas according to the signal characteristics of the guide areas, and acquiring the pulse coding data of a plurality of data areas according to the signal characteristics of the data areas and the infrared control command.
3. The method of claim 1, wherein configuring the PWM duty cycle according to the pulse type comprises:
if the pulse type belongs to the carrier type, configuring a PWM duty ratio according to a carrier phase corresponding to the infrared protocol type;
and if the pulse type belongs to the level type, configuring the duty ratio of PWM to be 0 or 1 according to the infrared protocol type.
4. The method of claim 3, wherein the method of outputting the IR protocol waveform further comprises:
before the PWM module outputs the infrared protocol waveform, setting the frequency of the PWM module according to the infrared protocol type, enabling the PWM module, initializing a software timer or a hardware timer, and setting a first timing;
and when the PWM module is detected to finish processing the pulse coding data, closing the hardware timer and the PWM module.
5. The method of claim 4, wherein the first timing is 1 ms.
6. A signal transmission circuit based on an infrared protocol, comprising:
a master CPU for controlling the PWM port to output the infrared protocol waveform using the method of any one of claims 1 to 5;
the infrared transmitting device is used for transmitting the infrared protocol waveform;
and the driving device is respectively connected with the PWM output port of the main control CPU and the input end of the infrared emission device and is used for driving the infrared emitter to send the infrared protocol waveform.
7. A remote control terminal characterized by comprising the signal transmission circuit based on the infrared protocol according to claim 6.
CN202010412077.5A 2020-05-15 2020-05-15 Signal modulation method and circuit based on infrared protocol and remote control terminal Active CN111627200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010412077.5A CN111627200B (en) 2020-05-15 2020-05-15 Signal modulation method and circuit based on infrared protocol and remote control terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010412077.5A CN111627200B (en) 2020-05-15 2020-05-15 Signal modulation method and circuit based on infrared protocol and remote control terminal

Publications (2)

Publication Number Publication Date
CN111627200A CN111627200A (en) 2020-09-04
CN111627200B true CN111627200B (en) 2021-03-19

Family

ID=72260678

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010412077.5A Active CN111627200B (en) 2020-05-15 2020-05-15 Signal modulation method and circuit based on infrared protocol and remote control terminal

Country Status (1)

Country Link
CN (1) CN111627200B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI823361B (en) * 2022-04-25 2023-11-21 德禮實業有限公司 Ceiling fan remote control code setting method and ceiling fan receiver

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114120616B (en) * 2021-11-24 2023-03-28 深圳市欧瑞博科技股份有限公司 Infrared signal transmitting method and device, electronic equipment and storage medium
CN114500204B (en) * 2022-03-30 2022-07-19 浙江地芯引力科技有限公司 FSK data transmission control device, FSK data transmission control method, timer, MCU and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI823361B (en) * 2022-04-25 2023-11-21 德禮實業有限公司 Ceiling fan remote control code setting method and ceiling fan receiver

Also Published As

Publication number Publication date
CN111627200A (en) 2020-09-04

Similar Documents

Publication Publication Date Title
CN111627200B (en) Signal modulation method and circuit based on infrared protocol and remote control terminal
US9811499B2 (en) Transcoding and transmission over a serial bus
US20180173665A1 (en) Hard reset over i3c bus
US20210101421A1 (en) Tire pressure sensor identification method, apparatus and device
US7288982B2 (en) Signal converting circuit
US10579581B2 (en) Multilane heterogeneous serial bus
JP2017520053A (en) Dynamically adjustable multiline bus shared by multiprotocol devices
CN107748509B (en) ASI communication slave machine implementation method based on single chip microcomputer transceiving control
JP2943712B2 (en) Remote control method
WO2017065923A1 (en) Methods to avoid i2c void message in i3c
US20180173667A1 (en) Hard reset over i3c bus
CN111478719B (en) System and method for configuring an external radar device through high-speed reverse data transmission
CN109859454B (en) Infrared code sending circuit, chip, remote control equipment and air conditioner based on infrared protocol
CN111988417B (en) Communication control method of terminal of Internet of things
EP3855871B1 (en) Method for performing a firmware update of a lighting technology device
WO2018005516A1 (en) Accelerated i3c master stop
CN116209115A (en) Data signal processing device and data signal processing system
WO2019112698A1 (en) Protocol-framed clock line driving for device communication over master-originated clock line
JP2000032000A (en) Infrared communication equipment
CN108536637B (en) Communication system and method for transmitter conditioning chip
US20240031833A1 (en) Systems, methods, and devices for enhanced integration of wireless environments
CN114443414A (en) Intelligent health management fan control method based on IPMI bus
KR20000003775A (en) Method for making compatible remote control using setting
CN114429708A (en) Remote control method, storage medium and terminal equipment
CN113179127A (en) Information interaction method and system

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
GR01 Patent grant
GR01 Patent grant