hi

i made me the sc-reader from
http://www.thur.de/org/gsho/reader/bscrdw/bscrdw.html (at the end of
thepage !) and change it a little bit. i have already written software
for reading out telephone cards, but i cant get it  work with a i2c
(2-wire) card (is i2c the same as 2-wire ???).

first i make a reset

RST 0
CLK 0
ulseep 1
RST 1
CLK 1
ulseep 1
RST 0
CLK 0
ulseep 1


then i make a i2c-start condition

 I/O 1
 CLK 0
 ulseep 1
 I/O  0
 ulseep 1
 CLK 0
 ulseep 1


then i send the device adressing

 bool devaddr[8]={1,0,1,0,a2,a1,a0,1}; //i suppose that a2 a1 a0 are for
addressing one of the
 // 8x256 so every of the 256 could be set (2³ = 7 and a zero position 
makes 8) 
 // i set them to 0 0 0
 // i am not sure about this --> help
 for(int i=0;i<8;i++)
 {
  CLK 1
  usleep 1
  I/O (devaddr[i]);
  usleep 1
  CLK 0
  I/O 0
 }


now i try to read out hte acknowledge bit (i always get != 0)
if i continue i am doing it that way:

 for(int i=1;i<=2080;i++)  // it is a 2k-card 8*256 = 2048 + the
acknowledge bits = 2080
 {
  CLK 1
  usleep 1
  if(i%9 != 0)  // i dont want to save the acknowledge and i dont wnat
to check it(at the moment)
    buffer[i]=I/0 //read it out here
  usleep 1
  CLK 1
  usleep 1
 }

the i send the i2c stop condition

 CLK 1
 usleep 1
 I/0 1
 usleep 1
 CLK 0
 I/O 0 


but i coded something wrong !!! i need help with it , the device
addressing and it would also be nice if somebody could explain me the
diffrence between i2c and 2-wire (if there is one).

thnx !
  phil
***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************

Reply via email to