--=====================_827474146==_ Content-Type: text/plain; charset="us-ascii" At 14:25 14-03-96 +0800, you wrote: >Does anyone have knowledge of any standards for Magnetic Key Readers? Well, I'll give it a try. --=====================_827474146==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="DOC2.TXT" A few months ago I succesfully implemented a wiegand interface for a PIC 16C57. It now makes part of a commercial reader, so I am not allowed to give you my sources... but I can help you with a short description of the magstripe protocol. ---- Introduction Here follows a short description of the magstripe or Wiegand protocol that is used by many magnetic card readers. ---- Symbolset The magstripe protocol uses below set: Symbol Hex Binairy Remarks: p b3b2b1b0 0 0 1 0 0 0 0 - 1 1 0 0 0 0 1 - 2 2 0 0 0 1 0 - 3 3 1 0 0 1 1 - 4 4 0 0 1 0 0 - 5 5 1 0 1 0 1 - 6 6 1 0 1 1 0 - 7 7 0 0 1 1 1 - 8 8 0 1 0 0 0 - 9 9 1 1 0 0 1 - - A - - - - - Not used. < SS > B 0 1 0 1 1 Start Sentinel. - C - - - - - Not used. < FS > D 0 1 1 0 1 Field Separator. - E - - - - - Not used. < ES > F 1 1 1 1 1 End Sentinel. < LRC > x x x x x x Longitudinal Redundancy Check. ---- Notes: 1. In fact the magstripe protocol is an extended version of BCD coding. 2. Every symbol exist of 5 bits: 1 parity bit and 4 data bits ( p and b3...b0). The parity bit should be chosen in such a way that an odd number of '1' bits appears in the symbol. 3. < SS > marks the start of the data. 4. < FS > separates two information fields. 5. < ES > marks the end of the data and precedes < LRC >. 6. Every symbol should be transmitted as: b0 - b1 - b2 - b3 - p (least significant bit first). ---- Longitudinal Redundancy Check The Longitudinal Redundancy Check is an error detection code and also the last symbol to be transmitted directly after < ES >. The value of < LRC > (1 parity bit and 4 data bits) must be chosen in such a way that an even number of '1' bits appears on corresponding bit positions (b3...b0) of all transmitted symbols together (the data symbols plus < SS >, < FS >, < ES > and < LRC > symbols). The parity bit (p) of < LRC > must be chosen in such a way that an odd number of '1' bits in < LRC > itself appears. ---- Data stream The data stream can be described as follows: < SS > N N N ... < FS > ... N N N < ES > < LRC > with 'N N N ... N N N' representing the data symbols (decimal digits). ---- Output format The Wiegand protocol uses an two wire output formaat that is called 'clock and data output': Transmitting an ...: '1' '0' '1' ______ _____________ _____________ ______ Clock +5V | | | | | | | | | | | | GND |____| |____| |____| tsu tck thd ->|-|<- |<-->| ->|-|<- | | tnx | | | |<---------------->| | ____ ____________________________ ____ Data +5V | | | | | | | | GND |________| |________| Setup time before Clock tsu 100 us Clock time tck 100 us Hold time after Clock thd 100 us Clock repetition tnx 1000 us Note: Above timing is used by many commercial magnetic card readers. There might be some variation in timing for reason that manually 'swiping' a card through a reader will never occur at the same (or a predefined) speed! Most equipment to which a magnetic card reader is connected will accept signals that come twice as fast or twice as slow as I mentioned above. Clock and Data should return to 'logic zero state' (+5V) between consecutive bits. --=====================_827474146==_ Content-Type: text/plain; charset="us-ascii" ------------------------------------------------------------ Arthur J.H. van Deursen ITsec Nederland B.V. P.O. Box 703 2003 RS HAARLEM E-mail Tel. +31 - (0)23 542 05 78 Fax +31 - (0)23 534 54 77 ITsec: Your IT Security System Integrator ------------------------------------------------------------ --=====================_827474146==_--