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.
Since bit manipulation into normal C data types (char or int) is really standard: Why do you not use Google to search for example code? Are you afraid that you may find too many examples?
read bit 5:
unsigned char c = (mydata[i] & 0x20) >> 5 ;
turning bit 5 on:
mydata[i] |= 0x20 ;
turning bit 5 off:
mydata[i] &= ~0x20 ;
This has two magic constants that needs to be updated if changing to another bit number:
Probably better to only have one constant that depends on which bit position to work with.
unsigned char c = (mydata[i] >> 5) & 1;
I really prefer (1<<5) before 0x20 when working with single bits.
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
dear sir i would like to know that have you succeed about your project or no?? and do you have any information about magnetic card writer??? best regards majd