We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HAI, I would like to implement TTL interface to a swipe card reader. I want to read track 2 of a card .This contains alphanumeric characters and each character is of 5 bit size which includes one parity bit. I designed a hardware circuit for this with AT89c2051. The data is coming as a stream of bits from the readers magnetic head. So I have store this bit stream to a bit array. I used bdata variable for this purpose, but is not possible to write to the bit position. How I can write these bits to my bit array? What is wrong with code below: I used the pin P1.6 as the input for the data from card reader's magnetic head. Please help me.
sbit dat=P1^6; bdata unsigned char mydata[13]; for (i = 0; i < 13; i++) { for (mask = 0x01; mask != 0x00; mask <<= 1) { mydata[i] & mask = dat; } }
Here the error I got is errorC141:syntax error near'=';
Please give a replay.
mydata[i] & mask = dat;
That is not valid 'C' - the expression is not valid for the left-hand side of the '='
HAI, Thanx for your fast reply . How its possible in C ,how can i sotre bit stream data?
If your code works in simulator & not in actual circuit, most probably your circut has different timings. Ive' have ot got the code and cannot see the problem(havn't run it), here are my suggesitions, 1) Make sure you wait atleast 30mSec before it's initialization is started. To be on the safer side use more delays than what they specifies.
Hope that helps. If you still having problems I'll post a example with C which you can easily convert to ASM.
I am affraid that you can't use complete C code, as the async data from Card reader will be coming at much faster rate than the code execution time.
Attempt to write in ASM and integrate in the 'c' main: -Init. & Reserve arrray of IDATA -Use bitwise operators to store seq. in IDATA
You have varies ways to make this idata available in global scope.
If it's data from a standard track 2 interface and your processor is running at a reasonable rate (>7MHz) then you will easily be able to write the ISR in C.
You might find it easiest to have a 'storage index' and a 'bit mask' to write each bit to a buffer. Much as 'S Edara' suggests.
Thanks Flaver, I have not done my home work on the speed.
Hai Friend, My code get some compilation error as mentioned in my first post. So the problem I think is not in hardware, but in code itself. If I get a single bit from a card, then it is possible to store in a single bit. But if it is a stream of bits, then I have to store in a bit array. How can I define a bit array and how its bits can be accessed. Actually there is 8 bits in a char, but I am not able store a bit in its bit0 or bit1 etc. Is it possible using Keil to store a stream of bits to such a variable. Is it possible to use bdata variable for this purpose? Please help me with a sample code.
Hello Sreeja..!!
i am a engneering final yr student...i want to do my final project on Cashless payment system in Campus using swipe card technology!!..I want to develope Hardware of Reader and Writer Module..!! could u plz mentor me in completing my project..!!
Hope u would reply me soon.
Thanks & Regards, Krishna Mohan email: ykmohan@ymail.com