[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2019136658A1 - Infrared data learning method, device, and electronic apparatus - Google Patents

Infrared data learning method, device, and electronic apparatus Download PDF

Info

Publication number
WO2019136658A1
WO2019136658A1 PCT/CN2018/072219 CN2018072219W WO2019136658A1 WO 2019136658 A1 WO2019136658 A1 WO 2019136658A1 CN 2018072219 W CN2018072219 W CN 2018072219W WO 2019136658 A1 WO2019136658 A1 WO 2019136658A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
composite
processed
target
pattern
Prior art date
Application number
PCT/CN2018/072219
Other languages
French (fr)
Chinese (zh)
Inventor
孙永昌
沈伟
Original Assignee
鹤壁天海电子信息系统有限公司
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 鹤壁天海电子信息系统有限公司 filed Critical 鹤壁天海电子信息系统有限公司
Priority to PCT/CN2018/072219 priority Critical patent/WO2019136658A1/en
Publication of WO2019136658A1 publication Critical patent/WO2019136658A1/en

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

Definitions

  • the present invention relates to the field of infrared remote control technology, and more particularly to an infrared data learning method, device and electronic device.
  • Infrared remote control technology is a widely used and mature technology, mainly used in electronic products, such as air conditioners, televisions and other electronic products.
  • infrared signal learning method is now used to learn multiple Infrared signal from the remote control.
  • the infrared signal learning method includes: collecting the waveform of the infrared signal by means of the interrupt of the single chip, and recording the length of the high and low levels through the timer to realize the learning of the infrared signal.
  • a learning method using direct waveform recording will obtain a large amount of learning data.
  • the carrier frequency of the infrared signal to be learned is high, the accuracy of learning is required to be high to achieve a lower learning error, and the learned data will be larger, resulting in failure of conventional devices (such as a single chip microcomputer).
  • the number of infrared buttons to be learned is large, external large-capacity memory is required, which increases the cost, and increases the number of devices and reduces the reliability of the device.
  • the present invention provides an infrared data learning method, apparatus, and electronic device, so as to solve a learning method using direct waveform recording, a large amount of learning data is obtained, and sufficient storage space cannot be provided, and a large-capacity memory is required to be externally improved. Cost, and increasing the number of devices also reduces the reliability of the device.
  • the present invention adopts the following technical solutions:
  • An infrared data learning method comprising:
  • compressing and correcting the composite data to obtain processed data includes:
  • performing error correction and byte compression processing on the first composite data to obtain the processed data including:
  • the value of the second target data is greater than the third number of times of the data of the first preset value; wherein, when the first number of times is greater than the second number of times and the third number of times, the second target data The value does not change;
  • performing byte compression processing on the second composite data to obtain the processed data includes:
  • the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data are arranged and combined according to a positional relationship of the corresponding original data in the second composite data, to obtain the Processed data.
  • calculating carrier period data and pattern data of the infrared signal includes:
  • the pulse width of the baseband signal waveform is measured to obtain pattern data.
  • a data learning device comprising:
  • a signal acquisition module configured to acquire an infrared signal to be learned
  • a calculation module configured to calculate carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to carrier processing;
  • a data combining module configured to obtain composite data according to the carrier cycle data and the pattern data
  • a processing module configured to compress and correct the composite data to obtain processed data.
  • the processing module comprises:
  • Selecting a sub-module configured to select one sub-data from the pattern data in the composite data as the first target data
  • a byte setting submodule configured to convert the first target data into a preset size of to-be-processed data
  • a segmentation sub-module configured to perform data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
  • a compression submodule configured to perform bit compression on the to-be-processed data according to a value of the first data and a sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is When zero, the first data is discarded;
  • a replacement submodule configured to replace the short code type data with the selected sub data
  • a determining sub-module configured to determine whether each sub-data in the pattern data is replaced with corresponding short-type data, thereby obtaining first composite data
  • the selecting sub-module is further configured to: when the determining sub-module determines that each sub-data in the pattern data is not replaced with corresponding short-type data, and does not obtain the first composite data, from the composite One sub-data is selected as the first target data in the pattern data in the data;
  • the processing submodule is configured to perform error correction and byte compression processing on the first composite data to obtain the processed data.
  • the processing submodule comprises:
  • a selecting unit configured to select one data from the first composite data as the second target data
  • a statistical unit configured to count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and a third number of times that the data of the first predetermined value is greater than the value of the second target data; wherein, when the first number of times is greater than the second number of times and the third number of times, The value of the second target data is not changed;
  • a first changing unit configured to change the second target data to be smaller than a value of the second target data when the second number of times is greater than the first number of times and the third number of times Set numerical data
  • a second changing unit configured to change the second target data to be greater than a value of the second target data when the third number is greater than the first number of times and the second number of times Set numerical data
  • a determining unit configured to determine whether to determine corresponding processed data of each data in the first composite data
  • the selecting unit is further configured to: when the determining unit determines that the corresponding processed data of each data in the first composite data is not determined, and select one data from the first composite data as the second target data;
  • a data processing unit configured to obtain second composite data according to the processed data corresponding to each data in the first composite data
  • a compression unit configured to perform byte compression processing on the second composite data to obtain the processed data.
  • the compression unit comprises:
  • Extracting a subunit configured to extract at least one set of repeated data that is continuously repeated in the second composite data
  • a data processing sub-unit configured to process each set of duplicate data according to a preset format, to obtain processed duplicate data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, and the second The preset value and the number of occurrences of the repeated data are sequentially arranged;
  • a combination subunit configured to perform, according to the positional relationship of the corresponding original data in the second composite data, the unrepeated data in the second composite data and the processed repeated data corresponding to each set of the repeated data.
  • the combination is arranged to obtain the processed data.
  • the calculation module comprises:
  • a data acquisition submodule configured to acquire initial carrier period data of the plurality of the infrared signals
  • a calculation submodule configured to use an average value of initial carrier period data of the plurality of the infrared signals as the carrier period data
  • a carrier submodule configured to perform carrier processing on the infrared signal to obtain a baseband signal
  • the measurement sub-module is used to measure the pulse width of the baseband signal waveform to obtain the pattern data.
  • An electronic device comprising: a memory and a processor
  • the memory is used to store a program
  • the processor is for calling a program, wherein the program is used to:
  • the present invention has the following beneficial effects:
  • the invention provides an infrared data learning method, device and electronic device. After the composite data is obtained in the invention, the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost and the number of devices. Improve equipment reliability.
  • FIG. 1 is a flowchart of a method for learning an infrared data according to an embodiment of the present invention
  • FIG. 2 is a flowchart of another method for learning infrared data according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of hardware for calculating a carrier period according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of hardware for calculating code type data according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of still another method for learning infrared data according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a data compression scenario according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of hardware for calculating code type data according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of a data error correction scenario according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a hardware structure of a fifth type of calculation code data according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of another scenario of data compression according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a data learning apparatus according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic structural diagram of another data learning apparatus according to an embodiment of the present invention.
  • the embodiment of the present invention provides an infrared data learning method.
  • the infrared data learning method may include:
  • the infrared signal is sent by a remote controller or other infrared control device to be learned, and the infrared signal is transmitted in the form of a carrier wave.
  • the pattern data is baseband data obtained by the de-carrier processing of the infrared signal, and the pattern data is data representing length.
  • step S12 may include:
  • the average value of initial carrier period data of the plurality of the infrared signals is used as the carrier period data.
  • step S21 and step S22 are processes for calculating carrier period data of the infrared signal, which are specifically explained according to FIG. 3.
  • the infrared signal enters the edge detector 101, and the edge detector 101 outputs a rising edge pulse of the infrared signal.
  • the control state machine 102 detects the edge, it delays 3 cycles (the first three cycles are inaccurate), and after removing the first three initial carrier cycle data, the control counter 103 counts the interval of the rising edge pulse.
  • Eight initial carrier period data are successively derived, and eight initial carrier period data are pushed into the shift registers 1041-1048.
  • the data after entering the shift registers 1041-1048 enters the adder 105 for the summation operation, and then divides by 8 using the divider 106 to obtain an average value of the eight initial carrier cycle data to obtain carrier cycle data.
  • step S23 and step S24 are processes for calculating the pattern data of the infrared signal.
  • the edge detector 201 After the infrared signal passes through the edge detector 201, only the rising edge pulse is output.
  • the counter 203 is used to perform timeout control, and the timeout period is 1.5 times of the calculated carrier cycle data.
  • control state machine 204 clears counter 203 and sets the output signal. At this time, the input is considered valid; if the rising edge still does not come after 1.5 carrier period data, it is considered that the current counter 203 is timed out, and the control state machine 204 sets the output signal to 0, and the input is considered invalid.
  • the de-carrier processing of the infrared signal is realized, and the modulation and recovery of the baseband signal is released.
  • the obtained data is the initial pattern data of the system main clock as the basic unit. If the system main clock frequency is higher, the resulting data bit width is larger.
  • the initial carrier period data is divided by the divider 202 and rounded off to obtain pattern data.
  • the pattern data with the carrier period as the basic unit obtained by the division operation can initially reduce the pattern data amount and remove the influence of the system main clock frequency on the pattern data amount.
  • the method for obtaining the pattern data by the above method is because the infrared data is usually a binary on-off key control OOK modulation. When it is high, the carrier is transmitted; when it is low, it is not sent. Use this to judge whether the current data is 0 or 1. Conversely, when going to the carrier, first of all, we must judge whether the rising edge comes. After the rising edge comes, the data is 1. However, how long this 1 lasts is to use the timer to measure. The principle of the measurement is to set the timer time. 1.5 times the carrier cycle data length. When a rising edge occurs in the timing cycle, the clear timer is re-timed. If the timer expires, the carrier is gone, that is, the previous 1 is over. Through this process, we know The length of the infrared data 1, the same reason can know the length of 0. Then, by measuring the length of 1 and the length of 0, the pattern data is obtained by the following divider, rounding, and the like.
  • control state machine 204 can also control the superposition writing of the carrier cycle data and the code length data, and store the FIFO 205 in the FIFO type.
  • the FIFO contains composite data, and the first two.
  • the byte is the carrier cycle data
  • the carrier cycle data is the code length data.
  • the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.
  • step S14 may include:
  • each sub-data in the pattern data may be sorted in order, and at this time, one sub-data with the smallest sequence number may be selected as the first target data.
  • the first target data may be converted into data to be processed whose occupied bit size is a preset size
  • the preset size may be 14 bits (bits).
  • the data format of the first target data is unified.
  • the first data is high order data
  • the second data is low order data
  • the data when the data is divided, the data can be divided into two parts, a high 7 bits and a low 7 bits, that is, the first data and the second data, the first data is the upper 7 bits, and the second data is the lower 7 bits.
  • the first data when the data of the first data is zero, the first data is discarded.
  • the sign bit can be 0 or 1, indicating that the current baseband waveform is 0 or 1; and the next 14 bits of pending data represent the width of the current baseband waveform (0 or 1).
  • the first data is first read and it is determined whether the first data is all zeros. If the high 7 bits are all zeros, the high 7 bits are discarded, and the sign bit and the lower 7 bits are combined into one byte of data for storage. Among them, the data structure can be as shown in Table 1.
  • the high 7bit is saved, and the sign bit is combined to form 1 byte of data for storage. Where the sign bit is 0 or 1. At this time, the sign bit and the lower 7 bits are also combined into another 1-byte data and stored.
  • the storage space can be minimized under the premise of ensuring the dynamic range of the pattern data.
  • the sign bit is used as the high and low level represented by the current pattern.
  • the short code type data can represent the length data and the polarity data of the infrared long code type data by one byte. Reduce storage space.
  • the first target data is updated to short code type data.
  • the data to be processed is divided into four groups, for example, the first group is 0 0000000 1100001, and the second group data is 1 0001110 0101110, and the other two sets of data are referred to FIG. 6.
  • the upper 7 bits of the first set of data are all 0, then the high 7 bits are directly deleted at this time, and finally the short code type is 01100001, that is, the combination of the sign bit and the 7th bit. This is the first line of data on the right.
  • the upper 7 bits are not 0.
  • the sign bit is combined with the upper 7 bits and the lower 7 bits respectively to obtain 10001110 and 10101110, that is, the second row and the third row of the right data in FIG.
  • the high 7 is all zero, and the processing of the first set of data can be referred to.
  • the data to be processed occupies 8 bytes in total, and the short code data corresponding to the obtained data to be processed only occupies 5 bytes. Reduced the amount of data.
  • step S36 Determine whether each sub-data in the pattern data is replaced with corresponding short pattern data, thereby obtaining first composite data; if each sub-data in the pattern data is replaced with a corresponding short pattern Data, and the first composite data is obtained, step S37 is performed; if each of the sub-data in the pattern data is not replaced with the corresponding short pattern data, and the first composite data is not obtained, the process returns to step S31.
  • the amount of data is reduced by the method of byte compression, which in turn can occupy less storage resources.
  • step S37 may include:
  • the data may be randomly selected or sequentially selected in order.
  • the first preset value is 1.
  • the second target data is subtracted, and the second target data and the second target data are added to the first composite data. The number of occurrences in .
  • the current data has no error and is directly stored.
  • the second target data is decremented by the second time, the second target data is the wrong data, the correct data should be the second target data value minus one, and the second target data is changed to the second target data. Subtract the data and store it.
  • the second target data is erroneous data
  • the correct data should be the second target data value plus one
  • the second target data is changed to the second target data. Add one after the data and store it.
  • the first time that the second target data appears in the first composite data is counted, and the data that is smaller than the second target data is smaller than the first preset value. a second number of times, and a third occurrence of the data of the first predetermined value greater than the value of the second target data to determine whether a data error occurs, because the test finds that during the infrared learning process, due to interference or Learning errors caused by factors such as jitter are not very large, and are mostly in the range of plus or minus one.
  • the value of the specific phase difference can be determined by testing to modify the algorithm for error correction compensation.
  • step S46 Determine whether the corresponding processed data of each data in the first composite data is determined. If it is determined that the corresponding processed data of each data in the first composite data is determined, step S47 is performed. If it is determined that the corresponding processed data of each of the first composite data is not determined, the process returns to step S41.
  • the step of determining whether to determine the corresponding processed data of each data in the first composite data in this step is added.
  • the second composite data is obtained.
  • step S42 and step S47 in this embodiment are for implementing error correction on the first composite data. Avoid the learning error caused by infrared carrier signal jitter during infrared learning, correct the error, and greatly improve the compression performance of subsequent byte compression.
  • the original infrared data is received as the first composite data
  • the error-corrected infrared data is the second composite data
  • an error correction step is added, and in addition, it is possible to avoid a data error caused by interference or the like.
  • step S48 may include:
  • the following is an example of what is a continuous repetition.
  • the data 625362536253 it can be seen that the data 6253 is continuously repeated data, and for the data 625306253, 62563 is not continuously repeated data because there is an additional 0 between the two 6253.
  • the infrared data after error correction is the second composite data
  • the compressed infrared data is the processed data.
  • the 150 62 and 150 20 are duplicate data.
  • S52 Process each set of duplicate data according to a preset format, and obtain processed duplicate data corresponding to each set of the repeated data.
  • the preset format is sequentially arranged according to the repeated data, the second preset value, and the number of occurrences of the repeated data.
  • the second preset value can be 128.
  • the group of duplicate data of 150 62 appears 11 times in total, and the processed duplicate data corresponding to 150 62 is 150 62 128 11 .
  • the remaining duplicate data are sequentially processed in this way to obtain the processed duplicate data corresponding to each set of the repeated data.
  • the translation means that the symbol is 1, but the waveform is 0 in length. This waveform of length 0 does not exist. So once 128 appears, it means it is a keyword, not a pattern data. Use 128 to distinguish between the two, so as not to cause data confusion when restoring data.
  • the length of the second composite data is 71 bytes, and the length after compression is 15 bytes, further reducing the amount of data.
  • decompression and compression are inverse operations, and whether there is 128 in the processed data, if yes, the original data is obtained according to the preset format, and then the decompressed data can be obtained.
  • bit decompression is performed by separating the symbol data from the pattern data, that is, converting 8 bits into the format of the previous 14 bit+ sign bit before modulation.
  • the device FIFO first reads the decompressed data, including carrier frequency data and waveform data.
  • the carrier frequency data is sent to the carrier generator to generate the carrier of the corresponding frequency, and then the waveform data is read, and the carrier edge is synchronized to ensure that the modulated output waveform is edge-aligned, which is beneficial to reduce the modulation error.
  • the synchronized infrared waveform data is multiplied by a multiplier to implement binary keying modulation, and the modulated infrared data is output to the infrared emitter. At this point, the infrared modulation is completed.
  • byte compression is added, and the amount of data can be further reduced.
  • the data learning device may include:
  • a signal acquisition module 301 configured to acquire an infrared signal to be learned
  • the calculation module 302 is configured to calculate carrier period data and pattern data of the infrared signal, where the pattern data is baseband data obtained after the infrared signal is subjected to carrier processing;
  • the data combination module 303 is configured to obtain composite data according to the carrier cycle data and the pattern data.
  • the processing module 304 is configured to compress and correct the composite data to obtain processed data.
  • the calculating module 302 can include:
  • a data acquisition submodule configured to acquire initial carrier period data of the plurality of the infrared signals
  • a calculation submodule configured to use an average value of initial carrier period data of the plurality of the infrared signals as the carrier period data
  • a carrier submodule configured to perform carrier processing on the infrared signal to obtain a baseband signal
  • the measurement sub-module is used to measure the pulse width of the baseband signal waveform to obtain the pattern data.
  • the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.
  • the processing module 304 may include:
  • a sub-module 3041 configured to select one sub-data from the pattern data in the composite data as the first target data
  • a byte setting sub-module 3042 configured to convert the first target data into a preset size of data to be processed
  • a segmentation sub-module 3043 configured to perform data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
  • the compression sub-module 3044 is configured to perform bit compression on the to-be-processed data according to the value of the first data and the sign bit of the to-be-processed data to obtain short-type data; wherein, when the first data is When the data is zero, the first data is discarded;
  • a replacement submodule 3045 configured to replace the short code type data with the selected sub data
  • the determining sub-module 3046 is configured to determine whether each sub-data in the pattern data is replaced with corresponding short-type data, thereby obtaining first composite data;
  • the selection sub-module 3041 is further configured to: when the determining sub-module 3046 determines that each sub-data in the pattern data is not replaced with corresponding short-type data, and does not obtain the first composite data, Selecting one sub-data from the pattern data in the composite data as the first target data;
  • the processing sub-module 3047 is configured to perform error correction and byte compression processing on the first composite data to obtain the processed data.
  • the amount of data is reduced by the method of byte compression, which in turn can occupy less storage resources.
  • the processing submodule 3047 includes:
  • a selecting unit configured to select one data from the first composite data as the second target data
  • a statistical unit configured to count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and a third number of times that the data of the first predetermined value is greater than the value of the second target data; wherein, when the first number of times is greater than the second number of times and the third number of times, The value of the second target data is not changed;
  • a first changing unit configured to change the second target data to be smaller than a value of the second target data when the second number of times is greater than the first number of times and the third number of times Set numerical data
  • a second changing unit configured to change the second target data to be greater than a value of the second target data when the third number is greater than the first number of times and the second number of times Set numerical data
  • a determining unit configured to determine whether to determine corresponding processed data of each data in the first composite data
  • the selecting unit is further configured to: when the determining unit determines that the corresponding processed data of each data in the first composite data is not determined, and select one data from the first composite data as the second target data;
  • a data processing unit configured to obtain second composite data according to the processed data corresponding to each data in the first composite data
  • a compression unit configured to perform byte compression processing on the second composite data to obtain the processed data.
  • an error correction step is added, and in addition, it is possible to avoid a data error caused by interference or the like.
  • the compression unit includes:
  • Extracting a subunit configured to extract at least one set of repeated data that is continuously repeated in the second composite data
  • a data processing sub-unit configured to process each set of duplicate data according to a preset format, to obtain processed duplicate data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, and the second The preset value and the number of occurrences of the repeated data are sequentially arranged;
  • a combination subunit configured to perform, according to the positional relationship of the corresponding original data in the second composite data, the unrepeated data in the second composite data and the processed repeated data corresponding to each set of the repeated data.
  • the combination is arranged to obtain the processed data.
  • byte compression is added, and the amount of data can be further reduced.
  • another embodiment of the present invention provides an electronic device, including: a memory and a processor;
  • the memory is used to store a program
  • the processor is for calling a program, wherein the program is used to:
  • the processor is configured to perform compression and error correction on the composite data, and when the processed data is obtained, specifically used to:
  • the processor is configured to perform error correction and byte compression processing on the first composite data, and when the processed data is obtained, specifically used to:
  • the value of the second target data is greater than the third number of times of the data of the first preset value; wherein, when the first number of times is greater than the second number of times and the third number of times, the second target data The value does not change;
  • the processor is configured to perform byte compression processing on the second composite data, and when the processed data is obtained, specifically used to:
  • the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data are arranged and combined according to a positional relationship of the corresponding original data in the second composite data, to obtain the Processed data.
  • the processor when used to calculate carrier period data and pattern data of the infrared signal, specifically, the processor is specifically configured to:
  • the pulse width of the baseband signal waveform is measured to obtain pattern data.
  • the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Selective Calling Equipment (AREA)

Abstract

An infrared data learning method, a device, and an electronic apparatus. The method comprises: acquiring an infrared signal to be learned (S11); calculating carrier cycle data and coding pattern data of the infrared signal (S12); acquiring composite data according to the carrier cycle data and the coding pattern data (S13); and performing compression and error correction on the composite data, and obtaining processed data (S14). The method performs compression on the data after the composite data is acquired, thereby reducing the data size, occupying fewer resources of a single-chip machine, lowering costs and the number of components, and improving the reliability of an apparatus.

Description

一种红外数据学习方法、装置及电子设备Infrared data learning method, device and electronic device 技术领域Technical field
本发明涉及红外遥控技术领域,更具体的说,涉及一种红外数据学习方法、装置及电子设备。The present invention relates to the field of infrared remote control technology, and more particularly to an infrared data learning method, device and electronic device.
背景技术Background technique
红外遥控技术是一项应用广泛且成熟的技术,主要应用于电子产品,例如空调、电视等电子产品,为了实现用一个遥控器控制多个电子产品的目的,现采用红外信号学习方法学习多个遥控器发出的红外信号。Infrared remote control technology is a widely used and mature technology, mainly used in electronic products, such as air conditioners, televisions and other electronic products. In order to achieve the purpose of controlling multiple electronic products with one remote control, infrared signal learning method is now used to learn multiple Infrared signal from the remote control.
具体的,红外信号学习方法包括:通过单片机中断的方式,采集红外信号的波形,并通过定时器记录高低电平的长度,实现红外信号的学习。Specifically, the infrared signal learning method includes: collecting the waveform of the infrared signal by means of the interrupt of the single chip, and recording the length of the high and low levels through the timer to realize the learning of the infrared signal.
由于红外信号的特点,采用直接波形记录的学习方法会得到大量的学习数据。特别的,当待学习的红外信号载波频率较高时,要求学习的精度较高才能达到较低的学习误差的时候,所学习得到的数据将会更大,导致常规器件(例如单片机等)无法提供足够的存储空间。当待学习的红外按键数量较多时,需要外挂大容量存储器,提高了成本,且增加器件数量还降低了设备可靠性。Due to the characteristics of the infrared signal, a learning method using direct waveform recording will obtain a large amount of learning data. In particular, when the carrier frequency of the infrared signal to be learned is high, the accuracy of learning is required to be high to achieve a lower learning error, and the learned data will be larger, resulting in failure of conventional devices (such as a single chip microcomputer). Provide enough storage space. When the number of infrared buttons to be learned is large, external large-capacity memory is required, which increases the cost, and increases the number of devices and reduces the reliability of the device.
发明内容Summary of the invention
有鉴于此,本发明提供一种红外数据学习方法、装置及电子设备,以解决采用直接波形记录的学习方法会得到大量的学习数据,无法提供足够的存储空间,需要外挂大容量存储器,提高了成本,且增加器件数量还降低了设备可靠性的问题。In view of this, the present invention provides an infrared data learning method, apparatus, and electronic device, so as to solve a learning method using direct waveform recording, a large amount of learning data is obtained, and sufficient storage space cannot be provided, and a large-capacity memory is required to be externally improved. Cost, and increasing the number of devices also reduces the reliability of the device.
为解决上述技术问题,本发明采用了如下技术方案:In order to solve the above technical problems, the present invention adopts the following technical solutions:
一种红外数据学习方法,包括:An infrared data learning method comprising:
获取待学习的红外信号;Obtain an infrared signal to be learned;
计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数 据为所述红外信号经过去载波处理后得到的基带数据;Calculating carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to decarrier processing;
根据所述载波周期数据以及所述码型数据,得到复合数据;Obtaining composite data according to the carrier cycle data and the pattern data;
对所述复合数据进行压缩和纠错,得到处理后的数据。Compressing and correcting the composite data to obtain processed data.
优选地,对所述复合数据进行压缩和纠错,得到处理后的数据,包括:Preferably, compressing and correcting the composite data to obtain processed data includes:
从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;Selecting one sub-data from the pattern data in the composite data as the first target data;
将所述第一目标数据转换为预设大小的待处理数据;Converting the first target data into a preset size of data to be processed;
将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;Performing data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;And performing bit compression on the to-be-processed data according to the value of the first data and the sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is zero, discarding First data;
将所述短码型数据替换所选取出的子数据;Substituting the short pattern data for the selected sub data;
返回从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据的步骤,直到所述码型数据中各个子数据都被替换为相应的短码型数据,从而得到第一复合数据;Returning a step of selecting one sub-data from the pattern data in the composite data as the first target data until each sub-data in the pattern data is replaced with corresponding short pattern data, thereby obtaining First composite data;
对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。Perform error correction and byte compression processing on the first composite data to obtain the processed data.
优选地,对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据,包括:Preferably, performing error correction and byte compression processing on the first composite data to obtain the processed data, including:
从所述第一复合数据中选取一个数据作为第二目标数据;Selecting one data from the first composite data as the second target data;
统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;Counting a first number of occurrences of the second target data in the first composite data, a second occurrence of data that is smaller than a value of the second target data by a first predetermined value, and an occurrence ratio The value of the second target data is greater than the third number of times of the data of the first preset value; wherein, when the first number of times is greater than the second number of times and the third number of times, the second target data The value does not change;
当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;When the second number of times is greater than the first number of times and the third number of times, changing the second target data to data that is smaller than a value of the second target data by a first preset value;
当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目 标数据更改为比所述第二目标数据的数值大第二预设数值的数据;When the third number is greater than the first number of times and the second number of times, changing the second target data to data that is greater than a value of the second target data by a second predetermined value;
返回从所述第一复合数据中选取一个数据作为第二目标数据这一步骤,直到确定所述第一复合数据中每个数据的对应的处理后的数据时为止;Returning a step of selecting one data from the first composite data as the second target data until determining the corresponding processed data of each of the first composite data;
根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;Obtaining second composite data according to the processed data corresponding to each data in the first composite data;
对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。Performing byte compression processing on the second composite data to obtain the processed data.
优选地,对所述第二复合数据进行字节压缩处理,得到所述处理后的数据,包括:Preferably, performing byte compression processing on the second composite data to obtain the processed data includes:
提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting at least one set of repeated data that is continuously repeated in the second composite data;
将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;Processing each set of duplicate data according to a preset format to obtain processed repeated data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, the second preset value, and the repetition The number of occurrences of data is sequentially arranged;
将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。And the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data are arranged and combined according to a positional relationship of the corresponding original data in the second composite data, to obtain the Processed data.
优选地,计算所述红外信号的载波周期数据以及码型数据,包括:Preferably, calculating carrier period data and pattern data of the infrared signal includes:
获取多个所述红外信号的初始载波周期数据;Obtaining initial carrier period data of the plurality of infrared signals;
将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;Taking an average value of initial carrier period data of the plurality of infrared signals as the carrier period data;
对所述红外信号进行去载波处理,得到基带信号;De-carrier processing the infrared signal to obtain a baseband signal;
测量基带信号波形脉宽,得到码型数据。The pulse width of the baseband signal waveform is measured to obtain pattern data.
一种数据学习装置,包括:A data learning device comprising:
信号获取模块,用于获取待学习的红外信号;a signal acquisition module, configured to acquire an infrared signal to be learned;
计算模块,用于计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;a calculation module, configured to calculate carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to carrier processing;
数据组合模块,用于根据所述载波周期数据以及所述码型数据,得到复合数据;a data combining module, configured to obtain composite data according to the carrier cycle data and the pattern data;
处理模块,用于对所述复合数据进行压缩和纠错,得到处理后的数据。And a processing module, configured to compress and correct the composite data to obtain processed data.
优选地,所述处理模块包括:Preferably, the processing module comprises:
选取子模块,用于从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;Selecting a sub-module, configured to select one sub-data from the pattern data in the composite data as the first target data;
字节设置子模块,用于将所述第一目标数据转换为预设大小的待处理数据;a byte setting submodule, configured to convert the first target data into a preset size of to-be-processed data;
分割子模块,用于将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;a segmentation sub-module, configured to perform data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
压缩子模块,用于根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;a compression submodule, configured to perform bit compression on the to-be-processed data according to a value of the first data and a sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is When zero, the first data is discarded;
替换子模块,用于将所述短码型数据替换所选取出的子数据;a replacement submodule, configured to replace the short code type data with the selected sub data;
判断子模块,用于判断所述码型数据中各个子数据是否都被替换为相应的短码型数据,从而得到第一复合数据;a determining sub-module, configured to determine whether each sub-data in the pattern data is replaced with corresponding short-type data, thereby obtaining first composite data;
所述选取子模块,还用于当所述判断子模块判断出所述码型数据中各个子数据未都被替换为相应的短码型数据、且未得到第一复合数据,从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;The selecting sub-module is further configured to: when the determining sub-module determines that each sub-data in the pattern data is not replaced with corresponding short-type data, and does not obtain the first composite data, from the composite One sub-data is selected as the first target data in the pattern data in the data;
处理子模块,用于对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。The processing submodule is configured to perform error correction and byte compression processing on the first composite data to obtain the processed data.
优选地,所述处理子模块包括:Preferably, the processing submodule comprises:
选取单元,用于从所述第一复合数据中选取一个数据作为第二目标数据;a selecting unit, configured to select one data from the first composite data as the second target data;
统计单元,用于统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;a statistical unit, configured to count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and a third number of times that the data of the first predetermined value is greater than the value of the second target data; wherein, when the first number of times is greater than the second number of times and the third number of times, The value of the second target data is not changed;
第一更改单元,用于当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;a first changing unit, configured to change the second target data to be smaller than a value of the second target data when the second number of times is greater than the first number of times and the third number of times Set numerical data;
第二更改单元,用于当所述第三次数大于所述第一次数和所述第二次 数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;a second changing unit, configured to change the second target data to be greater than a value of the second target data when the third number is greater than the first number of times and the second number of times Set numerical data;
判断单元,用于判断是否确定所述第一复合数据中每个数据的对应的处理后的数据;a determining unit, configured to determine whether to determine corresponding processed data of each data in the first composite data;
所述选取单元,还用于当所述判断单元判断出未确定所述第一复合数据中每个数据的对应的处理后的数据,从所述第一复合数据中选取一个数据作为第二目标数据;The selecting unit is further configured to: when the determining unit determines that the corresponding processed data of each data in the first composite data is not determined, and select one data from the first composite data as the second target data;
数据处理单元,用于根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;a data processing unit, configured to obtain second composite data according to the processed data corresponding to each data in the first composite data;
压缩单元,用于对对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。And a compression unit, configured to perform byte compression processing on the second composite data to obtain the processed data.
优选地,所述压缩单元包括:Preferably, the compression unit comprises:
提取子单元,用于提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting a subunit, configured to extract at least one set of repeated data that is continuously repeated in the second composite data;
数据处理子单元,用于将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;a data processing sub-unit, configured to process each set of duplicate data according to a preset format, to obtain processed duplicate data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, and the second The preset value and the number of occurrences of the repeated data are sequentially arranged;
组合子单元,用于将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。a combination subunit, configured to perform, according to the positional relationship of the corresponding original data in the second composite data, the unrepeated data in the second composite data and the processed repeated data corresponding to each set of the repeated data. The combination is arranged to obtain the processed data.
优选地,所述计算模块包括:Preferably, the calculation module comprises:
数据获取子模块,用于获取多个所述红外信号的初始载波周期数据;a data acquisition submodule, configured to acquire initial carrier period data of the plurality of the infrared signals;
计算子模块,用于将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;a calculation submodule, configured to use an average value of initial carrier period data of the plurality of the infrared signals as the carrier period data;
去载波子模块,用于对所述红外信号进行去载波处理,得到基带信号;a carrier submodule, configured to perform carrier processing on the infrared signal to obtain a baseband signal;
测量子模块,用于测量基带信号波形脉宽,得到码型数据。The measurement sub-module is used to measure the pulse width of the baseband signal waveform to obtain the pattern data.
一种电子设备,包括:存储器和处理器;An electronic device comprising: a memory and a processor;
其中,所述存储器用于存储程序;Wherein the memory is used to store a program;
处理器用于调用程序,其中,所述程序用于:The processor is for calling a program, wherein the program is used to:
获取待学习的红外信号;Obtain an infrared signal to be learned;
计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;Calculating carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to de-carrier processing;
根据所述载波周期数据以及所述码型数据,得到复合数据;Obtaining composite data according to the carrier cycle data and the pattern data;
对所述复合数据进行压缩和纠错,得到处理后的数据。Compressing and correcting the composite data to obtain processed data.
相较于现有技术,本发明具有以下有益效果:Compared with the prior art, the present invention has the following beneficial effects:
本发明提供了一种红外数据学习方法、装置及电子设备,本发明中得到复合数据后,会对数据进行压缩处理,进而能够减少数据量,占用单片机资源较少,降低成本、器件数量,可以提高设备可靠性。The invention provides an infrared data learning method, device and electronic device. After the composite data is obtained in the invention, the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost and the number of devices. Improve equipment reliability.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为本发明实施例提供的一种红外数据学习方法的方法流程图;1 is a flowchart of a method for learning an infrared data according to an embodiment of the present invention;
图2为本发明实施例提供的另一种红外数据学习方法的方法流程图;2 is a flowchart of another method for learning infrared data according to an embodiment of the present invention;
图3为本发明实施例提供的一种计算载波周期的硬件结构示意图;FIG. 3 is a schematic structural diagram of hardware for calculating a carrier period according to an embodiment of the present disclosure;
图4为本发明实施例提供的一种计算码型数据的硬件结构示意图;4 is a schematic structural diagram of hardware for calculating code type data according to an embodiment of the present invention;
图5为本发明实施例提供的再一种红外数据学习方法的方法流程图;FIG. 5 is a flowchart of still another method for learning infrared data according to an embodiment of the present invention;
图6为本发明实施例提供的一种数据压缩的场景示意图;FIG. 6 is a schematic diagram of a data compression scenario according to an embodiment of the present invention;
图7为本发明实施例提供的又一种计算码型数据的硬件结构示意图;FIG. 7 is a schematic structural diagram of hardware for calculating code type data according to an embodiment of the present disclosure;
图8为本发明实施例提供的一种数据纠错的场景示意图;FIG. 8 is a schematic diagram of a data error correction scenario according to an embodiment of the present invention;
图9为本发明实施例提供的第五种计算码型数据的硬件结构示意图;FIG. 9 is a schematic diagram of a hardware structure of a fifth type of calculation code data according to an embodiment of the present invention;
图10为本发明实施例提供的又一种数据压缩的场景示意图;FIG. 10 is a schematic diagram of another scenario of data compression according to an embodiment of the present disclosure;
图11为本发明实施例提供的一种数据学习装置的结构示意图;FIG. 11 is a schematic structural diagram of a data learning apparatus according to an embodiment of the present disclosure;
图12为本发明实施例提供的另一种数据学习装置的结构示意图。FIG. 12 is a schematic structural diagram of another data learning apparatus according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例提供了一种红外数据学习方法,参照图1,红外数据学习方法可以包括:The embodiment of the present invention provides an infrared data learning method. Referring to FIG. 1, the infrared data learning method may include:
S11、获取待学习的红外信号;S11. Obtain an infrared signal to be learned.
具体的,红外信号是待学习的遥控器或其他红外控制设备发出的,该红外信号以载波的形式传输。Specifically, the infrared signal is sent by a remote controller or other infrared control device to be learned, and the infrared signal is transmitted in the form of a carrier wave.
S12、计算所述红外信号的载波周期数据以及码型数据;S12. Calculate carrier period data and pattern data of the infrared signal.
其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据,并且码型数据为表征长度的数据。The pattern data is baseband data obtained by the de-carrier processing of the infrared signal, and the pattern data is data representing length.
可选的,在本实施例的基础上,参照图2,步骤S12可以包括:Optionally, on the basis of this embodiment, referring to FIG. 2, step S12 may include:
S21、获取多个所述红外信号的初始载波周期数据;S21. Acquire initial carrier period data of the multiple infrared signals.
S22、将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;S22. The average value of initial carrier period data of the plurality of the infrared signals is used as the carrier period data.
具体的,步骤S21和步骤S22为计算红外信号的载波周期数据的过程,具体根据图3进行解释说明。Specifically, step S21 and step S22 are processes for calculating carrier period data of the infrared signal, which are specifically explained according to FIG. 3.
首先红外信号进入边沿检测器101,边沿检测器101输出红外信号的上升沿脉冲。控制状态机102检测到边沿后,延迟3个周期(前三个周期不准确),去掉前三个初始载波周期数据后控制计数器103对上升沿脉冲的间隔进行计数。连续得出8个初始载波周期数据,并且将8个初始载波周期数据推入移位寄存器1041-1048。进入移位寄存器1041-1048后的数据,进入加法器105进行求和运算,然后再使用除法器106除8,得出8个初始载波周期数据的平均值,得到载波周期数据。First, the infrared signal enters the edge detector 101, and the edge detector 101 outputs a rising edge pulse of the infrared signal. After the control state machine 102 detects the edge, it delays 3 cycles (the first three cycles are inaccurate), and after removing the first three initial carrier cycle data, the control counter 103 counts the interval of the rising edge pulse. Eight initial carrier period data are successively derived, and eight initial carrier period data are pushed into the shift registers 1041-1048. The data after entering the shift registers 1041-1048 enters the adder 105 for the summation operation, and then divides by 8 using the divider 106 to obtain an average value of the eight initial carrier cycle data to obtain carrier cycle data.
需要说明的是,本实施例中使用了八个移位寄存器,此外,使用其他 数量的移位寄存器也是可以的。It should be noted that eight shift registers are used in this embodiment, and it is also possible to use other numbers of shift registers.
S23、对所述红外信号进行去载波处理,得到基带信号;S23. Perform decarrier processing on the infrared signal to obtain a baseband signal.
S24、测量基带信号波形脉宽,得到码型数据。S24. Measure the pulse width of the baseband signal waveform to obtain the pattern data.
具体的,步骤S23和步骤S24为计算红外信号的码型数据的过程。Specifically, step S23 and step S24 are processes for calculating the pattern data of the infrared signal.
参照图4,红外信号经过边沿检测器201后,只输出上升沿脉冲。控制状态机204检测到上升沿脉冲后,使用计数器203进行超时控制,超时时间为计算得到的载波周期数据的1.5倍。当红外信号上升沿到来时,控制状态机204将计数器203清零,并对输出信号置1。此时认为输入有效;若上升沿在1.5个载波周期数据后仍然没有到来,认为当前计数器203超时,控制状态机204将输出信号置0,此时认为输入无效。通过这一过程,实现红外信号的去载波处理,解除调制恢复基带信号。通过测量基带信号波形宽度,得出的数据是以系统主时钟为基本单位的初始码型数据,若系统主时钟频率较高,得出的数据位宽较大。通过除法器202对初始载波周期数据进行除法运算,并进行四舍五入后,得到码型数据。Referring to FIG. 4, after the infrared signal passes through the edge detector 201, only the rising edge pulse is output. After the control state machine 204 detects the rising edge pulse, the counter 203 is used to perform timeout control, and the timeout period is 1.5 times of the calculated carrier cycle data. When the rising edge of the infrared signal arrives, control state machine 204 clears counter 203 and sets the output signal. At this time, the input is considered valid; if the rising edge still does not come after 1.5 carrier period data, it is considered that the current counter 203 is timed out, and the control state machine 204 sets the output signal to 0, and the input is considered invalid. Through this process, the de-carrier processing of the infrared signal is realized, and the modulation and recovery of the baseband signal is released. By measuring the width of the baseband signal waveform, the obtained data is the initial pattern data of the system main clock as the basic unit. If the system main clock frequency is higher, the resulting data bit width is larger. The initial carrier period data is divided by the divider 202 and rounded off to obtain pattern data.
需要说明的是,通过除法运算后得出的以载波周期为基本单位的码型数据,可以初步降低码型数据量,去掉系统主时钟频率的高低对码型数据量的影响。It should be noted that the pattern data with the carrier period as the basic unit obtained by the division operation can initially reduce the pattern data amount and remove the influence of the system main clock frequency on the pattern data amount.
需要说明的是,采用上述方法得到码型数据的依据是因为红外数据通常是二进制开关键控OOK调制。在高电平时,发送载波;低电平时不发送.用这个来判断当前数据是0还是1.。反过来,去载波的时候,首先要判断上升沿是否到来,上升沿到来后说明数据为1,但是这个1持续多长时间,就需要用定时器去测量,测量的原理就是将定时器时间设置为1.5倍的载波周期数据长度.当在定时周期内出现上升沿,则清零定时器重新计时.若定时器超时,说明载波没了,也就是之前的1结束了,通过这个过程我们就知道红外数据1的长度,同理可以知道0的长度.。然后通过测量1的长度和0的长度,通过下面除法器,四舍五入等运算后,就得到了码型数据。It should be noted that the method for obtaining the pattern data by the above method is because the infrared data is usually a binary on-off key control OOK modulation. When it is high, the carrier is transmitted; when it is low, it is not sent. Use this to judge whether the current data is 0 or 1. Conversely, when going to the carrier, first of all, we must judge whether the rising edge comes. After the rising edge comes, the data is 1. However, how long this 1 lasts is to use the timer to measure. The principle of the measurement is to set the timer time. 1.5 times the carrier cycle data length. When a rising edge occurs in the timing cycle, the clear timer is re-timed. If the timer expires, the carrier is gone, that is, the previous 1 is over. Through this process, we know The length of the infrared data 1, the same reason can know the length of 0. Then, by measuring the length of 1 and the length of 0, the pattern data is obtained by the following divider, rounding, and the like.
S13、根据所述载波周期数据以及所述码型数据,得到复合数据;S13. Obtain composite data according to the carrier cycle data and the pattern data.
具体的,将所述载波周期数据以及所述码型数据进行组合,得到复合数据;Specifically, combining the carrier cycle data and the pattern data to obtain composite data;
具体的,参照图4,还可以通过控制状态机204控制载波周期数据和码型长度数据的叠加写入,存入先进先出型存储器FIFO 205,此时FIFO中存有复合数据,前两个字节为载波周期数据,载波周期数据后为码型长度数据。Specifically, referring to FIG. 4, the control state machine 204 can also control the superposition writing of the carrier cycle data and the code length data, and store the FIFO 205 in the FIFO type. In this case, the FIFO contains composite data, and the first two. The byte is the carrier cycle data, and the carrier cycle data is the code length data.
S14、对所述复合数据进行压缩和纠错,得到处理后的数据。S14. Compress and correct the composite data to obtain processed data.
本实施例中,得到复合数据后,会对数据进行压缩处理,进而能够减少数据量,占用单片机资源较少,降低成本、器件数量,可以提高设备可靠性。In this embodiment, after the composite data is obtained, the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.
可选的,在上述红外数据学习方法的实施例的基础上,参照图5,步骤S14可以包括:Optionally, on the basis of the foregoing embodiment of the infrared data learning method, referring to FIG. 5, step S14 may include:
S31、从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;S31. Select one sub-data from the pattern data in the composite data as the first target data.
可以按照所述复合数据中的所述码型数据中各个子数据的排列顺序,选取出一个子数据作为第一目标数据;And selecting, according to an arrangement order of each sub-data in the pattern data in the composite data, a sub-data as the first target data;
具体的,可以将码型数据中各个子数据按照顺序进行排序,此时可以选取出序列号最小的一个子数据作为第一目标数据。Specifically, each sub-data in the pattern data may be sorted in order, and at this time, one sub-data with the smallest sequence number may be selected as the first target data.
S32、将所述第一目标数据转换为预设大小的待处理数据;S32. Convert the first target data into a preset size of data to be processed.
其中,可以将所述第一目标数据转换为占据的位大小为预设大小的待处理数据;The first target data may be converted into data to be processed whose occupied bit size is a preset size;
具体的,预设大小可以为14bit(比特),本步骤是将第一目标数据的数据格式进行统一。Specifically, the preset size may be 14 bits (bits). In this step, the data format of the first target data is unified.
S33、将所述待处理数据进行数据分割,得到第一数据和第二数据;S33. Perform data segmentation on the to-be-processed data to obtain first data and second data.
其中,所述第一数据为高位数据,所述第二数据为低位数据。The first data is high order data, and the second data is low order data.
具体的,数据分割时可以分割为高7位和低7位两个部分,即为第一数据和第二数据,第一数据为高7位,第二数据为低7位。Specifically, when the data is divided, the data can be divided into two parts, a high 7 bits and a low 7 bits, that is, the first data and the second data, the first data is the upper 7 bits, and the second data is the lower 7 bits.
S34、根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;S34. Perform bit compression on the data to be processed according to the value of the first data and the sign bit of the data to be processed to obtain short code data.
其中,当所述第一数据的数据为零时,丢弃所述第一数据。符号位可以是0或1,表示当前基带波形是0或1;而后面的14bit待处理数据代表当前 基带波形的(0或1)的宽度。Wherein, when the data of the first data is zero, the first data is discarded. The sign bit can be 0 or 1, indicating that the current baseband waveform is 0 or 1; and the next 14 bits of pending data represent the width of the current baseband waveform (0 or 1).
具体的,首先读取第一数据并判断第一数据是否全零,若高7bit全零,则舍弃高7bit,将符号位以及低7bit组成1字节数据,进行存储。其中,数据结构可以如表1所示。Specifically, the first data is first read and it is determined whether the first data is all zeros. If the high 7 bits are all zeros, the high 7 bits are discarded, and the sign bit and the lower 7 bits are combined into one byte of data for storage. Among them, the data structure can be as shown in Table 1.
表1 压缩后的数据结构Table 1 compressed data structure
符号位Sign bit 数据7Data 7 数据6 Data 6 数据5Data 5 数据4 Data 4 数据3Data 3 数据2Data 2 数据1 Data 1
若高7bit不为零,则保存高7bit,加上符号位组成1字节数据,进行存储。其中,符号位为0或1。此时,还会将符号位和低7bit组成另一个1字节数据,并进行存储。If the high 7bit is not zero, the high 7bit is saved, and the sign bit is combined to form 1 byte of data for storage. Where the sign bit is 0 or 1. At this time, the sign bit and the lower 7 bits are also combined into another 1-byte data and stored.
通过本方法,可以在保证码型数据动态范围的前提下,尽量减小存储空间。利用符号位作为当前码型代表的高低电平。使得短码型数据一个字节就可以表示红外长码型数据的长度数据和极性数据。减小存储空间。Through this method, the storage space can be minimized under the premise of ensuring the dynamic range of the pattern data. The sign bit is used as the high and low level represented by the current pattern. The short code type data can represent the length data and the polarity data of the infrared long code type data by one byte. Reduce storage space.
S35、将所述短码型数据替换所选取出的子数据;S35. Replace the short code type data with the selected sub data.
具体的,将第一目标数据更新为短码型数据。Specifically, the first target data is updated to short code type data.
具体的,参照图6,图6中,待处理数据一共分为四组,如第一组为0 0000000 1100001,第二组数据为1 0001110 0101110,其余两组数据请参照图6。Specifically, referring to FIG. 6, in FIG. 6, the data to be processed is divided into four groups, for example, the first group is 0 0000000 1100001, and the second group data is 1 0001110 0101110, and the other two sets of data are referred to FIG. 6.
第一组数据中的高7位全为0,则此时直接删除高7位,最终得到短码型为01100001,即符号位和第7位的组合。即右边数据的第一行。The upper 7 bits of the first set of data are all 0, then the high 7 bits are directly deleted at this time, and finally the short code type is 01100001, that is, the combination of the sign bit and the 7th bit. This is the first line of data on the right.
对于第二组数据,高7位不为0,此时将符号位与高7位和低7位分别组合,分别得到10001110和10101110,即图6中右边数据的第二行和第三行。For the second set of data, the upper 7 bits are not 0. At this time, the sign bit is combined with the upper 7 bits and the lower 7 bits respectively to obtain 10001110 and 10101110, that is, the second row and the third row of the right data in FIG.
对于第三组数据和第四组数据,高7为全为零,可以参照第一组数据的处理过程。For the third set of data and the fourth set of data, the high 7 is all zero, and the processing of the first set of data can be referred to.
需要说明的是,待处理数据一共占8字节,而得到的待处理数据对应的短码型数据仅占5个字节。缩少了数据量。It should be noted that the data to be processed occupies 8 bytes in total, and the short code data corresponding to the obtained data to be processed only occupies 5 bytes. Reduced the amount of data.
并且待处理数据对应的短码型数据的排列顺序与对应的待处理数据的排列顺序一致。And the arrangement order of the short code data corresponding to the data to be processed is consistent with the order of the corresponding data to be processed.
S36、判断所述码型数据中各个子数据是否都被替换为相应的短码型数据,从而得到第一复合数据;若所述码型数据中各个子数据都被替换为相 应的短码型数据,且得到第一复合数据,执行步骤S37;若所述码型数据中各个子数据未都被替换为相应的短码型数据,且未得到第一复合数据,返回执行步骤S31。S36. Determine whether each sub-data in the pattern data is replaced with corresponding short pattern data, thereby obtaining first composite data; if each sub-data in the pattern data is replaced with a corresponding short pattern Data, and the first composite data is obtained, step S37 is performed; if each of the sub-data in the pattern data is not replaced with the corresponding short pattern data, and the first composite data is not obtained, the process returns to step S31.
S37、对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。S37. Perform error correction and byte compression processing on the first composite data to obtain the processed data.
本实施例中,通过字节压缩的方法来减少数据量,进而能够占用较少的存储资源。In this embodiment, the amount of data is reduced by the method of byte compression, which in turn can occupy less storage resources.
可选的,在上一个实施例的基础上,参照图7,步骤S37可以包括:Optionally, on the basis of the previous embodiment, referring to FIG. 7, step S37 may include:
S41、从所述第一复合数据中选取一个数据作为第二目标数据;S41. Select one data from the first composite data as the second target data.
其中,本实施例中可以随机选取,也可以按照顺序依次选取。In this embodiment, the data may be randomly selected or sequentially selected in order.
S42、统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;S42. Count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and an appearance ratio Determining that the value of the second target data is greater than the third number of times of the data of the first preset value;
具体的,第一预设数值为1,具体的,本实施例中即统计第二目标数据减一后的数值,第二目标数据、以及第二目标数据加一后的数据在第一复合数据中出现的次数。Specifically, the first preset value is 1. Specifically, in this embodiment, the second target data is subtracted, and the second target data and the second target data are added to the first composite data. The number of occurrences in .
S43、当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;S43. When the first number of times is greater than the second number of times and the third number of times, the value of the second target data does not change;
具体的,如果出现第二目标数据的第一次数最大,说明当前数据没有错误,直接进行存储。Specifically, if the first occurrence of the second target data is the largest, the current data has no error and is directly stored.
S44、当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第一预设数值的数据;S44. When the second number of times is greater than the first number of times and the third number of times, changing the second target data to data that is greater than a value of the second target data by a first preset value;
如果出现第二目标数据减一后的数据的第二次数最多,说明第二目标数据为错误数据,正确的数据应该是第二目标数据值减一,将第二目标数据更改为第二目标数据减一后的数据,并进行存储。If the second target data is decremented by the second time, the second target data is the wrong data, the correct data should be the second target data value minus one, and the second target data is changed to the second target data. Subtract the data and store it.
S45、当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;S45. When the third number of times is greater than the first number of times and the second number of times, changing the second target data to data that is greater than a value of the second target data by a second predetermined value;
如果出现第二目标数据加一后的数据的第三次数最多,说明第二目标数据为错误数据,正确的数据应该是第二目标数据值加一,将第二目标数 据更改为第二目标数据加一后的数据,并进行存储。If the third target data has the third highest number of data, the second target data is erroneous data, the correct data should be the second target data value plus one, and the second target data is changed to the second target data. Add one after the data and store it.
需要说明的是,本实施例中采用统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数来确定是否出现数据错误,是因为通过测试发现在红外学习过程当中,由于干扰或抖动等因素造成的学习误差不会很大,大多在正负1的范围内。具体相差的值可以通过测试确定,来修改算法进行纠错补偿。It should be noted that, in this embodiment, the first time that the second target data appears in the first composite data is counted, and the data that is smaller than the second target data is smaller than the first preset value. a second number of times, and a third occurrence of the data of the first predetermined value greater than the value of the second target data to determine whether a data error occurs, because the test finds that during the infrared learning process, due to interference or Learning errors caused by factors such as jitter are not very large, and are mostly in the range of plus or minus one. The value of the specific phase difference can be determined by testing to modify the algorithm for error correction compensation.
S46、判断是否确定出所述第一复合数据中每个数据的对应的处理后的数据;若判断已确定出所述第一复合数据中每个数据的对应的处理后的数据,执行步骤S47;若判断未确定出所述第一复合数据中每个数据的对应的处理后的数据,返回执行步骤S41。S46. Determine whether the corresponding processed data of each data in the first composite data is determined. If it is determined that the corresponding processed data of each data in the first composite data is determined, step S47 is performed. If it is determined that the corresponding processed data of each of the first composite data is not determined, the process returns to step S41.
具体的,由于需要对第一复合数据中的每个数据进行纠错,所以增加了本步骤中判断是否确定出所述第一复合数据中每个数据的对应的处理后的数据这一步骤。Specifically, since it is necessary to perform error correction on each data in the first composite data, the step of determining whether to determine the corresponding processed data of each data in the first composite data in this step is added.
S47、根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;S47. Obtain a second composite data according to the processed data corresponding to each data in the first composite data.
具体的,对第一复合数据中的每个数据进行纠错后,得到第二复合数据。Specifically, after correcting each data in the first composite data, the second composite data is obtained.
需要说明的是,本实施例中的步骤S42与步骤S47是为了实现对第一复合数据的纠错。避免红外学习过程中,红外载波信号抖动带来的学习误差,对该误差进行纠错,并且可以大幅提高后续字节压缩的压缩性能。It should be noted that step S42 and step S47 in this embodiment are for implementing error correction on the first composite data. Avoid the learning error caused by infrared carrier signal jitter during infrared learning, correct the error, and greatly improve the compression performance of subsequent byte compression.
为了本领域的技术人员能够更加清楚的了解本实施例,现结合图8进行解释说明。This embodiment will be more clearly understood by those skilled in the art and will now be explained in conjunction with FIG.
图8中,收到原始红外数据为第一复合数据,纠错后的红外数据为第二复合数据。In FIG. 8, the original infrared data is received as the first composite data, and the error-corrected infrared data is the second composite data.
假设统计第一复合数据中出现的149、150以及151的次数,可以看出,出现150的次数最多,所以第一复合数据中的149应该为150,因此,将第一复合数据中的149改为150。Assuming that the number of 149, 150, and 151 occurrences in the first composite data is counted, it can be seen that the number of occurrences of 150 is the highest, so 149 in the first composite data should be 150, and therefore, the 149 in the first composite data is changed. For 150.
S48、对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。S48. Perform byte compression processing on the second composite data to obtain the processed data.
本实施例中,增加了纠错步骤,进而能够避免由于受到干扰等原因而造成数据错误的情况。In this embodiment, an error correction step is added, and in addition, it is possible to avoid a data error caused by interference or the like.
可选的,在上一个实施例的基础上,参照图8,步骤S48可以包括:Optionally, on the basis of the previous embodiment, referring to FIG. 8, step S48 may include:
S51、提取出所述第二复合数据中连续重复的至少一组重复数据;S51. Extract at least one set of repeated data that is continuously repeated in the second composite data;
具体的,现举例说明何为连续重复,对于数据625362536253,可以看出数据6253为连续重复的数据,对于数据625306253,62563不是连续重复的数据,因为两个6253之间多了一个0。Specifically, the following is an example of what is a continuous repetition. For the data 625362536253, it can be seen that the data 6253 is continuously repeated data, and for the data 625306253, 62563 is not continuously repeated data because there is an additional 0 between the two 6253.
参照图10,图10中,纠错后的红外数据为第二复合数据,压缩后的红外数据为处理后的数据。Referring to FIG. 10, in FIG. 10, the infrared data after error correction is the second composite data, and the compressed infrared data is the processed data.
分析第二复合数据,可以发现150 62连续重复了11次,150 20连续重复了19次。其余数据没有连续重复的。Analysis of the second composite data revealed that 150 62 was repeated 11 times in succession and 150 20 was repeated 19 times in succession. The rest of the data is not continuously repeated.
所述150 62以及150 20为重复数据。The 150 62 and 150 20 are duplicate data.
S52、将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;S52. Process each set of duplicate data according to a preset format, and obtain processed duplicate data corresponding to each set of the repeated data.
其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列。第二预设数值可以为128。The preset format is sequentially arranged according to the repeated data, the second preset value, and the number of occurrences of the repeated data. The second preset value can be 128.
如图10中的150 62这组重复数据,一共出现了11次,则150 62对应的处理后的重复数据为150 62 128 11。As shown in Fig. 10, the group of duplicate data of 150 62 appears 11 times in total, and the processed duplicate data corresponding to 150 62 is 150 62 128 11 .
其余重复数据按照此种方法依次进行处理,得到每组所述重复数据对应的处理后的重复数据。The remaining duplicate data are sequentially processed in this way to obtain the processed duplicate data corresponding to each set of the repeated data.
需要说明的是,第一预设数值设置为128的原因是:It should be noted that the reason why the first preset value is set to 128 is:
因为128的二进制为1000 0000,翻译过来的意思是,符号为1,但长度为0的波形。这种长度为0的波形是不存在的。所以128一旦出现,表示是关键字,而不是码型数据。用128可以区分二者,不至于恢复数据时候造成数据混淆。Since the binary of 128 is 1000 0000, the translation means that the symbol is 1, but the waveform is 0 in length. This waveform of length 0 does not exist. So once 128 appears, it means it is a keyword, not a pattern data. Use 128 to distinguish between the two, so as not to cause data confusion when restoring data.
S53、将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。S53. Arranging and combining the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data according to the positional relationship of the corresponding original data in the second composite data. The processed data.
具体的,参照图10,由于150 62之前的数据没有连续重复的,所以那些数据还按照之前的数据排列方法进行排列,对于重复数据,则使用重复数据对应的处理后的重复数据进行替换,并按照重复数据之前在第二复合数据中所造的位置进行排列,得到处理后的数据。Specifically, referring to FIG. 10, since the data before 150 62 is not continuously repeated, those data are also arranged according to the previous data arrangement method, and for the repeated data, the processed duplicate data corresponding to the duplicate data is used for replacement, and The processed data is arranged according to the positions created in the second composite data before the data is repeated.
参照图10,图10中,第二复合数据进行压缩后,得到处理后的数据,图10中的压缩后的红外数据。Referring to FIG. 10, in FIG. 10, after the second composite data is compressed, the processed data, the compressed infrared data in FIG. 10 is obtained.
可以看出,第二复合数据的长度为71字节,压缩后的长度为15字节,进一步减少了数据量。It can be seen that the length of the second composite data is 71 bytes, and the length after compression is 15 bytes, further reducing the amount of data.
需要说明的是,得到处理后的数据后,当发送到被遥控器控制的电子产品时,需要进行解压缩以及红外调制。It should be noted that after the processed data is obtained, when it is sent to the electronic product controlled by the remote controller, decompression and infrared modulation are required.
具体的,解压缩和压缩互为逆操作,看处理后的数据中是否存在128,若存在,则根据上述预设格式得到原始数据,进而就能够得到解压缩数据。Specifically, decompression and compression are inverse operations, and whether there is 128 in the processed data, if yes, the original data is obtained according to the preset format, and then the decompressed data can be obtained.
得到解压缩数据后,进行比特解压缩,就是把符号数据和码型数据分开,也就是将8bit转换为之前的14bit+符号位的格式,然后才能进行调制。具体的,首先设备FIFO读取解压缩后的数据,其中包括载波频率数据和波形数据。载波频率数据发往载波发生器,产生相应频率的载波,然后读取波形数据,对其进行载波边沿同步,保证调制输出波形是边沿对齐的,有利于减小调制误差。同步后的红外波形数据,通过乘法器,乘上载波,实现二进制键控调制,输出调制后的红外数据至红外发射器。至此红外调制完毕。After decompressing the data, bit decompression is performed by separating the symbol data from the pattern data, that is, converting 8 bits into the format of the previous 14 bit+ sign bit before modulation. Specifically, the device FIFO first reads the decompressed data, including carrier frequency data and waveform data. The carrier frequency data is sent to the carrier generator to generate the carrier of the corresponding frequency, and then the waveform data is read, and the carrier edge is synchronized to ensure that the modulated output waveform is edge-aligned, which is beneficial to reduce the modulation error. The synchronized infrared waveform data is multiplied by a multiplier to implement binary keying modulation, and the modulated infrared data is output to the infrared emitter. At this point, the infrared modulation is completed.
本实施例中,增加了字节压缩,进而能够进一步减少数据量。In this embodiment, byte compression is added, and the amount of data can be further reduced.
可选的,在上述红外数据学习方法的实施例的基础上,本发明的另一实施例提供了一种数据学习装置,参照图11,数据学习装置可以包括:Optionally, on the basis of the foregoing embodiment of the infrared data learning method, another embodiment of the present invention provides a data learning device. Referring to FIG. 11, the data learning device may include:
信号获取模块301,用于获取待学习的红外信号;a signal acquisition module 301, configured to acquire an infrared signal to be learned;
计算模块302,用于计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;The calculation module 302 is configured to calculate carrier period data and pattern data of the infrared signal, where the pattern data is baseband data obtained after the infrared signal is subjected to carrier processing;
数据组合模块303,用于根据所述载波周期数据以及所述码型数据,得到复合数据;The data combination module 303 is configured to obtain composite data according to the carrier cycle data and the pattern data.
处理模块304,用于对所述复合数据进行压缩和纠错,得到处理后的 数据。The processing module 304 is configured to compress and correct the composite data to obtain processed data.
进一步,所述计算模块302可以包括:Further, the calculating module 302 can include:
数据获取子模块,用于获取多个所述红外信号的初始载波周期数据;a data acquisition submodule, configured to acquire initial carrier period data of the plurality of the infrared signals;
计算子模块,用于将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;a calculation submodule, configured to use an average value of initial carrier period data of the plurality of the infrared signals as the carrier period data;
去载波子模块,用于对所述红外信号进行去载波处理,得到基带信号;a carrier submodule, configured to perform carrier processing on the infrared signal to obtain a baseband signal;
测量子模块,用于测量基带信号波形脉宽,得到码型数据。The measurement sub-module is used to measure the pulse width of the baseband signal waveform to obtain the pattern data.
本实施例中,得到复合数据后,会对数据进行压缩处理,进而能够减少数据量,占用单片机资源较少,降低成本、器件数量,可以提高设备可靠性。In this embodiment, after the composite data is obtained, the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.
需要说明的是,本实施例中的各个模块和子模块的工作过程,请参照上述实施例中的相应说明,在此不再赘述。It should be noted that, in the working process of each module and sub-module in this embodiment, refer to the corresponding description in the foregoing embodiment, and details are not described herein again.
可选的,在上述任一数据学习装置的实施例的基础上,所述处理模块304可以包括:Optionally, on the basis of any of the foregoing embodiments of the data learning device, the processing module 304 may include:
选取子模块3041,用于从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;a sub-module 3041, configured to select one sub-data from the pattern data in the composite data as the first target data;
字节设置子模块3042,用于将所述第一目标数据转换为预设大小的待处理数据;a byte setting sub-module 3042, configured to convert the first target data into a preset size of data to be processed;
分割子模块3043,用于将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;a segmentation sub-module 3043, configured to perform data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
压缩子模块3044,用于根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;The compression sub-module 3044 is configured to perform bit compression on the to-be-processed data according to the value of the first data and the sign bit of the to-be-processed data to obtain short-type data; wherein, when the first data is When the data is zero, the first data is discarded;
替换子模块3045,用于将所述短码型数据替换所选取出的子数据;a replacement submodule 3045, configured to replace the short code type data with the selected sub data;
判断子模块3046,用于判断所述码型数据中各个子数据是否都被替换为相应的短码型数据,从而得到第一复合数据;The determining sub-module 3046 is configured to determine whether each sub-data in the pattern data is replaced with corresponding short-type data, thereby obtaining first composite data;
所述选取子模块3041,还用于当所述判断子模块3046判断出所述码型数据中各个子数据未都被替换为相应的短码型数据、且未得到第一复合 数据,从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;The selection sub-module 3041 is further configured to: when the determining sub-module 3046 determines that each sub-data in the pattern data is not replaced with corresponding short-type data, and does not obtain the first composite data, Selecting one sub-data from the pattern data in the composite data as the first target data;
处理子模块3047,用于对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。The processing sub-module 3047 is configured to perform error correction and byte compression processing on the first composite data to obtain the processed data.
本实施例中,通过字节压缩的方法来减少数据量,进而能够占用较少的存储资源。In this embodiment, the amount of data is reduced by the method of byte compression, which in turn can occupy less storage resources.
需要说明的是,本实施例中的各个模块和子模块的工作过程,请参照上述实施例中的相应说明,在此不再赘述。It should be noted that, in the working process of each module and sub-module in this embodiment, refer to the corresponding description in the foregoing embodiment, and details are not described herein again.
可选的,在图12对应的实施例的基础上,所述处理子模块3047包括:Optionally, on the basis of the corresponding embodiment of FIG. 12, the processing submodule 3047 includes:
选取单元,用于从所述第一复合数据中选取一个数据作为第二目标数据;a selecting unit, configured to select one data from the first composite data as the second target data;
统计单元,用于统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;a statistical unit, configured to count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and a third number of times that the data of the first predetermined value is greater than the value of the second target data; wherein, when the first number of times is greater than the second number of times and the third number of times, The value of the second target data is not changed;
第一更改单元,用于当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;a first changing unit, configured to change the second target data to be smaller than a value of the second target data when the second number of times is greater than the first number of times and the third number of times Set numerical data;
第二更改单元,用于当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;a second changing unit, configured to change the second target data to be greater than a value of the second target data when the third number is greater than the first number of times and the second number of times Set numerical data;
判断单元,用于判断是否确定所述第一复合数据中每个数据的对应的处理后的数据;a determining unit, configured to determine whether to determine corresponding processed data of each data in the first composite data;
所述选取单元,还用于当所述判断单元判断出未确定所述第一复合数据中每个数据的对应的处理后的数据,从所述第一复合数据中选取一个数据作为第二目标数据;The selecting unit is further configured to: when the determining unit determines that the corresponding processed data of each data in the first composite data is not determined, and select one data from the first composite data as the second target data;
数据处理单元,用于根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;a data processing unit, configured to obtain second composite data according to the processed data corresponding to each data in the first composite data;
压缩单元,用于对对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。And a compression unit, configured to perform byte compression processing on the second composite data to obtain the processed data.
本实施例中,增加了纠错步骤,进而能够避免由于受到干扰等原因而造成数据错误的情况。In this embodiment, an error correction step is added, and in addition, it is possible to avoid a data error caused by interference or the like.
需要说明的是,本实施例中的各个模块、子模块和单元的工作过程,请参照上述实施例中的相应说明,在此不再赘述。It should be noted that, in the working process of each module, sub-module, and unit in this embodiment, refer to the corresponding description in the foregoing embodiment, and details are not described herein again.
可选的,在上一个实施例的基础上,所述压缩单元包括:Optionally, on the basis of the previous embodiment, the compression unit includes:
提取子单元,用于提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting a subunit, configured to extract at least one set of repeated data that is continuously repeated in the second composite data;
数据处理子单元,用于将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;a data processing sub-unit, configured to process each set of duplicate data according to a preset format, to obtain processed duplicate data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, and the second The preset value and the number of occurrences of the repeated data are sequentially arranged;
组合子单元,用于将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。a combination subunit, configured to perform, according to the positional relationship of the corresponding original data in the second composite data, the unrepeated data in the second composite data and the processed repeated data corresponding to each set of the repeated data. The combination is arranged to obtain the processed data.
本实施例中,增加了字节压缩,进而能够进一步减少数据量。In this embodiment, byte compression is added, and the amount of data can be further reduced.
需要说明的是,本实施例中的各个模块、子模块、单元和子单元的工作过程,请参照上述实施例中的相应说明,在此不再赘述。It should be noted that, in the working process of each module, sub-module, unit, and sub-unit in this embodiment, refer to the corresponding description in the foregoing embodiment, and details are not described herein again.
可选的,在上述红外数据学习方法和装置的实施例的基础上,本发明的另一实施例中提供了一种电子设备,包括:存储器和处理器;Optionally, on the basis of the foregoing embodiments of the infrared data learning method and apparatus, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
其中,所述存储器用于存储程序;Wherein the memory is used to store a program;
处理器用于调用程序,其中,所述程序用于:The processor is for calling a program, wherein the program is used to:
获取待学习的红外信号;Obtain an infrared signal to be learned;
计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;Calculating carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to de-carrier processing;
根据所述载波周期数据以及所述码型数据,得到复合数据;Obtaining composite data according to the carrier cycle data and the pattern data;
对所述复合数据进行压缩和纠错,得到处理后的数据。Compressing and correcting the composite data to obtain processed data.
进一步,所述处理器用于对所述复合数据进行压缩和纠错,得到处理后的数据时,具体用于:Further, the processor is configured to perform compression and error correction on the composite data, and when the processed data is obtained, specifically used to:
从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;Selecting one sub-data from the pattern data in the composite data as the first target data;
将所述第一目标数据转换为预设大小的待处理数据;Converting the first target data into a preset size of data to be processed;
将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;Performing data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;And performing bit compression on the to-be-processed data according to the value of the first data and the sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is zero, discarding First data;
将所述短码型数据替换所选取出的子数据;Substituting the short pattern data for the selected sub data;
返回从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据的步骤,直到所述码型数据中各个子数据都被替换为相应的短码型数据,从而得到第一复合数据;Returning a step of selecting one sub-data from the pattern data in the composite data as the first target data until each sub-data in the pattern data is replaced with corresponding short pattern data, thereby obtaining First composite data;
对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。Perform error correction and byte compression processing on the first composite data to obtain the processed data.
进一步,所述处理器用于对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据时,具体用于:Further, the processor is configured to perform error correction and byte compression processing on the first composite data, and when the processed data is obtained, specifically used to:
从所述第一复合数据中选取一个数据作为第二目标数据;Selecting one data from the first composite data as the second target data;
统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;Counting a first number of occurrences of the second target data in the first composite data, a second occurrence of data that is smaller than a value of the second target data by a first predetermined value, and an occurrence ratio The value of the second target data is greater than the third number of times of the data of the first preset value; wherein, when the first number of times is greater than the second number of times and the third number of times, the second target data The value does not change;
当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;When the second number of times is greater than the first number of times and the third number of times, changing the second target data to data that is smaller than a value of the second target data by a first preset value;
当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;When the third number is greater than the first number of times and the second number of times, changing the second target data to data that is greater than a value of the second target data by a second predetermined value;
返回从所述第一复合数据中选取一个数据作为第二目标数据这一步骤,直到确定所述第一复合数据中每个数据的对应的处理后的数据时为止;Returning a step of selecting one data from the first composite data as the second target data until determining the corresponding processed data of each of the first composite data;
根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复 合数据;Obtaining second composite data according to the processed data corresponding to each data in the first composite data;
对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。Performing byte compression processing on the second composite data to obtain the processed data.
进一步,所述处理器用于对所述第二复合数据进行字节压缩处理,得到所述处理后的数据时,具体用于:Further, the processor is configured to perform byte compression processing on the second composite data, and when the processed data is obtained, specifically used to:
提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting at least one set of repeated data that is continuously repeated in the second composite data;
将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;Processing each set of duplicate data according to a preset format to obtain processed repeated data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, the second preset value, and the repetition The number of occurrences of data is sequentially arranged;
将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。And the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data are arranged and combined according to a positional relationship of the corresponding original data in the second composite data, to obtain the Processed data.
进一步,所述处理器用于计算所述红外信号的载波周期数据以及码型数据时,具体用于:Further, when the processor is used to calculate carrier period data and pattern data of the infrared signal, specifically, the processor is specifically configured to:
获取多个所述红外信号的初始载波周期数据;Obtaining initial carrier period data of the plurality of infrared signals;
将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;Taking an average value of initial carrier period data of the plurality of infrared signals as the carrier period data;
对所述红外信号进行去载波处理,得到基带信号;De-carrier processing the infrared signal to obtain a baseband signal;
测量基带信号波形脉宽,得到码型数据。The pulse width of the baseband signal waveform is measured to obtain pattern data.
本实施例中,得到复合数据后,会对数据进行压缩处理,进而能够减少数据量,占用单片机资源较少,降低成本、器件数量,可以提高设备可靠性。In this embodiment, after the composite data is obtained, the data is compressed, thereby reducing the amount of data, consuming less MCU resources, reducing the cost, the number of devices, and improving device reliability.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments are obvious to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but the scope of the invention is to be accorded

Claims (11)

  1. 一种红外数据学习方法,其特征在于,包括:An infrared data learning method, comprising:
    获取待学习的红外信号;Obtain an infrared signal to be learned;
    计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;Calculating carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to de-carrier processing;
    根据所述载波周期数据以及所述码型数据,得到复合数据;Obtaining composite data according to the carrier cycle data and the pattern data;
    对所述复合数据进行压缩和纠错,得到处理后的数据。Compressing and correcting the composite data to obtain processed data.
  2. 根据权利要求1所述的红外数据学习方法,其特征在于,对所述复合数据进行压缩和纠错,得到处理后的数据,包括:The infrared data learning method according to claim 1, wherein compressing and correcting the composite data to obtain processed data comprises:
    从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;Selecting one sub-data from the pattern data in the composite data as the first target data;
    将所述第一目标数据转换为预设大小的待处理数据;Converting the first target data into a preset size of data to be processed;
    将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;Performing data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
    根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;And performing bit compression on the to-be-processed data according to the value of the first data and the sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is zero, discarding First data;
    将所述短码型数据替换所选取出的子数据;Substituting the short pattern data for the selected sub data;
    返回从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据的步骤,直到所述码型数据中各个子数据都被替换为相应的短码型数据,从而得到第一复合数据;Returning a step of selecting one sub-data from the pattern data in the composite data as the first target data until each sub-data in the pattern data is replaced with corresponding short pattern data, thereby obtaining First composite data;
    对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。Perform error correction and byte compression processing on the first composite data to obtain the processed data.
  3. 根据权利要求2所述的红外数据学习方法,其特征在于,对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据,包括:The infrared data learning method according to claim 2, wherein the first composite data is subjected to error correction and byte compression processing to obtain the processed data, including:
    从所述第一复合数据中选取一个数据作为第二目标数据;Selecting one data from the first composite data as the second target data;
    统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比 所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;Counting a first number of occurrences of the second target data in the first composite data, a second occurrence of data that is smaller than a value of the second target data by a first predetermined value, and an occurrence ratio The value of the second target data is greater than the third number of times of the data of the first preset value; wherein, when the first number of times is greater than the second number of times and the third number of times, the second target data The value does not change;
    当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;When the second number of times is greater than the first number of times and the third number of times, changing the second target data to data that is smaller than a value of the second target data by a first preset value;
    当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;When the third number is greater than the first number of times and the second number of times, changing the second target data to data that is greater than a value of the second target data by a second predetermined value;
    返回从所述第一复合数据中选取一个数据作为第二目标数据这一步骤,直到确定所述第一复合数据中每个数据的对应的处理后的数据时为止;Returning a step of selecting one data from the first composite data as the second target data until determining the corresponding processed data of each of the first composite data;
    根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;Obtaining second composite data according to the processed data corresponding to each data in the first composite data;
    对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。Performing byte compression processing on the second composite data to obtain the processed data.
  4. 根据权利要求3所述的红外数据学习方法,其特征在于,对所述第二复合数据进行字节压缩处理,得到所述处理后的数据,包括:The infrared data learning method according to claim 3, wherein performing byte compression processing on the second composite data to obtain the processed data comprises:
    提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting at least one set of repeated data that is continuously repeated in the second composite data;
    将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;Processing each set of duplicate data according to a preset format to obtain processed repeated data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, the second preset value, and the repetition The number of occurrences of data is sequentially arranged;
    将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据中的位置关系,进行排列组合,得到所述处理后的数据。And the unrepeated data in the second composite data and the processed duplicate data corresponding to each set of the repeated data are arranged and combined according to a positional relationship of the corresponding original data in the second composite data, to obtain the Processed data.
  5. 根据权利要求1所述的红外数据学习方法,其特征在于,计算所述红外信号的载波周期数据以及码型数据,包括:The infrared data learning method according to claim 1, wherein calculating carrier period data and pattern data of the infrared signal comprises:
    获取多个所述红外信号的初始载波周期数据;Obtaining initial carrier period data of the plurality of infrared signals;
    将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;Taking an average value of initial carrier period data of the plurality of infrared signals as the carrier period data;
    对所述红外信号进行去载波处理,得到基带信号;De-carrier processing the infrared signal to obtain a baseband signal;
    测量基带信号波形脉宽,得到码型数据。The pulse width of the baseband signal waveform is measured to obtain pattern data.
  6. 一种数据学习装置,其特征在于,包括:A data learning device, comprising:
    信号获取模块,用于获取待学习的红外信号;a signal acquisition module, configured to acquire an infrared signal to be learned;
    计算模块,用于计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;a calculation module, configured to calculate carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to carrier processing;
    数据组合模块,用于根据所述载波周期数据以及所述码型数据,得到复合数据;a data combining module, configured to obtain composite data according to the carrier cycle data and the pattern data;
    处理模块,用于对所述复合数据进行压缩和纠错,得到处理后的数据。And a processing module, configured to compress and correct the composite data to obtain processed data.
  7. 根据权利要求6所述的数据学习装置,其特征在于,所述处理模块包括:The data learning device according to claim 6, wherein the processing module comprises:
    选取子模块,用于从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;Selecting a sub-module, configured to select one sub-data from the pattern data in the composite data as the first target data;
    字节设置子模块,用于将所述第一目标数据转换为预设大小的待处理数据;a byte setting submodule, configured to convert the first target data into a preset size of to-be-processed data;
    分割子模块,用于将所述待处理数据进行数据分割,得到第一数据和第二数据;其中,所述第一数据为高位数据,所述第二数据为低位数据;a segmentation sub-module, configured to perform data segmentation on the to-be-processed data to obtain first data and second data; wherein the first data is high-order data, and the second data is low-level data;
    压缩子模块,用于根据所述第一数据的数值以及所述待处理数据的符号位,对所述待处理数据进行比特压缩,得到短码型数据;其中,当所述第一数据的数据为零时,丢弃所述第一数据;a compression submodule, configured to perform bit compression on the to-be-processed data according to a value of the first data and a sign bit of the to-be-processed data to obtain short-type data; wherein, when the data of the first data is When zero, the first data is discarded;
    替换子模块,用于将所述短码型数据替换所选取出的子数据;a replacement submodule, configured to replace the short code type data with the selected sub data;
    判断子模块,用于判断所述码型数据中各个子数据是否都被替换为相应的短码型数据,从而得到第一复合数据;a determining sub-module, configured to determine whether each sub-data in the pattern data is replaced with corresponding short-type data, thereby obtaining first composite data;
    所述选取子模块,还用于当所述判断子模块判断出所述码型数据中各个子数据未都被替换为相应的短码型数据、且未得到第一复合数据,从所述复合数据中的所述码型数据中选取出一个子数据作为第一目标数据;The selecting sub-module is further configured to: when the determining sub-module determines that each sub-data in the pattern data is not replaced with corresponding short-type data, and does not obtain the first composite data, from the composite One sub-data is selected as the first target data in the pattern data in the data;
    处理子模块,用于对所述第一复合数据进行纠错和字节压缩处理,得到所述处理后的数据。The processing submodule is configured to perform error correction and byte compression processing on the first composite data to obtain the processed data.
  8. 根据权利要求7所述的数据学习装置,其特征在于,所述处理子模块包括:The data learning device according to claim 7, wherein the processing submodule comprises:
    选取单元,用于从所述第一复合数据中选取一个数据作为第二目标数据;a selecting unit, configured to select one data from the first composite data as the second target data;
    统计单元,用于统计所述第一复合数据中出现所述第二目标数据的第一次数、出现比所述第二目标数据的数值小第一预设数值的数据的第二次数、以及出现比所述第二目标数据的数值大所述第一预设数值的数据的第三次数;其中,当所述第一次数大于所述第二次数和所述第三次数时,所述第二目标数据的数值不更改;a statistical unit, configured to count a first number of times that the second target data appears in the first composite data, a second number of times that the data of the first preset value is smaller than a value of the second target data, and a third number of times that the data of the first predetermined value is greater than the value of the second target data; wherein, when the first number of times is greater than the second number of times and the third number of times, The value of the second target data is not changed;
    第一更改单元,用于当所述第二次数大于所述第一次数和所述第三次数时,将所述第二目标数据更改为比所述第二目标数据的数值小第一预设数值的数据;a first changing unit, configured to change the second target data to be smaller than a value of the second target data when the second number of times is greater than the first number of times and the third number of times Set numerical data;
    第二更改单元,用于当所述第三次数大于所述第一次数和所述第二次数时,将所述第二目标数据更改为比所述第二目标数据的数值大第二预设数值的数据;a second changing unit, configured to change the second target data to be greater than a value of the second target data when the third number is greater than the first number of times and the second number of times Set numerical data;
    判断单元,用于判断是否确定所述第一复合数据中每个数据的对应的处理后的数据;a determining unit, configured to determine whether to determine corresponding processed data of each data in the first composite data;
    所述选取单元,还用于当所述判断单元判断出未确定所述第一复合数据中每个数据的对应的处理后的数据,从所述第一复合数据中选取一个数据作为第二目标数据;The selecting unit is further configured to: when the determining unit determines that the corresponding processed data of each data in the first composite data is not determined, and select one data from the first composite data as the second target data;
    数据处理单元,用于根据所述第一复合数据中每个数据对应的处理后的数据,得到第二复合数据;a data processing unit, configured to obtain second composite data according to the processed data corresponding to each data in the first composite data;
    压缩单元,用于对对所述第二复合数据进行字节压缩处理,得到所述处理后的数据。And a compression unit, configured to perform byte compression processing on the second composite data to obtain the processed data.
  9. 根据权利要求8所述的数据学习装置,其特征在于,所述压缩单元包括:The data learning device according to claim 8, wherein the compression unit comprises:
    提取子单元,用于提取出所述第二复合数据中连续重复的至少一组重复数据;Extracting a subunit, configured to extract at least one set of repeated data that is continuously repeated in the second composite data;
    数据处理子单元,用于将每组重复数据按照预设格式进行处理,得到每组所述重复数据对应的处理后的重复数据;其中,所述预设格式为按照所述重复数据、第二预设数值、所述重复数据出现次数进行顺序排列;a data processing sub-unit, configured to process each set of duplicate data according to a preset format, to obtain processed duplicate data corresponding to each set of the repeated data; wherein the preset format is according to the repeated data, and the second The preset value and the number of occurrences of the repeated data are sequentially arranged;
    组合子单元,用于将所述第二复合数据中未重复的数据、每组所述重复数据对应的处理后的重复数据按照对应的原始数据在所述第二复合数据 中的位置关系,进行排列组合,得到所述处理后的数据。a combination subunit, configured to perform, according to the positional relationship of the corresponding original data in the second composite data, the unrepeated data in the second composite data and the processed repeated data corresponding to each set of the repeated data. The combination is arranged to obtain the processed data.
  10. 根据权利要求6所述的数据学习装置,其特征在于,所述计算模块包括:The data learning device according to claim 6, wherein the calculation module comprises:
    数据获取子模块,用于获取多个所述红外信号的初始载波周期数据;a data acquisition submodule, configured to acquire initial carrier period data of the plurality of the infrared signals;
    计算子模块,用于将多个所述红外信号的初始载波周期数据的平均值作为所述载波周期数据;a calculation submodule, configured to use an average value of initial carrier period data of the plurality of the infrared signals as the carrier period data;
    去载波子模块,用于对所述红外信号进行去载波处理,得到基带信号;a carrier submodule, configured to perform carrier processing on the infrared signal to obtain a baseband signal;
    测量子模块,用于测量基带信号波形脉宽,得到码型数据。The measurement sub-module is used to measure the pulse width of the baseband signal waveform to obtain the pattern data.
  11. 一种电子设备,其特征在于,包括:存储器和处理器;An electronic device, comprising: a memory and a processor;
    其中,所述存储器用于存储程序;Wherein the memory is used to store a program;
    处理器用于调用程序,其中,所述程序用于:The processor is for calling a program, wherein the program is used to:
    获取待学习的红外信号;Obtain an infrared signal to be learned;
    计算所述红外信号的载波周期数据以及码型数据;其中,所述码型数据为所述红外信号经过去载波处理后得到的基带数据;Calculating carrier period data and pattern data of the infrared signal; wherein the pattern data is baseband data obtained after the infrared signal is subjected to de-carrier processing;
    根据所述载波周期数据以及所述码型数据,得到复合数据;Obtaining composite data according to the carrier cycle data and the pattern data;
    对所述复合数据进行压缩和纠错,得到处理后的数据。Compressing and correcting the composite data to obtain processed data.
PCT/CN2018/072219 2018-01-11 2018-01-11 Infrared data learning method, device, and electronic apparatus WO2019136658A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/072219 WO2019136658A1 (en) 2018-01-11 2018-01-11 Infrared data learning method, device, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/072219 WO2019136658A1 (en) 2018-01-11 2018-01-11 Infrared data learning method, device, and electronic apparatus

Publications (1)

Publication Number Publication Date
WO2019136658A1 true WO2019136658A1 (en) 2019-07-18

Family

ID=67219252

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/072219 WO2019136658A1 (en) 2018-01-11 2018-01-11 Infrared data learning method, device, and electronic apparatus

Country Status (1)

Country Link
WO (1) WO2019136658A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111262099A (en) * 2020-01-20 2020-06-09 广州大学 A programmable remote control smart socket and its realization method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050237231A1 (en) * 2004-04-02 2005-10-27 Benq Corporation System and method for data synchronization
CN201600782U (en) * 2010-01-08 2010-10-06 康佳集团股份有限公司 Remote control device of combined multimedia equipment
CN101989379A (en) * 2009-07-31 2011-03-23 宁波家天下智能系统有限公司 Learning method and transmitting method of infrared cod signal and remote controller
CN105306062A (en) * 2015-11-23 2016-02-03 青岛海信电器股份有限公司 Encoding and storing method and device for infrared data, and decoding method
CN106950871A (en) * 2016-01-07 2017-07-14 深圳市博巨兴实业发展有限公司 A kind of microcontroller and its timer conter

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050237231A1 (en) * 2004-04-02 2005-10-27 Benq Corporation System and method for data synchronization
CN101989379A (en) * 2009-07-31 2011-03-23 宁波家天下智能系统有限公司 Learning method and transmitting method of infrared cod signal and remote controller
CN201600782U (en) * 2010-01-08 2010-10-06 康佳集团股份有限公司 Remote control device of combined multimedia equipment
CN105306062A (en) * 2015-11-23 2016-02-03 青岛海信电器股份有限公司 Encoding and storing method and device for infrared data, and decoding method
CN106950871A (en) * 2016-01-07 2017-07-14 深圳市博巨兴实业发展有限公司 A kind of microcontroller and its timer conter

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111262099A (en) * 2020-01-20 2020-06-09 广州大学 A programmable remote control smart socket and its realization method
CN111262099B (en) * 2020-01-20 2021-11-19 广州大学 Programmable remote control intelligent socket and implementation method thereof

Similar Documents

Publication Publication Date Title
US10362220B2 (en) Conversation of pixel data into compression format of pixels
US5570377A (en) Method and device for detection and correction of errors in ATM cell headers
CN108182795B (en) Infrared data learning method and device and electronic equipment
KR950015183B1 (en) Binary Sample Square Root Calculation Unit
WO2019136658A1 (en) Infrared data learning method, device, and electronic apparatus
CN102939595B (en) Signal processing apparatus and signal processing method thereof
CN116320385A (en) Non-uniform correction parameter setting and detection method of a detector
CN109633228A (en) The method of sampling, device and oscillograph in a kind of oscillograph
US6915479B2 (en) Apparatus and method for error correction
CN118660246B (en) Oversampling method, device, electronic device and computer-readable storage medium
CN118660247B (en) Oversampling method, device, electronic device and computer-readable storage medium
EP4350570A1 (en) Data processing method and apparatus and electronic device
JP2797569B2 (en) Euclidean circuit
KR100499878B1 (en) An error correction circuit for pid in dvd ram
KR950010919B1 (en) Synchronization acquisition device and method thereof using shift and add of code
KR100199186B1 (en) Block sync. circuit of digital ultra frequency transmission device
JP2678093B2 (en) Decoding circuit
JP2797570B2 (en) Euclidean circuit
JP2780503B2 (en) Parity check detection circuit
JPH042232A (en) Tdma reception circuit
JPH0537508A (en) Pulse width distortion correction circuit for start-stop signal
CN115755670A (en) Method for realizing sampling of asynchronous signals based on FPGA
JPH11136217A (en) Bit error rate measurement apparatus
KR100205284B1 (en) Block synchronized circuit of digital microwave transmission apparatus
CN105516631A (en) Anti-vibration analog component video signal decoding circuit

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18899970

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18899970

Country of ref document: EP

Kind code of ref document: A1