Hi Axel,
ok hier noch mal die ATR Routine
sbi(IO_DDR, IOPIN); // output
sbi(CLK_DDR, CLKPIN); // output
sbi(RST_DDR, RSTPIN); // output
// initial state
cbi(RST_PORT, RSTPIN);
cbi(CLK_PORT, CLKPIN);
sbi(IO_PORT, IOPIN);
_delay_us(5);
// begin to ATR procedure
sbi(RST_PORT, RSTPIN);
_delay_us(1);
sbi(CLK_PORT, CLKPIN);
_delay_us(1);
cbi(CLK_PORT, CLKPIN);
_delay_us(1);
cbi(RST_PORT, RSTPIN);
_delay_us(5);
// release the IO - tri state
cbi(IO_DDR, IOPIN);
cbi(IO_PORT, IOPIN);
// and no the ATR data are ready to take
for ( i=0; i<4; i++) {
b= 0x00;
mask= 0x01;
// for any byte
for ( x=0; x<8; x++) {
// clock
sbi(CLK_PORT, CLKPIN);
_delay_us(5);
// check bit
if ( bit_is_set(IO_REG, IOPIN) )
b |= mask;
mask <<= 1;
cbi(CLK_PORT, CLKPIN);
_delay_us(5);
}
data[i]= b; // save byte
}
WhileCardIsPrecence();
}
Jetzt sollte der ATR String vorhanden sein.
Was ist da falsch ???