MagTek TTL User Manual

I/O INTERFACE FOR TTL

MAGNETIC STRIPE READERS

TECHNICAL REFERENCE MANUAL

Manual Part Number 99875148 Rev-6
DECEMBER 2003
1710 Apollo Court
Seal Beach, CA 90740
Phone: (562) 546-6400
FAX: (562) 546-6301
Technical Support: (651) 415-6800
www.magtek.com
Copyright© 1999-2003
MagTek®, Inc.
Printed in the United States of America
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.
3 24 Jun 02 Sec 1: Updated MagTek Documents.
Sec 4: Corrected Error Checking, Track 2; added Insertion Reader. Appendix A: Replaced 99875065-2 with –3. Appendix B: Replaced 99821066-8 with –10. Appendix C: Editorial corrections.
4 06 Aug 02 Front Matter: Title change; Sec 1, MagTek
Documents, deleted Rev numbers and updated P/N 210065015/16 to /16 only, added 8 manuals to Reference Documents; Sec 2: corrected Error Checking, Track 2, added Insertion Readers; Sec 4: added Insertion Readers subsection; Appendix A : corrected character ]ND and bumped rev; Appendix B: removed DIP IC 15, bumped rev; Appendix C: changed ANSI address, and dimensions on Trks 1, 2, 3.
5 07 Aug 03 Editorial and format corrections throughout. Front
Matter: added ISO line to logo, changed Tech Support phone number. Sec 2: added note to Figure 2-2.
6 17 Dec 03 Appendix C, Standards, Card Data Format –
Track 1: extended Data Character line to include Format Code (FC).
ii
TABLE OF CONTENTS
SECTION 1. DECODING READER OUTPUT.............................................................................................1
REFERENCE DOCUMENTS ...................................................................................................................2
MAGTEK DOCUMENTS INCLUDED IN THIS MANUAL.........................................................................2
TRACK 1 DATA FORMAT........................................................................................................................3
TRACKS 2 AND 3 DATA FORMAT..........................................................................................................4
SECTION 2. ENCODING............................................................................................................................. 7
TIMING ...................................................................................................................................................10
DATA ......................................................................................................................................................10
STROBE.................................................................................................................................................10
CARD PRESENT....................................................................................................................................10
SECTION 3. LRC CALCULATION............................................................................................................13
SECTION 4. ERROR CHECKING.............................................................................................................15
ERROR CHECKS BY A TYPICAL READER .........................................................................................15
ERROR CHECKING, TRACK 2, WITH AN INTEL 8751........................................................................16
INSERTION READERS..........................................................................................................................18
SECTION 5. BIDIRECTIONAL READING AND AMPLITUDE VARIATIONS..........................................19
READING IN ONE DIRECTION VERSES BOTH DIRECTIONS........................................................... 19
CARD READBACK AMPLITUDE VARIATIONS....................................................................................20
APPENDIX A. CHARACTER CONVERSION........................................................................................... 21
TRACK 1 CHARACTER SET.................................................................................................................21
TRACK 2 AND 3 CHARACTER SET .....................................................................................................21
APPENDIX B. READ IC 21006516 SPEC SHEET ................................................................................... 23
APPENDIX C. STANDARDS ....................................................................................................................27
APPENDIX D. CARD READER INTERFACE........................................................................................... 29
INTERFACING THE CARD READER TO A MICROPROCESSOR......................................................29
SINGLE - BIT INPUT PROGRAMMING.................................................................................................29
USART....................................................................................................................................................29
DETECTING START SENTINEL............................................................................................................30
BIDIRECTIONAL READING................................................................................................................... 30
CONVERTING CARD DATA TO ASCII DATA ....................................................................................... 30
TRACK 1.................................................................................................................................................30
TRACK 2 & 3 ..........................................................................................................................................30
FIGURES
Figure 2-1. Bit Cell - Flux Transition -----------------------------------------------------------------------------------------8 Figure 2-2. Card Coding --------------------------------------------------------------------------------------------------------9 Figure 2-3. Timing--------------------------------------------------------------------------------------------------------------10
iii
iv

SECTION 1. DECODING READER OUTPUT

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
cc.
1
I/O Interface for TTL Magnetic Stripe Readers

REFERENCE DOCUMENTS

43-millimeter Compatible, Swipe Reader, Technical Reference Manual, P/N 99875148 90-millimeter Compatible, Swipe Reader, Technical Reference Manual, P/N 99831083 100-millimeter Compatible, Swipe Reader, Technical Reference Manual, P/N 99831012 101-millimeter Compatible, Swipe Reader, Technical Reference Manual, P/N 99821101 Slim Profile Card Guide, Swipe Reader, Technical Reference Manual, P/N 99875147 MT-215, TTL, Half Card Insertion Reader, Technical Reference Manual, P/N 99875009 Model MT-215, TTL, Insertion Reader, Technical Reference Manual, P/N 99875042 IntelliStripe 50 Manual Insertion Reader Tech Reference Manual, P/N 99875079 Model MT-215 TTL, Single or Dual Head, Insertion Reader Technical Reference Manual,
P/N 99875113
IntelliStripe 60, TTL Insertion Reader, Technical Reference Manual, P/N 99875135 Petrol (P-Series), TTL, Insertion Readers, Technical Reference Manual, P/N 99875139 Model MT-215, TTL, Single Head, 3-Track, Insertion Reader Technical Reference Manual,
P/N 99875157

MAGTEK DOCUMENTS INCLUDED IN THIS MANUAL

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
Start sentinel % 1 0 0 0 1 0 1 05 hex 05 (4+1) A 1 1 0 0 0 0 1 21 hex 33 (32+1) T 0 1 1 0 1 0 0 34 hex 52 (32+16+4) 3 0 0 1 0 0 1 1 13 hex 19 (16+2+1) End sentinel: ? 0 0 1 1 1 1 1 1F hex 31 (16+8+4+2+1) ___________ ___ __ LRC < 0 0 1 1 1 0 0 1C hex 28 (16+8+4)
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
Start Sentinel: B 0 1 0 1 1 B 11 (8+2+1) 1 0 0 0 0 1 1 1 2 0 0 0 1 0 2 2 3 1 0 0 1 1 3 3 (2+1) End Sentinel: F 1 1 1 1 1 F 15 (8+4+2+1) ___________ __ LRC 4 0 0 1 0 0 4 4
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