This problem does not seem to have anything to do with Proteus. If you can initialize the SD card and open a directory (as I think you do in your program), your hardware should be OK. I will ask the moderators to move it to a more appropriate part of the forum, which may increas your chances of a response.
It would be much better if you can simplify your program, so it recreates the problem with the minimal amount of code. Expecting forum members to wade through that long source code is not a friendly approach.
Also, I find the source code very hard to read in that small code window. Especially since it has lost all its indentations. Can you please post the code as an attachment (text file)?