This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

1-2 days

hello sir,

I get problem during the programming in embedded 'C' for reading of RFID card's data which is stored in EEPROM 24C32.
There is large no. of data (something for 200 RFID card's).
That means 200(card's)*6(bytes for each card's) = 1200 byte.
That data is stored sequentially and starting location of that card's 6 byte are get by switch case function.
The main problem is that each time i have to match 1200 bytes of EEPROM data with RFID card data.
In that case my controller get hang(stop) after 30 -35 cards.
After switch ON/OFF the system it will working finely for 5 - 6 card's and again the same problem occure.

SO,
There is any different way of matching that much of large data stored in EEPROM ?
What should i do for the problem of system getting hanged.

Parents
  • 1) Fix the bug if you don't like hanging code. Only you have the code, so only you can figure out what is wrong in the code.

    2) If you have enough RAM - preload the full database into RAM.

    3) Consider a tree search - with 200 cards and 6 bytes a match of the first byte should normally give you only 1 or 2 possible cards to get a match. Unless all cards are in sequential order in which case it's better to scan from last byte to first.

    4) Consider constant-time matches using a hash.

Reply
  • 1) Fix the bug if you don't like hanging code. Only you have the code, so only you can figure out what is wrong in the code.

    2) If you have enough RAM - preload the full database into RAM.

    3) Consider a tree search - with 200 cards and 6 bytes a match of the first byte should normally give you only 1 or 2 possible cards to get a match. Unless all cards are in sequential order in which case it's better to scan from last byte to first.

    4) Consider constant-time matches using a hash.

Children
  • A switch/case method to find the cards seems like a poor choice.

    You could implement a table that is sorted, and use a binary search.

    At the end of the day you've got to learn how to debug, and to identify where things are working, where the functionality breaks, and where code gets stuck. Instrument your code so you understand the internal states, and decisions that are occurring.