I've got a Magtek with a 9 pin IO which has pin outs for Track 1,2 & 3
I'm following this post to read track 1 which works great.
If I change the data and strobe pins to read track 2 is also works fine. What I would like to do now is read Track 1&2 at the same time. I've tried to combine it in the code but then it looks like the arduino does not read the inputs fast enough and I end of losing information.
What I"ve done is just replicate the code in the read routine but it can't read the data in fast enough.
You don't show all your code but looking at original thread you have removed the while(true) so each routine would need continual calling to read each bit. Maybe the code below is more like what your looking for. If the strobe is synchronized on all tracks then it could be simplified.
Still not working properly. The track 1 reading looks ok, but now track 2 is way off. The count for T1 is 600, but the count for T2 is 12336 which is way off. Its reading in too much info. I’ll double check my code maybe its something silly now.
Not sure what the problem is without having the hardware to test with but the code has no checks to ensure dataNum_T does not get incremented beyond the dataStr_T buffer length so if it reads too many bits (currently >600) then memory will become corrupt.
You should also use the code tag for program code and not the quote tag.
It looks like the extra code from the Track 1 checks adds too much of a delay in that the Track 2 checks now are not fast enough to catch all the data out.
Now sure where to start but will maybe have a look at interrupts or try and optimize the code further (Not sure how much more it can be optimized)
From the datasheet on the card reader it says the strobe width is approx 25-50% of the bit width? I don't see any reference to the actual timing of the strobe clock? Do you think the extra code could cause reading problems?
For all of you trying to read Tracks 1 and 2 in parallel, here is the code I recently wrote.
The approach for reading Tracks is adopted from this great instructable. I slightly changed this code in order to read two tracks in parallel.
The code is tested on Panasonic’s dual head Magnetic Card Reader ZU-1870MA8T.
Take a test with your readers and let me know the results.