CN111240815B - Infrared signal modulation method and system based on linux - Google Patents

Infrared signal modulation method and system based on linux Download PDF

Info

Publication number
CN111240815B
CN111240815B CN202010003958.1A CN202010003958A CN111240815B CN 111240815 B CN111240815 B CN 111240815B CN 202010003958 A CN202010003958 A CN 202010003958A CN 111240815 B CN111240815 B CN 111240815B
Authority
CN
China
Prior art keywords
linux
precision
time
timer
infrared signal
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
CN202010003958.1A
Other languages
Chinese (zh)
Other versions
CN111240815A (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.)
Hangzhou Tuya Information Technology Co Ltd
Original Assignee
Hangzhou Tuya Information 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 Hangzhou Tuya Information Technology Co Ltd filed Critical Hangzhou Tuya Information Technology Co Ltd
Priority to CN202010003958.1A priority Critical patent/CN111240815B/en
Publication of CN111240815A publication Critical patent/CN111240815A/en
Application granted granted Critical
Publication of CN111240815B publication Critical patent/CN111240815B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4825Interrupt from clock, e.g. time of day
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Optical Communication System (AREA)

Abstract

The application discloses a linux-based infrared signal modulation method, which comprises the following steps: s2: starting a linux high-precision timer; s4: calculating whether the total time expires; s6: and when the total time is not expired, repeating the step S4, and when the total time is expired, closing the high-precision timer. Compared with the prior art, the application has the following beneficial effects: the high-precision timer has high time precision (the precision is less than 40 microseconds), can meet the requirement of infrared signal modulation on time precision, and is easy to identify. The high-precision time setting is realized based on a hardware timer and interrupt inside the CPU, the CPU core is not required to participate in time calculation, the CPU is not required to be monopolized for a long time, and the problems of high CPU occupancy rate, long waiting time required by other tasks and high power consumption are solved.

Description

Infrared signal modulation method and system based on linux
Technical Field
The application relates to the field of timing, in particular to a linux-based infrared signal modulation method.
Background
When the existing Linux-based embedded intelligent device develops the function based on infrared signal remote control, the existing LINUX frame is needed to realize the modulation of infrared signals through a timing switch infrared signal lamp. There are two types of infrared signal modulation based on LINUX: (1) time counting based on CPU busy waiting. However, a complete infrared signal has long total time, so that the debugging of the infrared signal requires long time to monopolize the CPU. Time counting is performed based on task sleep, but the accuracy is low (more than 4 MS), and the infrared signal accuracy is low.
Disclosure of Invention
The application mainly aims to provide a linux-based infrared signal modulation method, which comprises the following steps:
s2: starting a linux high-precision timer;
s4: calculating whether the total time expires;
s6: and when the total time is not expired, repeating the step S4, and when the total time is expired, closing the high-precision timer.
Optionally, the method further comprises: waiting for an infrared time code.
Optionally, the method further comprises: initializing the high precision timer.
Optionally, a high precision timer callback step is also included.
Optionally, the high precision timer callback step includes:
when the number of the current transmitted signals is smaller than the total number of signals, the infrared lamp is turned on or off;
and when the number of the currently transmitted signals is not less than the total number of signals, closing the high-precision timer and resetting the number of the currently transmitted signals.
The next timer expiration time is set and the number of transmitted signals is increased by 1.
According to an aspect of the present application, there is also provided a linux-based infrared signal modulation system, including:
the starting module is used for starting the linux high-precision timer;
a calculation module for calculating whether the total time expires;
and the closing module is used for repeating the steps when the total time is not expired, and closing the high-precision timer when the total time is expired.
The application also discloses a computer device comprising a memory, a processor and a computer program stored in the memory and executable by the processor, the processor implementing the method of any one of the above when executing the computer program.
The application also discloses a computer readable storage medium, a non-volatile readable storage medium having stored therein a computer program which, when executed by a processor, implements the method of any of the above.
The application also discloses a computer program product comprising computer readable code which, when executed by a computer device, causes the computer device to perform the method of any of the preceding claims.
Compared with the prior art, the application has the following beneficial effects:
the high-precision timer has high time precision (the precision is less than 40 microseconds), can meet the requirement of infrared signal modulation on time precision, and is easy to identify.
The high-precision time setting is realized based on a hardware timer and interrupt inside the CPU, the CPU core is not required to participate in time calculation, the CPU is not required to be monopolized for a long time, and the problems of high CPU occupancy rate, long waiting time required by other tasks and high power consumption are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, are incorporated in and constitute a part of this specification. The drawings and their description are illustrative of the application and are not to be construed as unduly limiting the application. In the drawings:
fig. 1-2 are schematic flow diagrams of a linux-based infrared signal modulation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a computer device according to one embodiment of the application; and
FIG. 4 is a schematic diagram of a computer-readable storage medium according to one embodiment of the application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
Referring to fig. 1-2, an embodiment of the present application provides a method for modulating infrared signals based on linux, including:
s2: starting a linux high-precision timer;
s4: calculating whether the total time expires;
s6: and when the total time is not expired, repeating the step S4, and when the total time is expired, closing the high-precision timer.
In an embodiment of the present application, the infrared signal modulation method based on linux further includes: waiting for an infrared time code.
In an embodiment of the present application, the infrared signal modulation method based on linux further includes: initializing the high precision timer.
In an embodiment of the present application, the infrared signal modulation method based on linux further includes: the method also comprises a high-precision timer callback step.
In an embodiment of the present application, the high precision timer callback step includes:
when the number of the current transmitted signals is smaller than the total number of signals, the infrared lamp is turned on or off;
and when the number of the currently transmitted signals is not less than the total number of signals, closing the high-precision timer and resetting the number of the currently transmitted signals.
The next timer expiration time is set and the number of transmitted signals is increased by 1.
The application also provides an infrared signal modulation system based on linux, which is characterized by comprising the following steps:
the starting module is used for starting the linux high-precision timer;
a calculation module for calculating whether the total time expires;
and the closing module is used for repeating the steps when the total time is not expired, and closing the high-precision timer when the total time is expired.
Compared with the prior art, the application has the following beneficial effects:
the high-precision timer has high time precision (the precision is less than 40 microseconds), can meet the requirement of infrared signal modulation on time precision, and is easy to identify.
The high-precision time setting is realized based on a hardware timer and interrupt inside the CPU, the CPU core is not required to participate in time calculation, the CPU is not required to be monopolized for a long time, and the problems of high CPU occupancy rate, long waiting time required by other tasks and high power consumption are solved.
Referring to fig. 3, the present application further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, where the processor implements the method of any one of the above when executing the computer program.
Referring to fig. 4, a computer readable storage medium, a non-volatile readable storage medium, has stored therein a computer program which, when executed by a processor, implements the method of any of the above.
A computer program product comprising computer readable code which, when executed by a computer device, causes the computer device to perform the method of any of the preceding claims.
It will be apparent to those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, or they may alternatively be implemented in program code executable by computing devices, such that they may be stored in a memory device for execution by the computing devices, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present application and is not intended to limit the present application, but various modifications and variations can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (6)

