CN104424450A - Magnetic-card decoding method based on ADC pin sampling - Google Patents

Magnetic-card decoding method based on ADC pin sampling Download PDF

Info

Publication number
CN104424450A
CN104424450A CN201310364120.5A CN201310364120A CN104424450A CN 104424450 A CN104424450 A CN 104424450A CN 201310364120 A CN201310364120 A CN 201310364120A CN 104424450 A CN104424450 A CN 104424450A
Authority
CN
China
Prior art keywords
signal
adc
value
card
magnetic
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
Application number
CN201310364120.5A
Other languages
Chinese (zh)
Other versions
CN104424450B (en
Inventor
蒋声障
林志伟
周潮
陈成秋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Centerm Information Co Ltd
Original Assignee
Fujian Centerm Information Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Centerm Information Co Ltd filed Critical Fujian Centerm Information Co Ltd
Priority to CN201310364120.5A priority Critical patent/CN104424450B/en
Publication of CN104424450A publication Critical patent/CN104424450A/en
Application granted granted Critical
Publication of CN104424450B publication Critical patent/CN104424450B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a magnetic-card decoding method based on ADC pin sampling. Only one level of amplification circuit is adopted on the hardware and at the same time, acquisition of signals (called simulation signals) behind the one level of amplification circuit is carried out on the software through adoption of the ADC. During ADC signal acquisition, a problem of compatibility of strong and weak signal magnetic cards is considered to appropriately adjust the parameters of the one level of amplification circuit so as to enable the weak signal magnetic card to meet an ADC signal acquisition precision demand, that is, weak magnetic card signals can be normally identified and then the strong magnetic card signals may have a cut-off distortion problem and a wave crest detection module is used to judge cut-off distortion, that is, a distortion threshold line is used and a midpoint of a distortion part is used as a signal peak value so that the peak value error of distorted signals and practical signals is comparatively small; and the acquired magnetic channel data is comparatively accurate and finally, through a signal data decoding module, decoding of magnetic channel data is completed. The method reduces hardware cost and improves compatibility of processing of strong and weak magnetic card signals at the same time so that the method is wider in utility range.

Description

A kind of magnetic card coding/decoding method based on the sampling of ADC pin
Technical field
The present invention relates to a kind of technical field of communication equipment, particularly relate to a kind of magnetic card coding/decoding method based on the sampling of ADC pin.
Background technology
Two kinds of methods common at present in magnetic card decoding field are: first is the hardware decode method using magnetic card decoding chip, and the deficiency of the method is that hardware decode chip is expensive, and namely cost is very high; Second is that magnetic card feeble signal on hardware obtains easily by the strong signal of the I/O port identification of CPU (this signal is digital signal) by two-stage amplifying circuit through whole wave circuit, carry out software algorithm coding/decoding method again through software collection data simultaneously, the method has than hardware decode method and significantly reduces on cost, but cost is still higher; Present patent application file proposes new software decode method, and cost is reduced further.Meanwhile, the signal of different magnetic card may exist power point, namely or weak signal is probably misunderstood code or does not decode in two kinds of common at present methods, be difficult to accomplish compatibility to strong and weak magnetic card, or enlargement factor obtains larger, makes cost higher.
Summary of the invention
The technical problem to be solved in the present invention, be to provide a kind of magnetic card coding/decoding method based on the sampling of ADC pin, reduce hardware cost, improve the compatibility processed strong, weak magnetic card signal, usage range is wider simultaneously.
The present invention is achieved in that a kind of magnetic card coding/decoding method based on the sampling of ADC pin, described method need provide one-level amplifying circuit and CPU, and on described CPU, foundation has the quiet wire module of a reading, magnetic card swipe judge module, crest detection module, judges whether signal of swiping the card terminates module, signal data decoder module and decoded result output module;
Described method comprises the steps:
Step 10, card reader to be connected with the ADC pin of CPU by one-level amplifying circuit, under the state that magnetic card is not swiped the card, read ADC value corresponding to multiple magnetic card magnetic track signal continuously by reading quiet wire module, described ADC value is signal value residing under the ADC pin of CPU; Obtain the mean value of multiple ADC value, voltage corresponding to this mean value is as quiet line;
Step 20, execution magnetic card swipe judge module, magnetic card swipe judge module reads the ADC value of the ADC pin of CPU, if ADC value is in outside the voltage threshold band of quiet line, then indicate and swipe the card, enter step 30, if ADC value is within the voltage threshold band of quiet line, then represents and do not swipe the card, continue the ADC pin reading magnetic track; The voltage threshold band of described quiet line is the scope between positive signal threshold line and negative signal threshold line; Described positive signal threshold line is the voltage of the noise voltage maximal value+1mv of magnetic track signal when not swiping the card, and described negative signal threshold line is the voltage of the noise voltage minimum value-1mv of magnetic track signal when not swiping the card;
Step 30, execution crest detection module, described crest detection module definition has a timer, and when the ADC value that each signal of reading magnetic track is corresponding, the equal correspondence of this timer has a timer count value; Crest detection module judges that the signal of ADC pin is positive signal or negative signal, during for positive signal, in positive signal, obtain crest, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as crest, and the timer count value that the ADC value obtaining crest is corresponding; During for negative signal, in negative signal, obtain trough, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as trough, and the timer count value that the ADC value obtaining trough is corresponding; Described positive signal is: be positioned at the ADC value that any level on described quiet line is corresponding; Negative signal is: be positioned at the ADC value that any level under described quiet line is corresponding;
Step 40, perform judgement signal of swiping the card and whether terminate module, by judging to swipe the card, whether the time period obtaining signal is greater than the time threshold preset, and is that signal ended of then swiping the card, enters step 50; No, then continue to perform crest detection module, namely get back to step 30;
Step 50, executive signal data decode module, signal data decoder module, according to the timer count value got in step 30, is decoded to the magnetic track signal data gathered by magnetic track decoding algorithm;
Step 60, execution decoded result output module, carry out output display by decoded result.
Tool of the present invention has the following advantages: the present invention is by simplifying hardware circuit, and obtain more accurate weak magnetic card signal by ADC sampling, data acquisition is carried out with the crest detection algorithm of design and signal distortion error disposal route, obtain the raw data can carrying out track data decoding, present invention reduces hardware cost, improve the compatibility that strong, weak magnetic card signal is processed simultaneously, make usage range wider.
Accompanying drawing explanation
Fig. 1 is the inventive method schematic flow sheet.
Fig. 2 is the fluctuation schematic diagram of signal in magnetic track signal of the present invention.
Embodiment
Refer to shown in Fig. 1 and Fig. 2, the present invention is a kind of magnetic card coding/decoding method based on the sampling of ADC pin, described method need provide one-level amplifying circuit and CPU, and on described CPU, foundation has the quiet wire module of a reading, magnetic card swipe judge module, crest detection module, judges whether signal of swiping the card terminates module, signal data decoder module and decoded result output module;
Described method comprises the steps:
Step 10, card reader to be connected with the ADC pin of CPU by one-level amplifying circuit, under the state that magnetic card is not swiped the card, read ADC value corresponding to multiple magnetic card magnetic track signal continuously by reading quiet wire module, described ADC value is signal value residing under the ADC pin of CPU; Obtain the mean value of multiple ADC value, voltage corresponding to this mean value is as quiet line;
Step 20, execution magnetic card swipe judge module, magnetic card swipe judge module reads the ADC value of the ADC pin of CPU, if ADC value is in outside the voltage threshold band of quiet line, then indicate and swipe the card, enter step 30, if ADC value is within the voltage threshold band of quiet line, then represents and do not swipe the card, continue the ADC pin reading magnetic track; The voltage threshold band of described quiet line is the scope between positive signal threshold line and negative signal threshold line; Described positive signal threshold line is the voltage of the noise voltage maximal value+1mv of magnetic track signal when not swiping the card, and described negative signal threshold line is the voltage of the noise voltage minimum value-1mv of magnetic track signal when not swiping the card;
Step 30, execution crest detection module, this crest detection module detects and comprises the crest of wave crest and the crest of trough; Described crest detection module definition has a timer, and when the ADC value that each signal of reading magnetic track is corresponding, the equal correspondence of this timer has a timer count value; Crest detection module judges that the signal of ADC pin is positive signal or negative signal, during for positive signal, in positive signal, obtain crest, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as crest, and the timer count value that the ADC value obtaining crest is corresponding; During for negative signal, in negative signal, obtain trough, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as trough, and the timer count value that the ADC value obtaining trough is corresponding; Described positive signal is: be positioned at the ADC value that any level on described quiet line is corresponding; Negative signal is: be positioned at the ADC value that any level under described quiet line is corresponding;
Step 40, perform judgement signal of swiping the card and whether terminate module, by judging to swipe the card, whether the time period obtaining signal is greater than the time threshold preset, and is that signal ended of then swiping the card, enters step 50; No, no, then continue to perform crest detection module, namely get back to step 30; This time threshold preset is: according to the difference of sampling rate, and this value is different, can carry out being converted into how many times sampling, using the number of times of conversion as time threshold according to the time of 5ms;
Step 50, executive signal data decode module, signal data decoder module, according to the timer count value got in step 30 (namely obtaining the timer count value of the timer count value of the crest ADC value correspondence of crest testing result and the ADC value correspondence of trough), is decoded to the magnetic track signal data gathered by magnetic track decoding algorithm (this magnetic track decoding algorithm is that existing magnetic track decoding algorithm is not just described in detail at this);
Step 60, execution decoded result output module, carry out output display by decoded result; Further: decoded result exports, when decoding unsuccessfully, then export failure information, during successfully decoded, then export track data and track data length.
In the present invention, operation of once swiping the card has several peak values; In described step 30, during for positive signal, in positive signal, obtain crest, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as crest, and the timer count value that the ADC value obtaining crest is corresponding; Be specially: stop reading ADC value when the time threshold preset described in the ADC value of the magnetic track signal read is less than negative signal threshold line or the time period of acquisition signal of swiping the card is greater than; If the ADC value that reads exists one of them when being more than or equal to positive distortion threshold line, the timer count value of getting this ADC value correspondence is updated in a peak counter values variable; Namely the timer count value that will obtain in described step 50 obtains from peak counter values variable; Or when if the ADC value that reads exists that wherein two or more are more than or equal to positive distortion threshold line, get first and be more than or equal to timer count value corresponding to the ADC value of positive distortion threshold line with last, and be updated in described peak counter values variable after value that two timer count values are averaged; Otherwise in other situations, the timer count value of getting maximum ADC value (if there is multiple maximal value, then getting first) corresponding is updated in described peak counter values variable.
In shown step 30, during for negative signal, in negative signal, obtain trough, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as trough, and the timer count value that the ADC value obtaining trough is corresponding; Be specially: stop reading ADC value when the time threshold preset described in the ADC value of the magnetic track signal read is greater than positive signal threshold line or the time period of acquisition signal of swiping the card is greater than; If the ADC value that reads exists one of them when being less than or equal to negative distortion threshold line, the timer count value of getting this ADC value correspondence is updated in a peak counter values variable; Namely the timer count value that will obtain in described step 50 obtains from peak counter values variable; Or when if the ADC value that reads exists that wherein two or more are less than or equal to positive distortion threshold line, get first and be less than or equal to timer count value corresponding to the ADC value of positive distortion threshold line with last, and be updated in described peak counter values variable after value that two timer count values are averaged; Otherwise in other situations, the timer count value of getting minimum ADC value (if there is multiple maximal value, then getting first) corresponding is updated in described peak counter values variable.
In a word, present invention reduces hardware cost, improve the compatibility that strong, weak magnetic card signal is processed simultaneously, make usage range wider.
The foregoing is only preferred embodiment of the present invention, all equalizations done according to the present patent application the scope of the claims change and modify, and all should belong to covering scope of the present invention.

Claims (4)

1. the magnetic card coding/decoding method based on the sampling of ADC pin, it is characterized in that: described method need provide one-level amplifying circuit and CPU, on described CPU, foundation has the quiet wire module of a reading, magnetic card swipe judge module, crest detection module, judges whether signal of swiping the card terminates module, signal data decoder module and decoded result output module;
Described method comprises the steps:
Step 10, card reader to be connected with the ADC pin of CPU by one-level amplifying circuit, under the state that magnetic card is not swiped the card, read ADC value corresponding to multiple magnetic card magnetic track signal continuously by reading quiet wire module, described ADC value is signal value residing under the ADC pin of CPU; Obtain the mean value of multiple ADC value, voltage corresponding to this mean value is as quiet line;
Step 20, execution magnetic card swipe judge module, magnetic card swipe judge module reads the ADC value of the ADC pin of CPU, if ADC value is in outside the voltage threshold band of quiet line, then indicate and swipe the card, enter step 30, if ADC value is within the voltage threshold band of quiet line, then represents and do not swipe the card, continue the ADC pin reading magnetic track; The voltage threshold band of described quiet line is the scope between positive signal threshold line and negative signal threshold line; Described positive signal threshold line is the voltage of the noise voltage maximal value+1mv of magnetic track signal when not swiping the card, and described negative signal threshold line is the voltage of the noise voltage minimum value-1mv of magnetic track signal when not swiping the card;
Step 30, execution crest detection module, described crest detection module definition has a timer, and when the ADC value that each signal of reading magnetic track is corresponding, the equal correspondence of this timer has a timer count value; Crest detection module judges that the signal of ADC pin is positive signal or negative signal, during for positive signal, in positive signal, obtain crest, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as crest, and the timer count value that the ADC value obtaining crest is corresponding; During for negative signal, in negative signal, obtain trough, if when signal exists cutoff distortion, get the mid point of cutoff distortion part as trough, and the timer count value that the ADC value obtaining trough is corresponding; Described positive signal is: be positioned at the ADC value that any level on described quiet line is corresponding; Negative signal is: be positioned at the ADC value that any level under described quiet line is corresponding;
Step 40, perform judgement signal of swiping the card and whether terminate module, by judging to swipe the card, whether the time period obtaining signal is greater than the time threshold preset, and is that signal ended of then swiping the card, enters step 50; No, then continue to perform crest detection module, namely get back to step 30;
Step 50, executive signal data decode module, signal data decoder module, according to the timer count value got in step 30, is decoded to the magnetic track signal data gathered by magnetic track decoding algorithm;
Step 60, execution decoded result output module, carry out output display by decoded result.
2. a kind of magnetic card coding/decoding method based on the sampling of ADC pin according to claim 1, it is characterized in that: described step 60 comprises further: decoded result exports, when decoding unsuccessfully, then export failure information, during successfully decoded, then export track data and track data length.
3. a kind of magnetic card coding/decoding method based on the sampling of ADC pin according to claim 1, it is characterized in that: in shown step 30, during for positive signal, crest is obtained in positive signal, if there is cutoff distortion, get the mid point of cutoff distortion part as crest, and the timer count value that the ADC value obtaining crest is corresponding; Be specially: stop reading ADC value when the time threshold preset described in the ADC value of the magnetic track signal read is less than negative signal threshold line or the time period of acquisition signal of swiping the card is greater than; If the ADC value that reads exists one of them when being more than or equal to positive distortion threshold line, the timer count value of getting this ADC value correspondence is updated in a peak counter values variable; Namely the timer count value that will obtain in described step 50 obtains from peak counter values variable; Or when if the ADC value that reads exists that wherein two or more are more than or equal to positive distortion threshold line, get first and be more than or equal to timer count value corresponding to the ADC value of positive distortion threshold line with last, and be updated in described peak counter values variable after value that two timer count values are averaged; Otherwise in other situations, the timer count value of getting maximum ADC value corresponding is updated in described peak counter values variable.
4. a kind of magnetic card coding/decoding method based on the sampling of ADC pin according to claim 1, is characterized in that: in shown step 30, during for negative signal, in negative signal, obtains trough, and the timer count value that the ADC value obtaining trough is corresponding; Be specially: stop reading ADC value when the time threshold preset described in the ADC value of the magnetic track signal read is greater than positive signal threshold line or the time period of acquisition signal of swiping the card is greater than; If the ADC value that reads exists one of them when being less than or equal to negative distortion threshold line, the timer count value of getting this ADC value correspondence is updated in a peak counter values variable; Namely the timer count value that will obtain in described step 50 obtains from peak counter values variable; Or when if the ADC value that reads exists that wherein two or more are less than or equal to positive distortion threshold line, get first and be less than or equal to timer count value corresponding to the ADC value of positive distortion threshold line with last, and be updated in described peak counter values variable after value that two timer count values are averaged; Otherwise in other situations, the timer count value of getting minimum ADC value corresponding is updated in described peak counter values variable.
CN201310364120.5A 2013-08-19 2013-08-19 Magnetic-card decoding method based on ADC pin sampling Active CN104424450B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310364120.5A CN104424450B (en) 2013-08-19 2013-08-19 Magnetic-card decoding method based on ADC pin sampling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310364120.5A CN104424450B (en) 2013-08-19 2013-08-19 Magnetic-card decoding method based on ADC pin sampling

Publications (2)

Publication Number Publication Date
CN104424450A true CN104424450A (en) 2015-03-18
CN104424450B CN104424450B (en) 2017-05-17

Family

ID=52973373

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310364120.5A Active CN104424450B (en) 2013-08-19 2013-08-19 Magnetic-card decoding method based on ADC pin sampling

Country Status (1)

Country Link
CN (1) CN104424450B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107944314A (en) * 2017-12-14 2018-04-20 苏州国芯科技有限公司 A kind of magnetic stripe coding/decoding method and system
CN114826276A (en) * 2022-06-29 2022-07-29 青岛鼎信通讯股份有限公司 Manchester decoding method and device and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101673336A (en) * 2008-09-12 2010-03-17 晨星软件研发(深圳)有限公司 Decoding device and decoding method
US20130126613A1 (en) * 2011-11-23 2013-05-23 Uniform Industrial Corp. System and method for testing magnetic stripe decoding chip
CN102982294B (en) * 2011-09-05 2015-12-02 国民技术股份有限公司 A kind of collision detection method utilizing magnetic two-way communication

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101673336A (en) * 2008-09-12 2010-03-17 晨星软件研发(深圳)有限公司 Decoding device and decoding method
CN102982294B (en) * 2011-09-05 2015-12-02 国民技术股份有限公司 A kind of collision detection method utilizing magnetic two-way communication
US20130126613A1 (en) * 2011-11-23 2013-05-23 Uniform Industrial Corp. System and method for testing magnetic stripe decoding chip

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107944314A (en) * 2017-12-14 2018-04-20 苏州国芯科技有限公司 A kind of magnetic stripe coding/decoding method and system
CN107944314B (en) * 2017-12-14 2021-04-13 苏州国芯科技股份有限公司 Magnetic stripe decoding method and system
CN114826276A (en) * 2022-06-29 2022-07-29 青岛鼎信通讯股份有限公司 Manchester decoding method and device and readable storage medium

Also Published As

Publication number Publication date
CN104424450B (en) 2017-05-17

Similar Documents

Publication Publication Date Title
CN103634263A (en) Continuous-phase frequency-shift keying digital demodulation device and demodulation method implemented by same
CN103023445B (en) A kind ofly to detect and the difference analogue fore device of transmission system for low frequency signal
CN104424450A (en) Magnetic-card decoding method based on ADC pin sampling
CN101673336B (en) Decoding device and decoding method
CN102420671A (en) Self-adaptive Turbo decoding iterations selection method
CN103023584B (en) A kind ofly to detect and the analog front-end device of transmission system for low frequency signal
CN105515753A (en) RFID (radio frequency identification) lead code detection method based on FPGA (Field-Programmable Gate Array)
CN114374411B (en) Low-frequency power line carrier topology identification method
CN102222211A (en) Magcard decoding method and magcard reading device
CN103595421A (en) A decoder for TYPE A basic data rate signals transmitted by a decoding card
CN109818713A (en) Miller code coding/decoding method, device and the equipment and storage medium of subcarrier modulation
US20150085616A1 (en) Wireless communication system and method thereof
CN102013874B (en) An amplifier output amplitude detection circuit
CN105718830A (en) Decoder and decoding method for UHF RFID reader-writer
CN112200037B (en) Weak signal detection method, terminal and computer readable storage medium
CN115347978A (en) Method, device and storage medium for identifying AIS frame header data
CN203799644U (en) Power grid frequency database-based audio evidence-taking device
CN106162485B (en) Earphone impedance detection system, method and portable electronic device
CN111262652B (en) Method and system for decoding FM0 code based on edge detection
CN103427803B (en) Based on the method for the filtering burr of synchronous circuit
CN107944314A (en) A kind of magnetic stripe coding/decoding method and system
CN1909428B (en) Standing-wave ratio alarm detecting device in GSM impellent system for enhancing data speed
CN115603666B (en) Device and method for demodulation and demodulation equipment
CN109802761B (en) Fault identification method and device
CN102255632B (en) Adaptive pulse position modulation signal demodulation method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant