CN102522996A - Decoding method and decoding device of FM0 coded data - Google Patents
Decoding method and decoding device of FM0 coded data Download PDFInfo
- Publication number
- CN102522996A CN102522996A CN2011104065482A CN201110406548A CN102522996A CN 102522996 A CN102522996 A CN 102522996A CN 2011104065482 A CN2011104065482 A CN 2011104065482A CN 201110406548 A CN201110406548 A CN 201110406548A CN 102522996 A CN102522996 A CN 102522996A
- Authority
- CN
- China
- Prior art keywords
- data
- value
- decoded
- threshold value
- timer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention discloses a decoding method and a decoding device of FM0 coded data, aiming to reduce demand on performances of hardware chips. The method comprises the steps of obtaining to-be-decoded data in a buffer memory area, wherein the to-be-decoded data are obtained by inputting waveforms for capturing and collecting the FM0 coded data by a timer; comparing the to-be-decoded data with threshold values; and determining decoded data according to comparison results.
Description
Technical field
The present invention relates to communication technical field, particularly a kind of coding/decoding method of FM0 coded data and device.
Background technology
Electronic charging system without parking (Electronic Toll Collection system, ETC system) adopts DSRC (Dedicated ShortRange Communication, DSRC) technology; Accomplish roadside unit (Roadside Unit; RSU) (On Board Unit, the two-way communication between OBU) are carried out safety certification and consumption is withholdd through wireless mode with board units; Realize non-parking charge; Accelerate vehicle pass-through speed greatly, reduced the congestion of charge ring road mouth, improved the transport power of highway.
All carry out the construction of ETC system at present throughout the country, in order to realize interconnecting of ETC equipment, RSU in the ETC system and OBU equipment must satisfy the specification requirement of GB GB/T20851-2007.GB/T20851.1-2007 has done clear and definite regulation to the physical layer of this professional junction service; On the coded system of communication; The domestic most equipment employing category-A FM0 of producer coding, the bit rate that RSU sends to OBU is 256kbit/s, the bit clock precision is ± 100 * 10
-5The bit rate that OBU sends to RSU is 512kbit/s, and the bit clock precision is ± 100 * 10
-6
Accomplish whole transaction flows at the volley, the time completion transaction that needs usefulness is the shortest in order to guarantee vehicle.The speed of therefore, data decode speed influences the length of whole exchange hour.
The full name of FM0 coding is two-phase space code coding, is characterized in a position window, adopting level to change and comes presentation logic.If the upset of the section start of level window, then presentation logic " 1 " from the position.If level is except the section start upset of window on the throne, window intermediate flipped also on the throne is presentation logic " 0 " then.Fig. 1 is the level waveform of data flow " 01100101 " behind the FM0 coding.
Can know that according to the FM0 coding rule duration in the cycle of the pulse that " 1 " is corresponding is greater than the duration in the cycle of " 0 " corresponding pulse.Therefore, in the decode procedure of FM0 coded data, measure the duration of each pulse period, will the time grow up be defined as " 1 ", with duration little be defined as " 0 " half, data " 0 " are merged in two half continuous " 0 ".For example: for the 256kbps speed data, the pulse period that is lasting duration 3.9us is defined as 1, and lasting duration is to be defined as half 0 the pulse period of 1.95us; For the 512kbps speed data, the pulse period that is lasting duration 1.95us is defined as 1, and lasting duration is to be defined as half 0 the pulse period of 0.977us.
At present, gather the duration of each pulse period in the FM0 coded data through the mode of timer counting, specifically comprise: the count value of a timer is promptly gathered in each hopping edge, is saved in corresponding register; Then current count value is deducted a last count value, can obtain the duration of current period.
Owing to need go image data in each hopping edge, for the FM0 coded data of 256kbps speed, timer can whenever collect data at a distance from 1.95us or 3.9us, and is saved in corresponding register to data; For 512Kbps speed FM0 coded data, timer can whenever collect data at a distance from 0.977us or 1.95us, is saved in data in the corresponding register.So; Data in the register of timer correspondence are understood 1.95us the soonest and are upgraded once when decoding 256kbps data, and when decoding 512kbps data; Understanding 0.977us the soonest upgrades once; This just needs microprocessor, and (Mirco Control Unit MCU) has enough fast speed, can before renewal, accomplish decoding.
The decode time of supposing MCU completion 1bit FM0 coded data needs 30 clock cycle; Get into to gather to interrupt reading and collect data 25 clock cycle of needs; Then real-time decoding 256kbps waveform theory needs the above MCU of dominant frequency 28M IPs (Instructions per second, the instruction number that per second is carried out) could realize real-time decoding; Real-time decoding 512kbps waveform, theoretical minimum need the above MCU of dominant frequency 56M IPs could realize real-time decoding.In the engineering practical application, the RF transceiver is not desirable transceiver all, before packet, a lot of clutters can occur behind the bag; Need MCU to handle; Want reliable decoding in true environment for use, need MCU to handle these and disturb, just needing more, the MCU of high primary frequency realizes.
For the 512kbps speed data, its Data Update is spaced apart 0.977us especially, and fast like this data rate has exceeded the disposal ability of single-chip microcomputer, therefore, needs to use FPGA or two-forty chip to gather decoding FM0 coded data.
During decoding FM0 coded data, most of resource of chip is used for image data, has only seldom that the part resource is used for decoding, and this provides a big buffer zone to preserve the data of collection with regard to requiring single-chip microcomputer, can not come out data decode in real time simultaneously; And,, need expensive more chip to realize gathering and decoding for 512kbps speed FM0 coded data.
Therefore, the frequency ratio of image data is very fast in the existing FM0 coded data decode procedure, and promptly Data Update is than very fast, to the performance requirement of hardware chip than higher.And once decoding can only be confirmed one " 1 " or half " 0 ", and like this, whole decode procedure is slow, and the decode rate of high performance hardware chip is not high yet.
Summary of the invention
The embodiment of the invention provides a kind of coding/decoding method and device of FM0 coded data, in order to reduce the performance demands to hardware chip.
The embodiment of the invention provides a kind of coding/decoding method of FM0 coded data, comprising:
Obtain the data to be decoded in the buffer area, wherein, said data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data;
Said data to be decoded and threshold value are compared, confirm decoded data according to comparative result.
The embodiment of the invention provides a kind of decoding device of FM0 coded data, comprising:
Acquiring unit is used for obtaining the data to be decoded of buffer area, and wherein, said data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data;
Decoding unit is used for said data to be decoded and threshold value are compared, and confirms decoded data according to comparative result.
In the embodiment of the invention; Obtain the data to be decoded in the buffer area, and said data to be decoded and threshold value are compared, confirm decoded data according to comparative result; Wherein, data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data.Owing to adopt the mode of timer input capture to obtain data to be decoded, like this, when only collecting the specific hopping edge of waveform of FM0 coded data; Just obtain data to be decoded; And be not all to obtain data to be decoded in each hopping edge of the waveform that collects the FM0 coded data, thereby, reduced the frequency of image data; Reduced performance requirement, further reduced the resources costs in the decode procedure hardware chip.
Description of drawings
Fig. 1 is the level waveform sketch map behind the FM0 coding in the prior art;
Fig. 2 is the block diagram of PWM input capture hardware in the embodiment of the invention one;
Fig. 3 is a PWM real work sequential chart in the embodiment of the invention one;
Fig. 4 is the flow chart of the decoding of FM0 coded data in the embodiment of the invention one;
Fig. 5 is the decoding process figure of first data to be decoded in the embodiment of the invention one;
Fig. 6 is a PWM input capture sequential chart in the specific embodiment of the invention one concrete the application;
Fig. 7 is the block diagram of PWM input capture hardware in the embodiment of the invention two;
Fig. 8 is a PWM real work sequential chart in the embodiment of the invention two;
Fig. 9 is the flow chart of the decoding of FM0 coded data in the embodiment of the invention two;
Figure 10 is the decoding process figure of first data to be decoded in the embodiment of the invention two;
Figure 11 is a PWM input capture sequential chart in the specific embodiment of the invention two concrete the application;
Figure 12 is the structure chart of the decoding device of FM0 coded data in the embodiment of the invention.
Embodiment
In the embodiment of the invention; In the process that the FM0 coded data is decoded; The waveform of gathering the FM0 coded data through the timer input capture obtains data to be decoded, then should data to be decoded and threshold value compare, confirm decoded data according to comparative result.Like this, when only collecting the specific hopping edge of waveform of FM0 coded data, just obtain data to be decoded, thereby, increased the cycle of gathering data to be decoded, reduced the frequency of image data, reduced performance requirement to hardware chip.
Timer has multiple input capture pattern in the embodiment of the invention, for example: single register input capture pattern, PWM input capture pattern.Like this, after timer is pre-configured certain input capture pattern, the waveform of FM0 coded data can be gathered, data to be decoded can be obtained through the input capture pattern of configuration.
Embodiment one; In the present embodiment, timer is single register input capture pattern, and this list register input capture pattern is an expansion of timer function; Corresponding with timer have only a register, and an input is set to rising edge or trailing edge detection port.Input capture hardware as shown in Figure 2, timer is with to catch register corresponding.Like this, outside waveform enters into MCU through CH2, arrives marginal detector at internal links.When CH2 detects corresponding edge, be saved in the value of timer automatically and catch in the register, and put interrupt flag bit, and at subsequently timer edge zero clearing timer.Interrupt if drive this timer, then get into interrupt function and handle at once.
Effective or the trailing edge of rising edge is effectively through being configured acquisition to MCU in single register input capture pattern; Therefore; Before the decoding of carrying out the FM0 coded data; Also need be configured, comprise: timer is configured to single register input capture pattern and according to the speed of FM0 coded data, and the frequency division of setting confirmed the count frequency of timer.Wherein, can be that first hopping edge or second hopping edge are effective with the catch register configuration corresponding with timer, interrupt enabling.Here, first hopping edge is rising edge or trailing edge.And second hopping edge is for falling edge or rising edge.Promptly first hopping edge is opposite with second hopping edge.
Generally in timer being configured to single register input capture mode process, can be with the clock source configuration-system clock of timer, and timer is configured to upwards counting, configuration timer input channel 2 be that single register is imported the input capture mode.And configure interrupt enables to comprise the configure interrupt vector.
After having accomplished the configuration to input capture through said process, input capture real work sequential can be referring to Fig. 3, and wherein, timer is single register input input capture pattern, and it is effective that passage 2 (CH2) is configured to rising edge, interrupts enabling.
In the time will catching waveform A point (rising edge), the CH2 passage triggers, and is saved in the value 0004 of timer and catches in the register, puts interrupt flag bit and triggers interruption, and in the D moment point that the timer counting changes, the timer zero clearing is promptly still since 0000.
When C point (rising edge), the CH2 passage triggers, and timer value 0004 is saved in catches in the register, puts interrupt flag bit and triggers interruption, in the F point that the timer counting changes, timer zero clearing.
Single register input capture, only the rising edge at waveform produces interruption, in interruption, the value of register is confirmed as data to be decoded, and is read in the buffer area, is used for decoding.For example: when the C point, produce and interrupt, the value 0004 of register is confirmed as data to be decoded, and be read in the buffer area.
After will obtaining data to be decoded and deposit in the buffer area through single register input capture pattern through interrupt mode, the process of the decoding of FM0 coded data referring to Fig. 4, being comprised:
Step 401: obtain the data to be decoded in the buffer area, wherein, these data to be decoded are to obtain through the waveform that the timer input capture is gathered the FM0 coded data.
Because data to be decoded deposit in the buffer area through interrupt mode, here, the data to be decoded that will obtain through the waveform of single register input capture type collection FM0 coded data are deposited into buffer area.Like this, when decoding, data to be decoded have been stored in the buffer area.
Here, can from buffer area, obtain data to be decoded according to the mode of first in first out.Certainly, also can from buffer area, obtain data to be decoded, like this, also need during data behind output decoder according to the order of setting according to other order.
Step 402: data to be decoded and the threshold value that will obtain compare, and confirm decoded data according to comparative result.
Owing to be that waveform through the said FM0 coded data of single register input capture type collection obtains data to be decoded; Like this; When only collecting rising edge or the trailing edge of waveform of FM0 coded data, just obtain data to be decoded, therefore; In the value of data to be decoded; Minimum value is corresponding to two half continuous " 0 " pairing durations, and maximum is corresponding to two continuous " 1 " pairing durations, between maximum and minimum value corresponding to one " 1 " and half " 0 " pairing duration.Therefore, during the present invention implements, earlier according to the value of data to be decoded whether in the minimum value scope, confirm that decoded data is two half continuous " 0 "; Then according to the value of data to be decoded whether in maximum range, confirm that decoding is according to being two continuous " 1 "; The number of times that in the threshold value space of forming by maximum and minimum value, occurs at last according to the value of data to be decoded confirm " 1 " data preceding still be that half " 0 " data is preceding.Detailed process comprises:
When the value of data to be decoded is less than or equal to first threshold, confirm that decoded data is one 0; When the value of data to be decoded during, confirm that decoded data is two 1 more than or equal to second threshold value; When the value of data to be decoded is between the first threshold and second threshold value, according to the number of times that the value of data to be decoded occurs in the threshold value space of being made up of the first threshold and second threshold value, confirm in the decoded data " 1 " data in preceding still " 0 " data preceding.Wherein,
In the embodiment of the invention, first threshold is set at two durations that half continuous " 0 " is corresponding, wrong redundant for providing one, and increase certain error, for example, increase by 10% or 5% error; With second threshold setting is two durations that continuous " 1 " is corresponding, and reduces certain error, for example, reduces by 10% or 5% error.
The concrete decode procedure of each data to be decoded can comprise referring to Fig. 5:
Step 501: whether the value of judging data to be decoded is less than or equal to first threshold, if confirm that decoded data is one 0; Otherwise, execution in step 502.
Step 502: whether the value of judging data to be decoded is more than or equal to second threshold value, if confirm that decoded data is two 1; Otherwise, execution in step 503.
Step 503: the number of times that the value of data to be decoded is occurred in the threshold value space of being made up of the first threshold and second threshold value adds 1, the number of times after obtaining to upgrade.
In carrying out decode procedure, a variable can be set, the number of times that in the threshold value space of forming by the first threshold and second threshold value, occurs in order to the value that writes down data to be decoded.Before decoding, the value of this variable is zero, and the value of data to be decoded whenever occurs once in the threshold value space of being made up of the first threshold and second threshold value then, and just the value with this variable adds 1.
Like this, when decoding first, the number of times that the value of these data to be decoded occurs in the threshold value space of being made up of the first threshold and second threshold value is zero.Along with decoding one by one, the number of times that the value of data to be decoded occurs in the threshold value space of being made up of the first threshold and second threshold value can increase.After all decodings finish, can be with this variable zero clearing, be about to the number of times that the value of these data to be decoded occurs and can be reset to zero in the threshold value space of being made up of first threshold and second threshold value.
Step 504: after judge upgrading to number of times whether be odd number, if confirm that decoded data is 1 to add half 0; Otherwise, confirm that decoded data is to add 1 half 0.
Certainly, step 501 can be exchanged with 502 sequencings, and whether the value that can judge data to be decoded earlier judges whether the value of data to be decoded is less than or equal to first threshold more than or equal to second threshold value again, and detailed process is just no longer tired have been stated.
In one of present embodiment concrete the application, the speed of FM0 coded data is 256kbps when being configured, and the timer clock source is a system clock; The frequency division of clock is 32; Like this, be configured to input capture trailing edge pattern, the count frequency of timer is 256*32*2=16384khz.
Input capture trailing edge sequential chart is as shown in Figure 6, and the waveform of input capture FM0 coded data has 4 kinds of situation, is respectively A, B, D and F, and here, C, E are identical with A.
Because the data of catching have three kinds of length, and, suppose that the timer count frequency is 8192KHz, decoding 256kbps speed FM0 coding, then:
A section count value is 64;
B section count value is 128;
C section count value is 64;
D section count value is 96;
E section count value is 64;
F section count value is 96.
Therefore, in the present embodiment, first threshold is confirmed as 64* (1+10%)=70, with second threshold value confirm as 128* (1-10%)=115 so every section decode procedure comprise:
Count value C2=64<70, promptly corresponding decoded data be two continuous half 0.
Count value C2=128>115, promptly corresponding decoded data are two continuous 1.
Count value C2=64<70,, promptly corresponding decoded data be two continuous half 0.
Count value C2=96, because 70<C2=96<115, occurrence number is 1, is odd number, promptly corresponding decoded data is 1 to add half 0.
Count value C2==64<70, promptly corresponding decoded data be two continuous half 0.
Count value C2C2=96, because 70<C2=96<115, occurrence number is 2, is even number, promptly corresponding decoded data is to add 1 half 0.
Two continuous half 0, be one 0, thereby obtaining decoded data is " 01101001 ".
In the above-described embodiments, trailing edge interrupt enabling, but the embodiment of the invention is not limited thereto along effectively, also can rising edge is effective along being configured to, interrupt enabling, and specifically use no longer tired having stated.
In embodiment two, the present embodiment, timer is PWM (Pulse Width Modulation, a pulse width modulation) input capture pattern.
The PWM input capture pattern of MCU is an expansion of the different input captures of timer, and same input is mapped to two hopping edge detection port of timer, i.e. corresponding two registers of timer.PWM input capture hardware as shown in Figure 7, outside waveform enters into MCU through CH2, at the hopping edge detector of internal links to CH1 and CH2.CH1 is opposite with CH2 hopping edge detector polarity, when CH1 hopping edge detector detects corresponding hopping edge, is saved in the value of timer automatically in the CC1 register; When CH2 detects corresponding hopping edge, be saved in the value of timer automatically in the CC2 register, and put interrupt flag bit, and at subsequently timer hopping edge zero clearing timer.Interrupt if drive this timer, then get into interrupt function and handle at once.
PWM input capture pattern is through being configured acquisition to the MCU timer, therefore, and before the decoding of carrying out the FM0 coded data; Also need be configured, comprise: timer is configured to PWM input capture pattern, and according to the speed of FM0 coded data; And the frequency division of setting is confirmed the count frequency of timer; Wherein, be that second hopping edge is effective with second register configuration corresponding with timer, interrupt enabling; And be that first hopping edge is effective with first register configuration corresponding with timer.
Generally in timer being configured to PWM input capture mode process, with the clock source configuration-system clock of timer, and timer is configured to upwards counting, configuration timer input channel 1 and 2 is a PWM input capture mode.
And configurating terminal enables to comprise the configure interrupt vector.
After having accomplished the configuration to the PWM input capture through said process, PWM real work sequential can be referring to Fig. 8, and wherein, timer is a PWM input capture pattern, and it is effective that passage 2 (CH2) is configured to rising edge, interrupts enabling.
In the time will catching waveform A point (rising edge), the CH2 passage triggers, and is saved in the value 0004 of timer in the CC2 register, puts interrupt flag bit and triggers interruption, and in the D moment point that the timer counting changes, the timer zero clearing is promptly still since 0000.
When B point (trailing edge), the CH1 passage triggers, and timer value 0002 is saved in the CC1 register;
When C point (rising edge), the CH2 passage triggers, and timer value 0004 is saved in the CC2 register, puts interrupt flag bit and triggers interruption, in the F point that the timer counting changes, timer zero clearing.
During the PWM input capture, only the rising edge at waveform produces interruption, in interruption, simultaneously the value of CC1 and CC2 is confirmed as data to be decoded, and is read in the buffer area, is used for decoding.For example: when the C point, produce to interrupt, simultaneously with the value 0002 of CC1, and the value 0004 of CC2 confirms as data to be decoded, and is read in the buffer area.
This shows; The process that the waveform that PWM input capture mode is gathered the FM0 coded data obtains data to be decoded comprises: when collecting in the waveform of FM0 coded data second hopping edge through the PWM input capture; With first value of first register, and second value of second register confirms as data to be decoded, and is read in the buffer area; Wherein, The value of first register is the value in the timer when collecting first hopping edge in the waveform of FM0 coded data through the PWM input capture, and the value of second register is the value in the timer when collecting second hopping edge in the waveform of FM0 coded data through the PWM input capture, and second hopping edge is opposite with first hopping edge.
After depositing in data to be decoded in the buffer area through interrupt mode, the process of the decoding of FM0 coded data referring to Fig. 9, being comprised:
Step 901: obtain the data to be decoded in the buffer area, wherein, these data to be decoded are to obtain through the waveform that the PWM input capture is gathered the FM0 coded data.
Because data to be decoded deposit in the buffer area through interrupt mode, be about to gather the data to be decoded that the waveform of FM0 coded data obtains and be deposited into buffer area through the PWM input capture.Like this, when decoding, data to be decoded have been stored in the buffer area.
Here, can from buffer area, obtain data to be decoded according to the mode of first in first out.Certainly, also can from buffer area, obtain data to be decoded, like this, also need during data behind output decoder according to the order of setting according to other order.
Step 902: data to be decoded and the threshold value that will obtain compare, and confirm decoded data according to comparative result.
Owing to be to obtain data to be decoded through the waveform that the PWM input capture is gathered said FM0 coded data; Like this; When only collecting the specific hopping edge of waveform of FM0 coded data, just obtain data to be decoded, therefore; Minimum value in the data to be decoded in second of second register value should be corresponding to the corresponding durations in two continuous half " 0 ", and the maximum in second value should be corresponding to two durations that continuous " 1 " is corresponding.And maximum in first of first register value should be corresponding to half " 0 " corresponding duration in the data to be decoded, and the maximum in first value should be corresponding to one " 1 " corresponding duration.Therefore, during the present invention implements, confirm decoded data according to second value earlier,, confirm decoded data according to first value again if can not confirm decoded data according to second value.Detailed process comprises:
When second value of second register in the data to be decoded is less than or equal to the 3rd threshold value, confirm that decoded data is one 0; When second is worth more than or equal to the 4th threshold value, confirm that decoded data is two 1; When second value between the 3rd threshold value and the 4th threshold value the time, first value and the 5th threshold value of first register in the data to be decoded compared, confirm decoded data according to comparative result, wherein, the 5th threshold value is less than the 3rd threshold value, and the 3rd threshold value is less than the 4th threshold value.
Promptly earlier second value and the 3rd threshold value are compared,, then second value and the 4th threshold value are compared if can not determine decoded data according to comparative result; If it is can not determine decoded data, last according to comparative result; Confirm decoded data according to first value, be about to first value and the 5th threshold value and compare, confirm decoded data according to comparative result; Wherein, when first value during, confirm that decoded data is 1 to add half 0 greater than the 5th threshold value; When first value is less than or equal to the 5th threshold value, confirm that decoded data is to add 1 half 0.
In the embodiment of the invention, be two durations that half continuous " 0 " is corresponding with the 3rd threshold setting, wrong redundant for providing one, and increase certain error, for example, increase by 10% or 5% error; With the 4th threshold setting is two durations that continuous " 1 " is corresponding, and reduces certain error, for example, reduces by 10% or 5% error; Between half " 0 " corresponding duration duration corresponding, and can give the error of certain wrong redundancy correspondence with the 5th threshold setting with one " 1 ".This shows that in the present embodiment, the 3rd threshold value can equate that the 4th threshold value can equate with second threshold value among the embodiment one with the first threshold among the embodiment one.
The concrete decode procedure of each data to be decoded can comprise referring to Figure 10:
Step 1001: judge whether second value of second register is less than or equal to the 3rd threshold value in the data to be decoded, if confirm that decoded data is one 0; Otherwise, execution in step 1002.
Step 1002: whether second value of judging second register in the data to be decoded is more than or equal to the 4th threshold value, if confirm that decoded data is two 1; Otherwise, execution in step 1003.
Step 1003: whether first value of judging first register in the data to be decoded greater than the 5th threshold value, if confirm that decoded data is 1 to add half 0; Otherwise, confirm that decoded data is to add 1 half 0.
Certainly, step 1001 can be exchanged with 1002 sequencings, whether can judge second value earlier more than or equal to the 4th threshold value, judges whether second value is less than or equal to the 3rd threshold value again, and detailed process is just no longer tired have been stated.
In one of present embodiment concrete the application, the speed of FM0 coded data is 256kbps when being configured, and the timer clock source is a system clock; The frequency division of clock is 32; Like this, will be configured to PWM input capture pattern, the count frequency of timer is 256*32*2=16384khz.And configuration, second register corresponding with timer is that trailing edge is effective, the terminal enables, thus first register corresponding with timer is that rising edge is effective.
PWM input capture sequential chart is shown in figure 11, and the waveform of PWM input capture FM0 coded data has 4 kinds of situation, is respectively A, B, C and E, and here, D, F are identical with A.
The second value C2 value of second register has three kinds of situation, be respectively the A section C2, B section C2 and, the C2 of C or E section.The first value C1 value of first register has only two kinds, is respectively the C1 of A or E section, and, the C1 of B or C section.Get into when the PWM input capture is located at each trailing edge outward and interrupt, in interrupt routine, the value of CC1 and these two registers of CC2 is read in the buffer area as data to be decoded, decode according to these two values in the data to be decoded then.
Because the C2 segment data of catching has three kinds of length, the C1 segment data has two kinds of length, and, suppose that the timer count frequency is 8192KHz, decoding 256kbps speed FM0 coding, then:
G section C2 count value is 64, and the C1 count value is 32;
H section C2 count value is 128, and the C1 count value is 64;
I section C2 count value is 96, and the C1 count value is 64;
J section C2 count value is 64, and the C1 count value is 32;
K section C2 count value is 96, and the C1 count value is 32;
L section C2 count value is 64, and the C1 count value is 32.
Therefore, in the present embodiment, the 3rd threshold value is confirmed as 64* (1+10%)=70; The 4th threshold value is confirmed as 128* (1-10%)=115; The 5th threshold value is confirmed as 32* (1+10%)=35, and any number between the 64* (1-10%)=58, here; Can say that the 5th threshold value confirms as (32+64) ÷ 2=48, so every section decode procedure comprises:
C2=64<70, promptly corresponding decoded data be two continuous half 0.
C2=128>115, promptly corresponding decoded data are two continuous 1.
70<C2=96<115, C1=64>48, promptly corresponding decoded data is 1 to add half 0.
C2=64<70, promptly corresponding decoded data be two continuous half 0.
70<C2=96<115, C1=32<48, promptly corresponding decoded data is to add 1 half 0.
C2=64<70, promptly corresponding decoded data be two continuous half 0.
Two continuous half 0, be one 0, thereby obtaining decoded data is " 01110010 ".
In the above-described embodiments, second hopping edge is a trailing edge, but the embodiment of the invention is not limited thereto, and can second hopping edge be set at rising edge.
According to the coding/decoding method of above-mentioned FM0 coded data, can make up a kind of decoding device of FM0 coded data, referring to Figure 12, acquiring unit 100 and decoding unit 200, wherein,
Acquiring unit 100 is used for obtaining the data to be decoded of buffer area, and wherein, said data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data.
Decoding unit 200 is used for said data to be decoded and threshold value are compared, and confirms decoded data according to comparative result.
This acquiring unit 100; Be used for being configured to single register input capture pattern when timer; And through said single register input capture type collection in the waveform of said FM0 coded data when first hopping edge or second hopping edge; The value of catching in the timer that register obtains is confirmed as said data to be decoded, and be read in the said buffer area;
When timer is configured to PWM input capture pattern; And when collecting in the waveform of said FM0 coded data second hopping edge through the PWM input capture; With first value of first register, and second value of second register confirms as said data to be decoded, and is read in the said buffer area; Wherein, The value of said first register is the value in the timer when collecting first hopping edge in the waveform of said FM0 coded data through the PWM input capture, and the value of said second register is the value in the timer when collecting second hopping edge in the waveform of said FM0 coded data through the PWM input capture, and said second hopping edge is opposite with said first hopping edge.
This acquiring unit 100 also is used for said timer zero clearing.
When timer was configured to single register input capture pattern, decoding unit 200 specifically was used for:
When the value of said data to be decoded is less than or equal to first threshold, confirm that decoded data is one 0; When the value of said data to be decoded during, confirm that decoded data is two 1 more than or equal to second threshold value; When the value of said data to be decoded is between the first threshold and second threshold value; The number of times that in the threshold value space of forming by the first threshold and second threshold value, occurs according to the value of said data to be decoded; Confirm said decoded data, wherein, said first threshold is less than said second threshold value.
When the value of said data to be decoded was between the first threshold and second threshold value, this decoding unit 200 specifically was used for the value of said data to be decoded is added 1 at the number of times that the threshold value space of being made up of the first threshold and second threshold value occurs, the number of times after obtaining to upgrade; When the number of times after the said renewal is odd number time, confirm that decoded data is 1 to add half 0; When the number of times after the said renewal is even number time, confirm that decoded data is to add 1 half 0.
When timer was configured to PWM input capture pattern, decoding unit 200 specifically was used for:
When said second value is less than or equal to the 3rd threshold value, confirm that decoded data is one 0; When said second is worth more than or equal to the 4th threshold value, confirm that decoded data is two 1; When said second value is between the 3rd threshold value and the 4th threshold value, confirm decoded data according to said first value, wherein, said the 5th threshold value is less than said the 3rd threshold value, and said the 3rd threshold value is less than said the 4th threshold value.
When said second value between the 3rd threshold value and the 4th threshold value the time, this decoding unit 200 specifically is used for when said first value during greater than the 5th threshold value, confirms that decoded data is 1 to add half 0; When said first value is less than or equal to the 5th threshold value, confirm that decoded data is to add 1 half 0.
This device also comprises: dispensing unit, be used for said timer is configured to single register input capture pattern or PWM input capture pattern, and according to the speed of said FM0 coded data, and the frequency division of setting is confirmed the count frequency of said timer; Wherein, when said timer was configured to single register input capture pattern, the register configuration of catching that will be corresponding with said timer was that first hopping edge or second hopping edge are effective, interrupts enabling; When said timer is configured to PWM input capture pattern, be that second hopping edge is effective with second register configuration corresponding with said timer, interrupt enabling; And be that first hopping edge is effective with first register configuration corresponding with said timer.
The coding/decoding method of the FM0 coded data in the embodiment of the invention can be used for the system that utilizes the FM0 coded data to communicate, for example: among the ETC.Certainly, only be used to distinguish each title about said " first ", " second " before the title in the embodiment of the invention, wherein, the first, the second can change.
The embodiment of the invention also provides a kind of communication equipment, for example OBU, RSU etc., and this equipment comprises the decoding device of aforesaid FM0 coded data, the decoding device of the aforesaid FM0 coded data of this equipment utilization is decoded to the FM0 coded data.
In the embodiment of the invention; Obtain the data to be decoded in the buffer area, and said data to be decoded and threshold value are compared, confirm decoded data according to comparative result; Wherein, data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data.Owing to adopt the mode of the input capture of timer to obtain data to be decoded, like this, when only collecting the specific hopping edge of waveform of FM0 coded data; Just obtain data to be decoded; And be not all to obtain data to be decoded in each hopping edge of the waveform that collects the FM0 coded data, thereby, reduced the frequency of image data; Reduced performance requirement, further reduced the resources costs in the decode procedure hardware chip.Promptly use the decoding of PWM input capture, make and can use the same speed data of decoding relatively cheap chip, and use same chip, can decode more high speed data or more these data of fast decoding.
And, in the embodiment of the invention, treat decoded data decoding and once can decode two data, for example: two continuous 1, two continuous half 0, one 1 and half 0, or half 0 and one 1.Like this, improve decode rate, promptly used prior PWM input capture hardware can realize the waveform of decoding FM0 coded data at a high speed.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.
Claims (13)
1. the coding/decoding method of a FM0 coded data is characterized in that, comprising:
Obtain the data to be decoded in the buffer area, wherein, said data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data;
Said data to be decoded and threshold value are compared, confirm decoded data according to comparative result.
2. the method for claim 1 is characterized in that, the said waveform of gathering said FM0 coded data through the timer input capture obtains data to be decoded, comprising:
Through PWM input capture type collection in the waveform of said FM0 coded data during second hopping edge; First value with first register; And second value of second register is confirmed as said data to be decoded; And be read in the said buffer area, wherein, the value of said first register is the value in the timer when collecting first hopping edge in the waveform of said FM0 coded data through the PWM input capture; The value of said second register is the value in the timer when collecting second hopping edge in the waveform of said FM0 coded data through the PWM input capture, and said second hopping edge is opposite with said first hopping edge.
3. method as claimed in claim 2 is characterized in that, said be read in the said buffer area after, also comprise: with said timer zero clearing.
4. method as claimed in claim 2 is characterized in that, said data to be decoded and threshold value are compared, and confirms that according to comparative result decoded data comprises:
When said second value is less than or equal to the 3rd threshold value, confirm that decoded data is one 0;
When said second is worth more than or equal to the 4th threshold value, confirm that decoded data is two 1;
When said second value is between the 3rd threshold value and the 4th threshold value, said first value and the 5th threshold value are compared, confirm decoded data according to comparative result, wherein, said the 5th threshold value is less than said the 3rd threshold value, and said the 3rd threshold value is less than said the 4th threshold value.
5. method as claimed in claim 4 is characterized in that, said said first value and the 5th threshold value is compared, and confirms that according to comparative result decoded data comprises:
When said first value during, confirm that decoded data is 1 to add half 0 greater than the 5th threshold value;
When said first value is less than or equal to the 5th threshold value, confirm that decoded data is to add 1 half 0.
6. method as claimed in claim 2 is characterized in that, said obtain in the buffer area data to be decoded before, also comprise:
Said timer is configured to PWM input capture pattern, and according to the speed of said FM0 coded data, and the frequency division of setting is confirmed the count frequency of said timer;
With second register configuration corresponding with said timer is that second hopping edge is effective, interrupts enabling, and is that first hopping edge is effective with first register configuration corresponding with said timer.
7. the decoding device of a FM0 coded data is characterized in that, comprising:
Acquiring unit is used for obtaining the data to be decoded of buffer area, and wherein, said data to be decoded are to obtain through the waveform that the timer input capture is gathered said FM0 coded data;
Decoding unit is used for said data to be decoded and threshold value are compared, and confirms decoded data according to comparative result.
8. device as claimed in claim 7 is characterized in that, said acquiring unit specifically is used for:
Through PWM input capture type collection in the waveform of said FM0 coded data during second hopping edge; First value with first register; And second value of second register is confirmed as said data to be decoded; And be read in the said buffer area, wherein, the value of said first register is the value in the timer when collecting first hopping edge in the waveform of said FM0 coded data through the PWM input capture; The value of said second register is the value in the timer when collecting second hopping edge in the waveform of said FM0 coded data through the PWM input capture, and said second hopping edge is opposite with said first hopping edge.
9. device as claimed in claim 8 is characterized in that,
Said acquiring unit also is used for said timer zero clearing.
10. device as claimed in claim 8 is characterized in that, said decoding unit specifically is used for:
When said second value is less than or equal to the 3rd threshold value, confirm that decoded data is one 0; When said second is worth more than or equal to the 4th threshold value, confirm that decoded data is two 1; When said second value is between the 3rd threshold value and the 4th threshold value, said first value and the 5th threshold value are compared, confirm decoded data according to comparative result, wherein, said the 5th threshold value is less than said the 3rd threshold value, and said the 3rd threshold value is less than said the 4th threshold value.
11. device as claimed in claim 10 is characterized in that,
When said second value between the 3rd threshold value and the 4th threshold value the time, said decoding unit specifically is used for when said first value during greater than the 5th threshold value, confirms that decoded data is 1 to add half 0; When said first value is less than or equal to the 5th threshold value, confirm that decoded data is to add 1 half 0.
12. device as claimed in claim 8 is characterized in that, also comprises:
Dispensing unit is used for said timer is configured to PWM input capture pattern, and according to the speed of said FM0 coded data, and the frequency division of setting is confirmed the count frequency of said timer; With second register configuration corresponding with said timer is that second hopping edge is effective, interrupts enabling; And be that first hopping edge is effective with first register configuration corresponding with said timer.
13. a communication equipment is characterized in that, comprises the decoding device of the arbitrary described FM0 coded data of claim 7 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110406548.2A CN102522996B (en) | 2011-12-08 | 2011-12-08 | Decoding method and decoding device of FM0 coded data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110406548.2A CN102522996B (en) | 2011-12-08 | 2011-12-08 | Decoding method and decoding device of FM0 coded data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102522996A true CN102522996A (en) | 2012-06-27 |
CN102522996B CN102522996B (en) | 2015-07-01 |
Family
ID=46293810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110406548.2A Active CN102522996B (en) | 2011-12-08 | 2011-12-08 | Decoding method and decoding device of FM0 coded data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102522996B (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102522997A (en) * | 2011-12-08 | 2012-06-27 | 北京握奇数据***有限公司 | Method and device for decoding FM0 coded data |
CN102938197A (en) * | 2012-10-26 | 2013-02-20 | 合肥移瑞通信技术有限公司 | Method for decoding infrared remote control by means of input capture interrupt mode |
CN103731237A (en) * | 2012-12-07 | 2014-04-16 | 深圳市金溢科技有限公司 | Biphase-space-code-oriented decoding method, device, equipment and communication system |
CN104639176A (en) * | 2013-11-08 | 2015-05-20 | 上海华虹集成电路有限责任公司 | Asynchronous decoder and asynchronous decoding method for BMC (Biphase Mark Coding) signal |
CN105224481A (en) * | 2015-10-22 | 2016-01-06 | 福州瑞芯微电子股份有限公司 | PWM transmits the implementation of data in input mode |
CN106372553A (en) * | 2016-08-30 | 2017-02-01 | 成都九洲电子信息***股份有限公司 | Pipeline matrix algorithm based on GJB radio frequency identification technology |
CN106789517A (en) * | 2017-01-08 | 2017-05-31 | 易晓云 | CAN data link and its by turn loss arbitration method |
CN106921463A (en) * | 2015-12-28 | 2017-07-04 | 航天信息股份有限公司 | A kind of anti-interference coding/decoding method and system |
CN106921466A (en) * | 2015-12-25 | 2017-07-04 | 航天信息股份有限公司 | The method and apparatus decoded to FM0 codings |
CN106921462A (en) * | 2015-12-25 | 2017-07-04 | 航天信息股份有限公司 | The method and apparatus decoded to FM0 codings |
CN110138501A (en) * | 2018-02-08 | 2019-08-16 | 北京万集科技股份有限公司 | A kind of coding/decoding method and device of FM0 coding |
CN111327333A (en) * | 2020-03-02 | 2020-06-23 | 无锡华润矽科微电子有限公司 | Decoding circuit |
CN112633023A (en) * | 2020-12-18 | 2021-04-09 | 中国电子科技集团公司第五十四研究所 | Decoding method and device for national military standard RFID (radio frequency identification) tag |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4027267A (en) * | 1976-06-01 | 1977-05-31 | International Business Machines Corporation | Method of decoding data content of F2F and phase shift encoded data streams |
US5200980A (en) * | 1991-08-09 | 1993-04-06 | Memorex Telex N.V. | Digital bi phase data recovery system |
US5315299A (en) * | 1992-02-14 | 1994-05-24 | Nissan Motor Co., Ltd. | Multiplex data communicating apparatus applicable to automotive vehicle |
CN101223709A (en) * | 2005-07-14 | 2008-07-16 | 富士通株式会社 | Data decoding method, data decoder using the same |
CN101571906A (en) * | 2009-06-02 | 2009-11-04 | 北京大学深圳研究生院 | Decoder and decoding method of RFID receiver |
CN102522997A (en) * | 2011-12-08 | 2012-06-27 | 北京握奇数据***有限公司 | Method and device for decoding FM0 coded data |
-
2011
- 2011-12-08 CN CN201110406548.2A patent/CN102522996B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4027267A (en) * | 1976-06-01 | 1977-05-31 | International Business Machines Corporation | Method of decoding data content of F2F and phase shift encoded data streams |
US5200980A (en) * | 1991-08-09 | 1993-04-06 | Memorex Telex N.V. | Digital bi phase data recovery system |
US5315299A (en) * | 1992-02-14 | 1994-05-24 | Nissan Motor Co., Ltd. | Multiplex data communicating apparatus applicable to automotive vehicle |
CN101223709A (en) * | 2005-07-14 | 2008-07-16 | 富士通株式会社 | Data decoding method, data decoder using the same |
CN101571906A (en) * | 2009-06-02 | 2009-11-04 | 北京大学深圳研究生院 | Decoder and decoding method of RFID receiver |
CN102522997A (en) * | 2011-12-08 | 2012-06-27 | 北京握奇数据***有限公司 | Method and device for decoding FM0 coded data |
Cited By (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102522997A (en) * | 2011-12-08 | 2012-06-27 | 北京握奇数据***有限公司 | Method and device for decoding FM0 coded data |
CN102522997B (en) * | 2011-12-08 | 2015-09-02 | 北京握奇数据***有限公司 | The coding/decoding method of FM0 coded data and device |
CN102938197A (en) * | 2012-10-26 | 2013-02-20 | 合肥移瑞通信技术有限公司 | Method for decoding infrared remote control by means of input capture interrupt mode |
CN103731237A (en) * | 2012-12-07 | 2014-04-16 | 深圳市金溢科技有限公司 | Biphase-space-code-oriented decoding method, device, equipment and communication system |
CN103731237B (en) * | 2012-12-07 | 2017-03-15 | 深圳市金溢科技股份有限公司 | Coding/decoding method, device, equipment and communication system towards two-phase space code |
CN104639176A (en) * | 2013-11-08 | 2015-05-20 | 上海华虹集成电路有限责任公司 | Asynchronous decoder and asynchronous decoding method for BMC (Biphase Mark Coding) signal |
CN104639176B (en) * | 2013-11-08 | 2018-02-13 | 上海华虹集成电路有限责任公司 | The asynchronous decoder and method of BMC signals |
CN105224481A (en) * | 2015-10-22 | 2016-01-06 | 福州瑞芯微电子股份有限公司 | PWM transmits the implementation of data in input mode |
CN106921466A (en) * | 2015-12-25 | 2017-07-04 | 航天信息股份有限公司 | The method and apparatus decoded to FM0 codings |
CN106921462B (en) * | 2015-12-25 | 2019-11-29 | 航天信息股份有限公司 | The method and apparatus being decoded are encoded to FM0 |
CN106921462A (en) * | 2015-12-25 | 2017-07-04 | 航天信息股份有限公司 | The method and apparatus decoded to FM0 codings |
CN106921466B (en) * | 2015-12-25 | 2019-11-29 | 航天信息股份有限公司 | The method and apparatus being decoded are encoded to FM0 |
CN106921463B (en) * | 2015-12-28 | 2020-03-13 | 航天信息股份有限公司 | Anti-interference decoding method and system |
CN106921463A (en) * | 2015-12-28 | 2017-07-04 | 航天信息股份有限公司 | A kind of anti-interference coding/decoding method and system |
CN106372553A (en) * | 2016-08-30 | 2017-02-01 | 成都九洲电子信息***股份有限公司 | Pipeline matrix algorithm based on GJB radio frequency identification technology |
CN106372553B (en) * | 2016-08-30 | 2019-03-01 | 成都九洲电子信息***股份有限公司 | Flowing water matrix matching technique based on GJB Radio Frequency Identification Technology |
CN106789517A (en) * | 2017-01-08 | 2017-05-31 | 易晓云 | CAN data link and its by turn loss arbitration method |
CN110138501A (en) * | 2018-02-08 | 2019-08-16 | 北京万集科技股份有限公司 | A kind of coding/decoding method and device of FM0 coding |
CN110138501B (en) * | 2018-02-08 | 2021-09-24 | 北京万集科技股份有限公司 | Decoding method and device for FM0 codes |
CN111327333A (en) * | 2020-03-02 | 2020-06-23 | 无锡华润矽科微电子有限公司 | Decoding circuit |
CN111327333B (en) * | 2020-03-02 | 2023-07-18 | 华润微集成电路(无锡)有限公司 | Decoding circuit |
CN112633023A (en) * | 2020-12-18 | 2021-04-09 | 中国电子科技集团公司第五十四研究所 | Decoding method and device for national military standard RFID (radio frequency identification) tag |
Also Published As
Publication number | Publication date |
---|---|
CN102522996B (en) | 2015-07-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102522996A (en) | Decoding method and decoding device of FM0 coded data | |
CN102522997A (en) | Method and device for decoding FM0 coded data | |
CN103886756A (en) | Expressway network running status detection method based on OBU | |
CN103150177A (en) | Method, device and system for updating bus route data | |
CN102906800A (en) | System and method for modeling and optimizing the performance of transportation networks | |
CN105023428A (en) | Road condition information assessment method and apparatus | |
CN104158699A (en) | Data acquisition method based on priority and segmentation | |
CN104123757A (en) | Congestion charge method and system based on vehicle real-time location and road link matching | |
CN102509456B (en) | Saturation flow determination method and device | |
CN105318882B (en) | The method and device of point of interest binding road | |
CN109118297A (en) | Unmanned retailing vehicle launches control method, device, electronic equipment and storage medium | |
CN105227601A (en) | Data processing method in stream processing system, device and system | |
CN108023846A (en) | Detect method, circuit, equipment and the computer program product of fsk modulated signal | |
CN107566157A (en) | Remote diagnosis processing method of the ammeter completely without data fault under a kind of concentrator | |
CN103680110A (en) | All-track 16Kbps telemetering data multi-path downloading system | |
CN105578258A (en) | Method and device of video preprocessing and video playback | |
CN105070054A (en) | Multi-source traffic state discrimination method based on stream-oriented computation and time window dynamic optimization | |
CN103559282B (en) | The De-weight method and device of real-time system data | |
CN203165194U (en) | Near-real-time ultra-low power consumption wireless ad hoc network image pick-up direct reading gas meter reading system | |
CN205263528U (en) | Intelligent home control system | |
CN103886738A (en) | Mobile interment-based road traffic real-time road condition information analyzing and determination method | |
CN104952243A (en) | Method and device for allocating passage time lengths | |
CN108062858A (en) | A kind of combination historic task calculates the algorithm of E.T.A | |
CN104125600B (en) | The method for recognizing flux of mobile terminal and device | |
CN108563466A (en) | A kind of tracking flow processing method improving GPU utilization rates |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder |
Address after: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden Patentee after: Beijing Watchdata Limited by Share Ltd Address before: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden Patentee before: Beijing Woqi Data System Co., Ltd. |
|
CP01 | Change in the name or title of a patent holder |