Information in this document is subject to change without notice. No part of this document may
be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of MagTek, Inc.
MagTek is a registered trademark of MagTek, Inc.
REVISIONS
Rev Number Date Notes
1 22 Oct 99 Initial Release
2 12 Jun 00 Table of Contents corre cte d; Appendix A,
Applications Note, Character Conversion
99875065-2 replaced -1 as update.
DATA ......................................................................................................................................................10
The usual way to gather card data from a TTL (Transistor Transistor Logic) swipe magnetic card
reader is as follows:
1. Connect the strobe line to an interrupt port on the CPU tha t is programmed to interrupt on
the falling edge of the strobe.
2. Connect the data line to an ordinary CPU port pin.
3. Connect the card present line to another ordinary CPU port pin.
All three of the above signals are quiescently high (Vcc). When a card is swiped , the f i rst s ign al to
go low (active) is Card Present. It will go low after 14 to 15 head flux reversals have been read.
These initial strobes are not output on the strobe line. After Card Present goes low, the strobes are
output on the strobe line. Normally, storing data is not begun until the data line goes low (indicating
a one) and the strobe line falls. When this occurs, the CPU starts to store the data in RAM (Random
Access Memory) until the strobes stop because the card has cleared the head. Approximately
150ms later, Card Present returns to V
checks for parity errors and LRC (Longitudinal Redundancy Check or check sum) error. If no
errors are detected, the CPU outputs the data in some useful form, such as ASCII (American
Standard Code for Information Interchange) or Keyboard Scan Code.
There are two methods of storing data, one way is to put each character into its own byte in RAM.
The advantage of this method is that it is easy to debug the software. The disadvantages are that
some bits are not used (wasted) and the card can only be read in the forward direction. The second
method is to stor e all b its f rom the ca rd in to RAM (no unused bits). The only disadvantage to this
method is that it is difficult to debug your software code. The reason being, in the case of Track 2
(5 bits per character), the first byte of RAM has the first character (5 bits) and 3 bits of the second
character. The second byte of ram has 2 bits of the second character, 5 bits of the third character,
and 1 bit from the fourth character, etc. When using In-Circuit Emulation (ICE) to decode the data
in RAM, it is difficult to figure out what you have. Also, with both methods the data is read in
backwards (Least Sign ific ant Bit F irs t).
If you run out of interrupts, one way to create another interrupt is to set a counter to all one's. When
the strobe falls, the cou nter increm ents cau sing a counter interrupt which can be used to collect the
data bit and reset the counter to all one's again.
When this occurs, the CPU analyzes the data in RAM and
The following MagTek documents are included as appendices in this manual:
Appendix A. Character Conversion, P/N 99875065
Appendix B. Read IC 21006516 Spec Sheet, P/N 99821066
Appendix C. Magnetic Stripe Card Standards, P/N 99800004
Appendix D. Card Reader Interface, P/N 99875063
2
Section 1. Decoding Reader Output
TRACK 1 DATA FORMAT
The following is typical for Track 1 data.
The Track 1 data format includes the following items:
1. Approximately 62 leading clocking zeros
2. The Start Sentinel "%"
3. Up to 76 alphanumeric characters selected by the user
4. The end sentinel "?"
5. The LRC (longitudinal redundancy check character)
6. Trailing clocking zeros (minimum of 62) to the end of the card
Each data character is in a 7-bit (6 plus parity) alphanumeric format. The data is in the format
"parity, 32, 16, 8, 4, 2, 1". Parity is odd (an odd number of "one's" in each character).
The character is written "backwards" on the card starting with the least significant digit and
ending with the parity bit. The card data format is "1, 2, 4, 8, 16, 32, parity".
See Appendix C for ATM and credit card formats.
Example: The data message "AT3" is encoded on the card as follows:
1. "000..00" leading clocking zeros (approximately 62)
2. "1010001" the Start Sentinel "%" (1000101)
3. "1000011" the character "A"* (1100001)
4. "0010110" the character "T"* (0110100)
5. "1100100" the character "3" (0010011)
6. "1111100" the End Sentinel "?" (0011111)
7. "0011100" the character "<"** (0011100) the LRC (check digit)
8. "000..00" trailing clocking zeros (minimum of 62) to end of the card
*Use capital letters only.
**The character "<" is not defined by credit card standards but is a legitimate LRC character.
The binary values of all card data can be found in the MagTek publication, Application Note Character Conversion, Part Number 99875065, see Appendix A.
See Appendix C for ATM and Credit Card Formats.
3
I/O Interface for TTL Magnetic Stripe Readers
Calculating odd parity and LRC, for the message AT3:
P 32 16 8 4 2 1 Hex Value, Decimal Value
Less Parity Less Parity
Calculating odd parity: scan each horizontal row and enter a zero or one In the P column so that
each row has an odd number of one's.
To find the LRC: disregard the parity bits, scan up each vertical column, and make sure that each
column has an even number of one's in it. Enter a zero or one in the LRC position, so that it
does. If you are using a computer to calculate the LRC, use the "Exclusive OR" function. Next,
calculate odd parity for the LRC character, in the horizontal direction.
TRACKS 2 AND 3 DATA FORMAT
The following is typical for Track 2 and Track 3 data.
The Track 2 and 3 data formats include the following items:
1. Leading clocking zeros: Approximately 22 (Track 2) or 62 (Track 3)
2. The start sentinel (hexadecimal "B")
3. Up to 37 (track 2) or 104 (track 3) hexadecimal numeric characters selected by the user
4. The end sentinel (hexadecimal "F")
5. The LRC (longitudinal redundancy check character)
6. Trailing clocking zeros: A minimum of 22 (track 2) or 62 (track 3)
to the end of the card
Each data character is in a 5-bit (4 plus parity) numeric format. The data is in the format "parity,
8, 4, 2, 1". Parity is odd (an odd number of one's in each character).
The character is written "backwards" on the card starting with the least significant bit and ending
with the parity bit. The card data format Is "1, 2, 4, 8, parity".
Example: The data message "123" is encoded on the card as follows:
4
Section 1. Decoding Reader Output
1. "00.00" leading clocking zeros Approximately 22 (tk2) or 62 (tk3)
2. "11010" the character "hex B" (01011) the Start Sentinel
3. "10000" the character "1" (00001)
4. "01000" the character "2" (00010)
5. "11001" the character "3" (10011)
6. "11111" the character "hex F" (11111) the End Sentinel
7. "00100" the character "4" (00100) the LRC (check digit)
8. "00.00" trailing clocking zeros A minimum of 22 (Tk2) or 62 (tk3)
to the end of the card
Calculating odd parity and LRC for the message 123:
P 8 4 2 1 Hex Value Decimal Value
Less Parity Less Parity
Calculating odd parity: scan each horizontal row and enter a zero or one In the P column so that
each row has an odd number of one's.
To find the LCR: disregard the parity bits, scan up each vertical column, and make sure that each
column has a even number of one's in it. Enter a zero or one in the LCR position, so that it does.
If you are using a computer to calculate the LCR, use the "exclusive or" function. Next, calculate
odd parity for the LCR character, in the horizontal direction.
The Hex characters are usually displayed in their ASCII equivalent: Hex B as a ";" semicolon,
Hex D as an "=" equal sign, and Hex F as a "?" question mark.
5
I/O Interface for TTL Magnetic Stripe Readers
6
SECTION 2. ENCODING
There are several schemes used to record or encode ones and zeros in the computer industry.
(We use the term record and encode synonymously.) In the card industry the International
Organization for Standardization (ISO) has defined F2F as the encoding scheme for cards. F2F
stands for frequency - double frequency, or for the purist - two frequency coherent phase
recording. F2F encoding provides for self-clocking data. That is, the serial data stream
consisting of one and zero bits provides the timing information for the reader to determine which
bit is which.
The key feature of self-clocking data is that the data bits can be extracted from the serial data
stream without the need to control the speed of the magnetic media past the encoding head.
Thus, card swipe readers, where a human hand is passing the card through the read slot can work
regardless of how fast or slow the card is passing through the slot. Serial data merely means that
the one and zero bits, that form the desired characters, are stored on the same track, one bit after
the next bit.
F2F is an encoding technique which places flux transitions on the magnetic stripe separated by a
defined distance for zero bits and one half that distance for one bits.
The defined distance for Track 1 and Track 3 is 0.0047619 inches for zero bits. This value is the
reciprocal of the bit density of Track 1 - 210 bits per inch. For one bits - 0.0023809 (1/2 the zero
bit distance.)
The defined distance for Track 2 is 0.013333 inches for zero bits. This value is the reciprocal of
the bit density of Track 2 - 75 bits per inch. for one bits - 0.0066665 inches (1/2 the zero bit
density.)
Figure 2-1 illustrates this concept.
7
Loading...
+ 23 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.