Interface A TTL Magcard Reader To The PC Games Port

June 22, 1998
The connection of magnetic-card readers to PC-compatible computers is usually made through a serial port or a keyboard interface. In this configuration, the computer merely receives ASCII strings, but the decoding process must be supported by a...

The connection of magnetic-card readers to PC-compatible computers is usually made through a serial port or a keyboard interface. In this configuration, the computer merely receives ASCII strings, but the decoding process must be supported by a microcontroller embedded into the rather expensive “intelligent” card reader. Another design option is to use a much cheaper “TTL” reader and write some PC software to process the raw binary data from the card.

Common single-track magcard readers come with just five wires, two for the 5-V power supply and three for the logic outputs: “card present,” “data” and “clock.” The “games port” or “joystick connector” of most PCs is seldom used for “serious” tasks, but lends itself very well to the present application because it offers a good +5-V supply and four logic input lines. The necessary connections are shown, including an optional “PolySwitch” resettable fuse inserted into the +5-V line to protect the motherboard tracks against accidental overcurrent conditions (see the figure).

The software program was written in Turbo-Pascal and proved to work satisfactorily, under MS-DOS, on CPUs running at 25 MHz or faster (see the listing). Operation under Windows isn’t recommended, at least on CPUs slower than 200 MHz, since the main routine is time-critical.

Once run, the program waits for a card being swept into the reader, then it displays the decoded contents of its ISO-2 track (the most commonly used one, carrying a maximum of 40 numeric characters). The ISO-3 (max. 107 numeric characters) and ISO-1 (max. 79 alphanumeric characters) tracks could be treated very similarly with appropriate readers.

The program assumes that the card is encoded in accordance with the 5-bit ANSI code, but it’s written in such a way that it could easily be adapted, on a bit-by-bit basis, to any proprietary code or to the 7-bit alphanumeric ANSI code.

It should also be noted that the parity of the data (the last bit of each character) isn’t checked directly, but that the occurrence of any bit pattern other than the 16 ones listed here could easily be detected as a parity error. In addition, the last character of the track is usually an LRC, and could be used, at a later stage, to control the integrity of the data string.

Sponsored Recommendations

TTI Transportation Resource Center

April 8, 2024
From sensors to vehicle electrification, from design to production, on-board and off-board a TTI Transportation Specialist will help you keep moving into the future. TTI has been...

Cornell Dubilier: Push EV Charging to Higher Productivity and Lower Recharge Times

April 8, 2024
Optimized for high efficiency power inverter/converter level 3 EV charging systems, CDE capacitors offer high capacitance values, low inductance (< 5 nH), high ripple current ...

TTI Hybrid & Electric Vehicles Line Card

April 8, 2024
Components for Infrastructure, Connectivity and On-board Systems TTI stocks the premier electrical components that hybrid and electric vehicle manufacturers and suppliers need...

Bourns: Automotive-Grade Components for the Rough Road Ahead

April 8, 2024
The electronics needed for transportation today is getting increasingly more demanding and sophisticated, requiring not only high quality components but those that interface well...

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!