1. The infrared signal modulation method based on linux is characterized by comprising the following steps of:
s2: starting a linux high-precision timer;
s4: calculating whether the total time expires;
s6: repeating step S4 when the total time has not expired, and closing the high precision timer when the total time has expired;
high precision timer callback, comprising:
when the number of the current transmitted signals is smaller than the total number of signals, the infrared lamp is turned on or off;
when the number of the currently transmitted signals is not less than the total number of signals, closing the high-precision timer and resetting the number of the currently transmitted signals;
the next timer expiration time is set and the number of transmitted signals is increased by 1.
2. The linux-based infrared signal modulation method of claim 1, further comprising: waiting for an infrared time code.
3. The linux-based infrared signal modulation method of claim 2, further comprising: initializing the high precision timer.
4. A linux-based infrared signal modulation system, comprising:
the starting module is used for starting the linux high-precision timer;
a calculation module for calculating whether the total time expires;
a closing module, configured to repeat the step of calculating whether the total time expires when the total time does not expire, and close the high-precision timer when the total time expires;
high-precision timer callback module for
When the number of the current transmitted signals is smaller than the total number of signals, the infrared lamp is turned on or off;
when the number of the currently transmitted signals is not less than the total number of signals, closing the high-precision timer and resetting the number of the currently transmitted signals;
the next timer expiration time is set and the number of transmitted signals is increased by 1.
5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable by the processor, wherein the processor implements the method of any of claims 1-3 when executing the computer program.
6. A computer readable storage medium, in which a computer program is stored which, when executed by a processor, implements the method according to any of claims 1-3.
CN202010003958.1A 2020-01-03 2020-01-03 Infrared signal modulation method and system based on linux Active CN111240815B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010003958.1A CN111240815B (en) 2020-01-03 2020-01-03 Infrared signal modulation method and system based on linux

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010003958.1A CN111240815B (en) 2020-01-03 2020-01-03 Infrared signal modulation method and system based on linux

Publications (2)

Publication Number Publication Date
CN111240815A CN111240815A (en) 2020-06-05
CN111240815B true CN111240815B (en) 2023-09-26

Family

ID=70874270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010003958.1A Active CN111240815B (en) 2020-01-03 2020-01-03 Infrared signal modulation method and system based on linux

