Thank you very much for responding again.
I have already managed to write data of 5 bytes, changing them to a variable type “char” and sending the address of this variable.
Now I have had problems simulating. usually the file is created and the data is stored correctly, but in some occasions the image used in the simulation is damaged and the .txt file can not be opened.
Software: MPLAB x IDE v4.05
simulation software: MPLAB x IDE v4.05
program to create and view the image of SD memory: Winimage