Interpretation method and device thereof
Technical field
The present invention relates to a kind of telecommand interpretation method and device thereof, espespecially a kind of infra-red remote control Instruction decoding method and device thereof that automatically can adjust the sample period.
Background technology
Known remote control equipment institute operation technique is mainly infrared ray (IR) or less radio-frequency (Radio Frequency) technology.Wherein, volume is little, power consumption is lower and low cost and other advantages owing to possessing for infrared remote control equipment, becomes a kind of telecontrol engineering more widely used at present, as US patent number the 4th, 426, No. 662 patents are a kind of suitable example of infra-red remote control opertaing device.
Infrared remote control equipment generally has and sends and receive two ends, sending and receiving the instruction transmission between two ends, a set of coding and coding standards must be had, could effectively transmit and identification instruction, as above United States Patent (USP) the 4th is lifted, namely a kind of infra-red remote control decoding technique being positioned at receiving end is disclosed in 426, No. 662.The coded format of infrared remote controller instruction is mainly divided into two large classes, and the first kind is the RC-5 code and RECS80 code generally applied at European Region, and an other class is then the NEC code being generally applied in the Far East Area.
Fig. 1 shows a kind of infra-red remote control command encoding formats of known NEC code, it is adopt pulse wave width modulation mode (Pulse Width Modulation), includes an initial pulse wave (leader pulse or initial pulse), the user code (user code of 8 and 8 bit complements thereof) of 16 and the numeric data code (numeric data code of 8 and 8 bit complements thereof) of 16.And in Fig. 1 the binary digit representation of form as shown in Figure 2, with pulse bandwidth (high levels) about 0.56 millisecond (ms, millisecond), low level about 0.56 millisecond, the cycle is about 1.125 milliseconds and represents binary " 0 "; With high levels about 0.56 millisecond, low level about 1.68 milliseconds, the cycle is about 2.25 milliseconds and represents binary " 1 ".In addition, the high levels of initial pulse wave about 9 milliseconds, low level about 4.5 milliseconds, the cycle is about 13.5 milliseconds of expressions.
After infrared remote controller transmitting terminal sends remote pilot instruction, receiving end must for this telecommand decoding (numeric data code, user codes to 16), the meaning represented with identification instruction.Below just for above-mentioned NEC code, a kind of interpretation method is wherein described, in a common interpretation method, be in computations sequence code certain waveform falling edge to adjacent waveform rising edge (namely during low level) the number in signal cycle of process, with the binary command of identification corresponding to it.NEC code coded format described above, suppose that the frequency of utilization cycle is 1 microsecond (μ s, microsecond), " 0 " is high levels 0.56 millisecond, low level 0.56 millisecond; " 1 " is high levels 0.56 millisecond, low level 1.68 milliseconds, therefore, when waveform falling edge to adjacent waveform rising edge the frequency number of process be about 560 (0.56ms/1 μ s) time, then corresponding position is decoded as " 0 "; When waveform falling edge to adjacent waveform rising edge the frequency number of process be about 1680 (1.68ms/1 μ s) time, then corresponding position is decoded as " 1 ", so can calculate by frequency number object the binary condition of identification command bits.
In above-mentioned interpretation method, need the frequency number presetting two interval before judging data bit value, such as frequency number 550 ~ 570 and 1670 ~ 1,690 two intervals, when waveform falling edge to adjacent waveform rising edge the frequency number of process drop on 550 ~ 570 interval in time, namely place value " 0 " is represented, otherwise, when waveform falling edge to adjacent waveform rising edge the frequency number of process drop on 1670 ~ 1690 interval in time, represent place value " 1 ", but, infra-red remote control instruction is causing the change of pulse waveform sometimes after transmitting, such as: pulse bandwidth is elongated or shorten, in this case, known techniques uses the interpretation method of fixed frequency number interval decoding cannot go out correct instruction place value.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of interpretation method and device thereof, can solve the problem of the sequence code of decoding distortion.
In order to solve above technical matters, the invention provides following technical scheme:
The invention provides a kind of interpretation method, for decoding one sequence code, this sequence code comprises at least one initial pulse wave and complex data pulse wave, and this interpretation method comprises the following step: receive a sequence code; Detect this initial pulse wave of this sequence code; After detecting this initial pulse wave, the pulse bandwidth according to the data pulse wave in those data pulse waves determines a sample period; And according to this sample period, decoding is carried out to those data pulse waves.
In the step of this initial pulse wave of above-mentioned detecting, when the pulse bandwidth of a pulse wave exceedes this default value, judge that this pulse wave is as this initial pulse wave.And carry out in the step of decoding according to this sample period to those data pulse waves, when the interval of the data pulse wave adjacent with next of the data pulse wave in those complex data pulse waves is not more than one predetermined this sample period, produce one first place value; When the interval of the data pulse wave adjacent with next of the data pulse wave in those complex data pulse waves is greater than this predetermined this sample period, produce one second place value.
The present invention more provides a kind of code translator, and for decoding one sequence code, this sequence code comprises at least one initial pulse wave and complex data pulse wave, and this code translator includes: a detecting unit, is used for detecting this initial pulse wave, to produce a notice signal; One determining means, is used for determining a sample period according to the pulse bandwidth of the data pulse wave in this notice signal and those data pulse waves; And a decoding unit, be used for carrying out decoding according to this sample period to those data pulse waves.
In above-mentioned code translator, when the pulse bandwidth of a pulse wave is greater than this default value, this detecting unit judges that this pulse wave is as this initial pulse wave.Preferably, above-mentioned code translator more comprises a mnemon, in order to store the decoding data that this decoding unit exports.
The interpretation method that the present invention adopts and device thereof utilize the pulse bandwidth of the sequence code received to produce the sample period, and carry out decoding according to this sample period to sequence code, therefore can solve the problem of the sequence code of decoding distortion.Even if the pulse waveform of infra-red remote control instruction has in transport process produce distortion, still decodable code goes out correct command value.
Accompanying drawing explanation
Fig. 1 shows known a kind of infra-red remote control command encoding formats schematic diagram.
The binary digit that Fig. 2 shows figure mono-coded format represents schematic diagram.
Fig. 3 shows the process flow diagram of an embodiment of interpretation method of the present invention.
Fig. 4 (a), 4 (b) show the binary decoding method schematic diagram according to one embodiment of the invention respectively.
Fig. 5 shows an embodiment calcspar of code translator of the present invention.
Fig. 6 shows a preferred embodiment calcspar of code translator of the present invention.
[primary clustering symbol description]
500 code translator 510 detecting units
520 determining means 530 decoding units
600 code translator 610 detecting units
620 determining means 621 counters
622 latch unit 630 decoding units
640 mnemons
Embodiment
For further understanding the above-mentioned object of the present invention, function, feature and advantage, hereafter cooperation institute accompanying drawings is further illustrated preferred embodiment of the present invention.
Fig. 3 system shows the process flow diagram of the interpretation method of the infra-red remote control instruction of one embodiment of the invention, for convenience of description interpretation method of the present invention, is all to illustrate for NEC code in Examples below, but is not limit the present invention.
After infra-red remote control instruction sequence code input (reception), step 301 first detects the initial pulse wave of sequence code, generally speaking, the pulse bandwidth of the initial pulse wave of infrared ray instruction sequence code is the several times of the pulse bandwidth of data pulse wave, therefore, when the pulse bandwidth detecting a pulse wave in sequence code exceed data pulse bandwidth a lot of time, can judge that this pulse wave is initial pulse wave, for NEC code, the pulse bandwidth of the initial pulse wave of NEC code about 9 milliseconds, and the pulse bandwidth of data pulse wave about 0.56 millisecond, therefore, if the pulse bandwidth detected (during high levels) is more than a default value (such as 2 milliseconds), then judge that this pulse wave is as initial pulse wave.
In step 302, be calculate the sample period in order to coding sequence code.After the initial pulse wave of confirmation, calculate the pulse bandwidth of the data pulse wave that initial pulse wave occurs below, and by this pulse bandwidth as the sample period in order to coding sequence code data position.In the coded format of NEC code, the pulse bandwidth (during high levels) of its data pulse wave is fixing, binary " 0 " or " 1 " place value is represented respectively during being generally change low level, therefore, the sample period i.e. pulse bandwidth (during high levels) of each sequence code bit, namely 0.56 millisecond, if the waveform of sequence code produces distortion because of transport process, then step 302 can calculate the pulse bandwidth after distortion, and using this pulse bandwidth as the sample period of decoding.In one embodiment, the sample period is that the pulse bandwidth calculating first data pulse wave that initial pulse wave occurs below obtains.
In step 303, the sample period obtained with step 302 carries out decoding to the data bit (i.e. data pulse wave) in sequence code, and namely meaning carries out judging binary " 0 " or " 1 " place value representated by user code in sequence code or data code bit.In the present embodiment, step 303 detects interval in sequence code between every two pulse waves (in such as sequence code, the falling edge of a data pulse wave is to the waveform rising edge of adjacent pulse wave) institute through sample period number according to the sample period, with the place value of identification corresponding to it, please refer to the schematic diagram shown in Fig. 4 (a), it is be described for the data bit of NEC code, when detecting the interval between two pulse waves and being less than 2 sample periods, this position represents binary " 0 ", as shown in Fig. 4 (b), when detected result is more than or equal to 2 sample periods, namely this position represents binary " 1 ".In another embodiment, the rising edge also can detecting a data pulse wave according to the sample period to the rising edge of adjacent pulse wave or falling edge the sample period number of process judge representated by this data bit place value.In interpretation method of the present invention, the sample period of decoding institute foundation produced by the actual pulse bandwidth received, even if infrared ray instruction sequence code has the situation that waveform distortions occurs at transport process, under normal circumstances, pulse wave distortion is equal proportion, therefore, the sample period produced with the pulse bandwidth after being out of shape is used as the foundation of decoding, still can obtain correct decode results.
Fig. 5 display is according to an embodiment schematic diagram of the code translator of infrared control instruction of the present invention, and as shown in Figure 5, code translator 500 of the present invention comprises detecting unit 510, determining means 520 and a decoding unit 530.Detecting unit 510 is used to the initial pulse wave detecting sequence code, and whether it detects the pulse bandwidth of pulse wave in sequence code more than a default value according to a frenquency signal, if the pulse bandwidth detected exceedes this default value, then judges that this pulse wave is as initial pulse wave.For the difference of beginning pulse bandwidth and data pulse bandwidth from tomorrow NEC code, in NEC code, pulse bandwidth during initial pulse wave high levels is 9 milliseconds, and data pulse bandwidth is 0.56 millisecond, therefore, when the pulse bandwidth of a pulse wave in sequence code exceed data pulse bandwidth (0.56 millisecond) a lot of time, can determine that this pulse wave is initial pulse wave, in the present embodiment, default value is set to 2 milliseconds, when detecting unit 510 detects the pulse bandwidth of a pulse wave more than 2 milliseconds, namely detecting unit judges that this pulse wave is as initial pulse wave, after detecting unit 510 detects an initial pulse wave, a notice signal INIT_PS can be produced, in order to notify determining means 520 and decoding unit 530.
Determining means 520 is the sample period S_P for calculating coding sequence code, after determining means 520 receives the notice signal INIT_PS of detecting unit 510, namely start to calculate the pulse bandwidth coming across initial pulse wave data pulse wave below, and by this pulse bandwidth as the sample period S_P in order to coding sequence code data position.For NEC code, when after the notified signal INIT_PS of determining means 520, namely the pulse bandwidth of a pulse wave in sequence of calculation code is started, during namely meaning calculates the high levels of pulse wave, in the NEC code of standard, pulse bandwidth is 0.56 millisecond, therefore determining means 520 can calculate the sample period value of 0.56 millisecond.But, infra-red remote control instruction may be interfered in transport process, and make the pulse wave of telecommand sequence code produce distortion, now, determining means 520 still can calculate the pulse bandwidth after distortion, and is used as sample period S_P with this pulse bandwidth, therefore, determining means of the present invention accurately can calculate the pulse bandwidth of received telecommand sequence code reality, and sample period when this pulse bandwidth being used as decoding.
Decoding unit 530 is the binary value comprised for coding sequence code, when after the notice signal INIT_PS that decoding unit 530 receives from detecting unit, namely the sample period S_P calculated with determining means carrys out the sequence code that decoding receives, in one embodiment, decoding unit 530 be according to sample period S_P detect interval in sequence code between every two pulse waves the sample period number of process, with the binary value of identification corresponding to it, decoding unit 530 can by the falling edge of a data pulse wave in detecting sequence code to adjacent pulse wave waveform rising edge between the sample period number of process, or the rising edge of detecting one data pulse wave to the rising edge of adjacent pulse wave or falling edge the sample period number of process carry out in identification sequence code representated by each pulse wave binary value.Please refer to the schematic diagram shown in Fig. 4 (a), it is be described for the data bit of NEC code, when between the waveform rising edge of the falling edge Zhi adjacent pulse wave that detect a data pulse wave the sample period number of process be less than 2 sample period S_P, this pulse wave represents binary " 0 ", on the other hand, as shown in Fig. 4 (b), when detected result is more than or equal to 2 sample period S_P, namely this pulse wave represents binary " 1 ".In addition, the sample period of decoding unit 530 foundations produced by the actual pulse bandwidth received, and therefore, no matter sequence code is have to produce distortion in transport process, and decoding unit 530 still can the sequence code that receives of correctly decoding.
The schematic diagram of one preferred embodiment of Fig. 6 system code translator of the present invention, in code translator 600, detecting unit 610 first detects the initial pulse wave of sequence code, when the pulse bandwidth detected is more than a default value, then judge that this pulse wave is as initial pulse wave, and notify decoding unit 630 and determining means 620 respectively with notification signal INIT_PS, carry out decoded operation to start decoding unit 830 pairs of sequence codes, and make determining means 620 produce a sample period according to sequence code and frequency signal.Determining means 620 comprises counter 621 and a latch unit 622, counter 621 is after the notice signal INIT_PS receiving detecting unit 610, namely the pulse bandwidth of first data pulse wave after initial pulse wave is calculated according to frenquency signal, during namely meaning calculates the high levels of data pulse waves the frequency number of process, and the frequency number finally calculated is supplied to latch unit 622, latch unit 622 can receive frequency number using as sample period S_P by breech lock, and sample period S_P is outputted to decoding unit 630, decoding unit 630 carries out decoding according to the data pulse wave of sample period S_P to sequence code, simultaneously, the place value that coding sequence code obtains can be kept in in mnemon 640 by decoding unit 630, after the decoding of a sequence code to be done, complete command value is exported again by mnemon 640.
In sum, the present invention utilizes the pulse bandwidth of the sequence code received to produce the sample period, and carries out decoding according to this sample period to sequence code, therefore can solve the problem of the sequence code of decoding distortion.
Although the present invention has utilized above-mentioned preferred embodiment to disclose in detail; so itself and be not used to limit the present invention, allly have the knack of this technology personage, without departing from the spirit and scope of the present invention; can carry out various change and amendment, therefore protection scope of the present invention is when being as the criterion with claim.