Shop OBEX P1 Docs P2 Docs Learn Events
Problem making a mag card reader/decoder — Parallax Forums

Problem making a mag card reader/decoder

ArchiverArchiver Posts: 46,084
edited 2004-04-21 22:54 in General Discussion
Hi all. I just got my first two Basic Stamp kits (bought the BS2 OEM
kits and built them myself), but I'm having a heck of a time getting
this to work. I'm trying to build a decoder for a magnetic card
reader. I just need to read in the TTL logic levels when the clock
goes low, buffer them up until I have 5 bits, then output them on a
serial output. My problem is however that it looks like my card
reader is not playing nice with the IO pins. It is sending a voltage
of ~4.80, yet the status of the pin is still 0. When I take the pin
and send it to the +5v (really +4.95) for an instant, it goes to 1.
Is the basic stamp that sensitive, or am I missing something. I'm
including the code I'm using for now to test the clock.

Thanks in advance,
--Brian

'{$STAMP BS2}
'{$PBASIC 2.5}
INPUT 5
INPUT 1
p5 PIN 5 '--Clock
p1 PIN 1 '--Data
clock VAR Bit
counter VAR Byte
datain VAR Bit

clock = IN5
counter = 0
DEBUG "Ready...",CR,LF
DEBUG "clock: ",BIN IN5, CR,LF
Main:
DEBUG "clock: ",BIN IN5, CR,LF
IF (clock <> 0) THEN
counter = counter + 1
datain = ~p1
DEBUG "not = ",DEC counter,CR,LF
DEBUG HEX datain,CR,LF
ENDIF
GOTO main

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-21 22:54
    I fixed that problem...stupid coding mistake. However, it still is
    not working correctly. The stamp is only picking up about 6-10 clock
    pulses, but when I attach the card reader to a scope, there are lots
    more...so I'm assuming the card reader is working correctly. Has
    anyone done this before? I would be greatful for any help from
    anyone.

    Thanks,
    --Brian

    --- In basicstamps@yahoogroups.com, "Brian M." <bjm1287@r...> wrote:
    > Hi all. I just got my first two Basic Stamp kits (bought the BS2
    OEM
    > kits and built them myself), but I'm having a heck of a time getting
    > this to work. I'm trying to build a decoder for a magnetic card
    > reader. I just need to read in the TTL logic levels when the clock
    > goes low, buffer them up until I have 5 bits, then output them on a
    > serial output. My problem is however that it looks like my card
    > reader is not playing nice with the IO pins. It is sending a
    voltage
    > of ~4.80, yet the status of the pin is still 0. When I take the pin
    > and send it to the +5v (really +4.95) for an instant, it goes to 1.
    > Is the basic stamp that sensitive, or am I missing something. I'm
    > including the code I'm using for now to test the clock.
    >
    > Thanks in advance,
    > --Brian
    >
    > '{$STAMP BS2}
    > '{$PBASIC 2.5}
    > INPUT 5
    > INPUT 1
    > p5 PIN 5 '--Clock
    > p1 PIN 1 '--Data
    > clock VAR Bit
    > counter VAR Byte
    > datain VAR Bit
    >
    > clock = IN5
    > counter = 0
    > DEBUG "Ready...",CR,LF
    > DEBUG "clock: ",BIN IN5, CR,LF
    > Main:
    > DEBUG "clock: ",BIN IN5, CR,LF
    > IF (clock <> 0) THEN
    > counter = counter + 1
    > datain = ~p1
    > DEBUG "not = ",DEC counter,CR,LF
    > DEBUG HEX datain,CR,LF
    > ENDIF
    > GOTO main
Sign In or Register to comment.