Country Status (1)

Country Link
CN (1) CN111240815B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101609604A (en) * 2008-06-17 2009-12-23 上海创见电子有限公司 The control method of infrared learning
CN102637126A (en) * 2011-02-15 2012-08-15 无锡物联网产业研究院 Method, device and system for timing embedded system
CN103400494A (en) * 2013-07-23 2013-11-20 恬家(上海)信息科技有限公司 Learning method for infrared signals
CN105118283A (en) * 2015-09-21 2015-12-02 万科思自控信息(中国)有限公司 Infrared signal collection and conversion control method and device
CN204926492U (en) * 2015-09-21 2015-12-30 万科思自控信息(中国)有限公司 Infrared signal acquisition conversion controlling means
CN108399730A (en) * 2018-02-28 2018-08-14 珠海格力智能装备有限公司 Infrared signal receiver detection method and device
CN108765918A (en) * 2018-08-29 2018-11-06 山东比特智能科技股份有限公司 A kind of infrared facility and its operation method
CN108845872A (en) * 2018-06-21 2018-11-20 武汉虹信通信技术有限责任公司 A kind of software timer implementation method for embedded system
CN110351223A (en) * 2018-04-02 2019-10-18 腾讯科技(深圳)有限公司 Scheduling prompt method, device and computer program medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8150265B2 (en) * 2009-03-18 2012-04-03 2Wire, Inc. Carrier current communication system with infrared receiver

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101609604A (en) * 2008-06-17 2009-12-23 上海创见电子有限公司 The control method of infrared learning
CN102637126A (en) * 2011-02-15 2012-08-15 无锡物联网产业研究院 Method, device and system for timing embedded system
CN103400494A (en) * 2013-07-23 2013-11-20 恬家(上海)信息科技有限公司 Learning method for infrared signals
CN105118283A (en) * 2015-09-21 2015-12-02 万科思自控信息(中国)有限公司 Infrared signal collection and conversion control method and device
CN204926492U (en) * 2015-09-21 2015-12-30 万科思自控信息(中国)有限公司 Infrared signal acquisition conversion controlling means
CN108399730A (en) * 2018-02-28 2018-08-14 珠海格力智能装备有限公司 Infrared signal receiver detection method and device
CN110351223A (en) * 2018-04-02 2019-10-18 腾讯科技(深圳)有限公司 Scheduling prompt method, device and computer program medium
CN108845872A (en) * 2018-06-21 2018-11-20 武汉虹信通信技术有限责任公司 A kind of software timer implementation method for embedded system
CN108765918A (en) * 2018-08-29 2018-11-06 山东比特智能科技股份有限公司 A kind of infrared facility and its operation method

Also Published As

Publication number Publication date
CN111240815A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US10057856B2 (en) Wake-up control method and apparatus, and terminal device
US6182165B1 (en) Staggered polling of buffer descriptors in a buffer descriptor ring direct memory access system
US6212593B1 (en) Method and apparatus for generating interrupts on a buffer by buffer basis in buffer descriptor ring direct memory access system
US20170329632A1 (en) Device scheduling method, task manager and storage medium
CN107748509B (en) ASI communication slave machine implementation method based on single chip microcomputer transceiving control
CN109753368B (en) Real-time data sending method and system
CN111240815B (en) Infrared signal modulation method and system based on linux
CN114625108A (en) Simulation test method and device
CN111475312A (en) Message driving method and device based on real-time operating system
CN115617475A (en) Method and device for setting circulating alarm clock, electronic equipment and storage medium
CN109799872A (en) Improve the method, apparatus and electronic equipment of low-res real-time clock waking-up precision
CN111431631B (en) Bidirectional communication method, receiving equipment, sending equipment and communication system
CN111355491B (en) Single-channel analog signal sampling method and device
Katayama Waiting time analysis for a queueing system with time‐limited service and exponential timer
CN115599722B (en) Method and device for realizing accurate transmission of serial port data based on kernel of operating system
CN107273191B (en) Method and device for scheduling timed tasks by using logical clone expression
CN115826731B (en) Sleep control method and device, storage medium and computing equipment
JPS5741702A (en) Storage device and counter using said device
JPS5588148A (en) Test system of input-output control system
CN118199782B (en) Ethernet message time-sharing scheduling method, system, storage medium and intelligent device
CN205193509U (en) Singlechip extended functionality trigger device that encodes
SU1113803A1 (en) Priority interruption device for microcomputers
CN112463328A (en) Real-time simulation timing method, system and medium based on multi-core processor platform
SU1200270A1 (en) Device for controlling step-by-step operation of microprocessor
JPS5557967A (en) Timer coincidence method for multiple-computer 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