Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Author Message
aclymer13
PostPosted: Mar 30, 2012 - 07:04 PM
Rookie


Joined: Mar 29, 2012
Posts: 43


I am having absolutely no luck getting data out of the mag card reader:

DDRC = 0x20; // output for an LED on PC5
PORTC = 0x10; // enable pullup resist on PC4
EIMSK = EIMSK | 1 << INT1; // enable card reader interrupt

next_bit = ~PINC; // mag reader has inverted logic

next_bit = next_bit >> 4; // wanted data on PC4 shift to right to be LSB

next_bit = next_bit & 1; // make sure no unwanted data

I always get a zero for the data reading. Did I do something wrong?
 
 View user's profile Send private message  
Reply with quote Back to top
aclymer13
PostPosted: Mar 30, 2012 - 07:06 PM
Rookie


Joined: Mar 29, 2012
Posts: 43


ISR(INT1_vect) {
Mag_Stripe_ISR();
}


Mag_Stripe_ISR() {
unsigned char next_bit, ID_bits, temp, ID_char;

next_bit = ~PINC;
next_bit = next_bit >> 4;
next_bit = next_bit & 1;

switch (next_state) { ETC.....}
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 30, 2012 - 07:08 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

Oh no you don't. One thread and stick to it.

(as this one has nothing to do with GCC it's this one that gets locked)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits