bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Dora,Hello!
It depends on how you want to use the SD card. If you want to do a raw read / raw write, then
you can do it almost directly without file system (i.e. you just have to initialize the SD card
properly and then access it by 512 bytes blocks. But you have to care of all the data management
yourself (i.e. if you use icons, then you have to decide yourself that icon 1 starts at 0 and ends
at 1FF, icon2 strarts at 200 and ends at 3FF, etc...
You can program raw files with a PC using HxD (that's the program name, it is free).
Now if you want to write bmp files from a PC and then read them from a micro controller,
then you need a FAT file system program for your micro controller.
There are myriads of file system versions on the net.
Dora.
Dora,What do you mean by hexa format?
Hello!
I know (more or less) what is hexadecimal. What I meant is if you have, say, an array like this:
uint8 data[] = {
0x00, 0x01, 0x02, 0x03.... 0xFF
}
It's an array written in hexadecimal in your code.
If you define a second array like this:
uint8 data2[] = {
0, 1, 2, 3, 4, ... 255
}
Then the array is written in decimal, but these 2 arrays contain exactly the same data.
If you write one or the other to the SD card, it will yield the same result, and if you look
inside the SD card, there is no way to know how it was written in the source code. Hexa
is a representation which is more user-friendly in some cases, but the actual data is not
hexadecimal at all, it's plain binary.
If you use an hexa editor, it reads the data in the card and produces hexadecimal code
to show it in a clean way, ordered and aligned.
Now as for writing to SD card, no I don't have a function to do that right now, but it's easy
to do. Read the SD specs and you will find out (as far as I remember) that there is a
write command after which you send a 512 byte block (command usually called cmd24).
And there is a command for read (CMD17).
There are also 2 other command for continuous multi block write and read.
Dora.
You should be able to read and write some data, implementing any kind of file system with write capability is effectively impossible under this conditions, because you can't write smaller entities than a 512 Byte sector. To read/modify/write any sector, e.g. a directory or FAT entry, it most be completely buffered.can I use AT89LV55 for reading SD card ? Is the internal RAM enough ? internal RAM = 256 Bytes
Do you mean, I can not use AT89LV55 for reading and writing SD card ?you can't write smaller entities than a 512 Byte sector
To understand the problem, you may need to consult the SD command details. Please consider how you want to change e.g. a directory entry without buffering a directory sector in RAM.
Yes. You have been talking about "reading and writing SD card" and "using FAT system".I simply want to read a character from SD card and put it into array then display it onto my LCD...so the uC is only reading and displaying the content of SD card...
Is it possible without RAM..?
Hello!
According to what I developed in the past, the strict minimum to access a FAT16 in read and write
mode is about 800 bytes of RAM.
You need 512 bytes for the SD sector and you need management variables.
So basically, you need a processor with 2 K memory. I suppose it may be feasible with 1K, but
keep in mind that some part of the RAM is used for the stack and in some cases for the
interrupt routine addresses. And also if you do something else than accessing the SD card,
then you will need some RAM.
Dora.
unsigned char xdata DATA[512];
.
.
.
.
SdReadBlock(DATA,AddTemp+(j*512),512);
from your suggestion, I'm gonna find a uC with 4Kbytes internal RAM then, do you have any ideas ? which uC ? how about STC89C516RD+Hello!
I have never used AT chips, so I don't know. If you have an EMIF interface, then yes
you can add an external RAM. If you don't have an EMIF interface, then it's probably
better to choose a chip that has enough RAM. With recent processors, you can have
for less than 5 USD some processors with +/- 4 or 8 K RAM.
Now for your question:
If you define unsigned char date[512], it means that you tell the compiler to reserve
512 bytes in RAM. If you don't have 512 bytes, then I think it will likely not compile.
An if it does compile, it will not work.
Dora.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?