I made some changes in the library,
but i think the problem is image that we use in the proteus,
i made .ima image file with WINIMAGE program,
and added a .txt file in this image,
but when i look at that image with winhex (HXD) pogram
i saw that .txt file atrribute (its entry's 0x0B byte is not 0x20
it must be 0x20, if it is not, our sd library does not recognize it as an archive,
so i changed the attribute of the txt in the image file with winhex,
then what happened, i can open the txt with proteus,
i added an image file and my working example you can try it.
name of the txt is 06.TXT,
i used the ( FAT_OpenFileAndRead(NombreCorto,DirectorioRaiz, 'o', BufferFAT) function,
NombreCorto is the short name of the file,
(if the name is smaller than 8 charecters library pads it with zero as needed)
DirectorioRaiz (RootDirectory) where do you want to start your search for this file,
'o' means open it,
when this function used named file is opening end reading it's first 512 byte data in to BufferFAT,
then we than show it!s content with using BufferFAT,
after that if we want to read remainings of the file we just need to use
( FAT_OpenFileAndRead(NombreCorto,DirectorioRaiz, 'r', BufferFAT)
same function with 'r' means read,
it reads next 512 byte of the file and places it into BufferFAT.
( I used PROTEUS 8.1 )
I hope my example helps.
//---------------------------
Translated;
Hice algunos cambios en la biblioteca ,
pero yo creo que el problema es la imagen que usamos en el proteus ,
hice .ima archivo de imagen con el programa Winimage ,
y ha añadido un archivo txt en esta imagen ,
pero cuando miro a esa imagen con winhex ( HXD ) Pogram
i vi que .txt atrribute (byte 0x0B de su entrada no es 0x20
debe ser 0x20 , si no es así, nuestra biblioteca sd no lo reconoce como un archivo ,
Así que cambié el atributo del txt en el archivo de imagen con winhex ,
luego de lo que pasó , puedo abrir el txt con proteus ,
he añadido un archivo de imagen y mi ejemplo de trabajo que puedo probarlo .
nombre del txt es 06.txt ,
He utilizado el ( FAT_OpenFileAndRead ( NombreCorto , DirectorioRaiz , ' o', función BufferFAT ) ,
NombreCorto es el nombre corto del archivo,
( si el nombre es más pequeño que 8 charecters almohadillas BIBLIOTECA con cero como sea necesario )
DirectorioRaiz ( RootDirectory ) donde quieres comenzar la búsqueda de este archivo ,
' o' significa abrirlo ,
cuando esta función que se utiliza el nombre de archivo se abre extremo lectura a sus primeros 512 bytes de datos en la que BufferFAT ,
entonces que muestran ! s contenido con el uso de BufferFAT ,
después de eso , si queremos leer restos del archivo sólo tenemos que utilizar
( FAT_OpenFileAndRead ( NombreCorto , DirectorioRaiz , ' r ' , BufferFAT )
misma función con ' r ' significa leer ,
se lee junto 512 byte del archivo y lo coloca en BufferFAT .
(Yo usé PROTEUS 8.1 )
Espero que mi ejemplo ayuda .
//--------------------------
LINK of complete example (ccsc code,library,hex, proteus schematic, and image file)
***********************************************************
https://www.dropbox.com/s/qafj0r34x745ncf/8_SD_Suky_ver18.rar?dl=0***********************************************************
¿Puede alguien añadido en la página del foro
i no pude encontrar cómo agregó
Can someone added it into the this page of forum
i couldn not find how to added.