Parallax Card Reader Woes
Morrolan
Posts: 98
Hi all,
I'm using a slightly modified version of the demo code that came with the ISCSC4442 (256 byte) card. The only thing I've really added is the ability to read the card and see ASCII values - in order to do this I had to "restrict" the characters shown as command characters were causing clear-screens etc, so it only shows characters between 20 - 127.
As the code is quite large (only just short of filling the EEPROM) I have chosen to attach the entire code, and I will just quote the bit I am having trouble with.
What I'm experiencing is irregularities with the authentication of the cards - I have left the PSC set to the default value of $FFFFFF as the authentication is not a feature I need to implement so I haven't touched it.
However what I experience is that I don't get consistent numbers of tries - if I disconnect the power and reconnect sometimes it appears to reset, sometimes it says the card is locked, sometimes it says I have 2 tries remaining? This was all experienced on one single card.
I have read the following http://forums.parallax.com/showthread.php?t=124363&highlight=smart+card and have made the corrections to the comparison (replacing $ with % and adding the %000 line) but I still get irregular readings from the card.
However I notice further down that there is a subroutine to "replace" UpdateSecurity and seems to reset the error counter - is it simply a case of commenting out the above and uncommenting the one below?
I also had little the same results that came in the demo code for the card from the product page of item 32321.
Please can someone point me in the right direction, as the documentation for the card doesn't really go into much detail about how the PSC works?
Many Thanks,
Morrolan
I'm using a slightly modified version of the demo code that came with the ISCSC4442 (256 byte) card. The only thing I've really added is the ability to read the card and see ASCII values - in order to do this I had to "restrict" the characters shown as command characters were causing clear-screens etc, so it only shows characters between 20 - 127.
As the code is quite large (only just short of filling the EEPROM) I have chosen to attach the entire code, and I will just quote the bit I am having trouble with.
What I'm experiencing is irregularities with the authentication of the cards - I have left the PSC set to the default value of $FFFFFF as the authentication is not a feature I need to implement so I haven't touched it.
However what I experience is that I don't get consistent numbers of tries - if I disconnect the power and reconnect sometimes it appears to reset, sometimes it says the card is locked, sometimes it says I have 2 tries remaining? This was all experienced on one single card.
I have read the following http://forums.parallax.com/showthread.php?t=124363&highlight=smart+card and have made the corrections to the comparison (replacing $ with % and adding the %000 line) but I still get irregular readings from the card.
command = UpdateSecurity ' Updates error counter if PSC is invalid address = 0 IF(errCounter = %000) THEN dat = %011 IF(errCounter = %111) THEN dat = %011 IF(errCounter = %011) THEN dat = $001 IF(errCounter = %001) THEN dat = $000 GOSUB Send_Command GOSUB Process
However I notice further down that there is a subroutine to "replace" UpdateSecurity and seems to reset the error counter - is it simply a case of commenting out the above and uncommenting the one below?
' Command = UpdateSecurity ' Erase Error Counter ' Address = $00 ' Dat = $07 ' If password match then the counter restore ' GOSUB Send_Command ' GOSUB Process
I also had little the same results that came in the demo code for the card from the product page of item 32321.
Please can someone point me in the right direction, as the documentation for the card doesn't really go into much detail about how the PSC works?
Many Thanks,
Morrolan
Comments
I want to let you know the ErrCounter can always be read. You can read it before Authorization. So, there's no need to add this " IF(errCounter = %000) THEN dat = %011" into the code.
I don't recommend you comment the code. Otherwise even thought you got the right PSC code, you will have your card locked after run the Authorization Compare(Even Successfully Authorization) three times .