Hello,
I'm trying to find out which protocol to use to cummunicate with the 21006516·from magtek
I can't figure it out just by reading the Datasheet.
I tried shifout and shiftin but it didn't work
thank you!
From the datasheet, it's clear that the reader is acting essentially as an SPI master, so the Stamp would have to be a slave. Both SHIFTOUT and SHIFTIN assume the Stamp is acting as an SPI master. You will have to program the protocol yourself. You need a loop that looks for CardPresent to go from HIGH to LOW (wait for it to be HIGH, then wait for it to be LOW). Then wait for the Strobe to go from LOW to HIGH and read the Data pin (and shift the bit into your result value). If you have all the bits, wait for CardPresent to go HIGH. If not, go back to wait for the Strobe to go from LOW to HIGH. Try something like this subroutine:
BitsCnt CON 10
Value VAR Word
CardPresent PIN 0
Strobe PIN 1
DataPin PIN 2
ReadCard:
Value = 0
Do : Loop Until CardPresent = 1 ' Wait for HIGH
Do : Loop Until CardPresent = 0 ' Wait for LOW
For Bits = 1 To BitsCnt ' BitsCnt Bits for this example
Do : Loop Until Strobe = 0 ' Wait for LOW
Do : Loop Until Strobe = 1 ' Wait for HIGH
Value = ((DataPin << BitsCnt) | Value) >> 1 ' Accumulate MSB..LSB
Next
Return
I just looked again at what I posted and the bit order is incorrect. Change the "Value = ((DataPin << BitsCnt) | Value) >> 1" to "Value = Value << 1 | DataPin" if you want MSB first. Keep my first posting if you want LSB first.
hello,
I had tried the code provided by Mr. Mike Green but now I realize that I'm actually getting only half of the data.
The Magtek Decoder sends the data at a rate of 3750 bits/secs, is the Basic Stamp too slow for it?
Someone has suggested MAX3100 UART as a solution but I'm not sure I should use it because the data coming from the Decoder is not RS-232, it's actually a track from a magstripe. Between the stop and the start bit there is 37 chars each 5 bits.
Is is possible to work with the MAX3100 or should I just stick to the Stamp alone?
Thank you!
Hi Simon, Iv never really studied this technology so I took a look at the link you provided, I am sure there are many many legitimate reasons for this device, like reading balances on a gift cards for example,·but its kind of scary to think information could be retrieved from a credit card, is that a possibility or am I just being paranoid.
Comments
I had tried the code provided by Mr. Mike Green but now I realize that I'm actually getting only half of the data.
The Magtek Decoder sends the data at a rate of 3750 bits/secs, is the Basic Stamp too slow for it?
Someone has suggested MAX3100 UART as a solution but I'm not sure I should use it because the data coming from the Decoder is not RS-232, it's actually a track from a magstripe. Between the stop and the start bit there is 37 chars each 5 bits.
Is is possible to work with the MAX3100 or should I just stick to the Stamp alone?
Thank you!
Jeff T.