"Hello community, i have to build a datalogger, and i have to save data on a micro sd card with real time, so i need a library that let me write and read and other one for rtc ds3231 that works great on atmega 2560. thanks for all your possible help."
Micro SD and RTC on Atmega 2560 AVR
Arduino has it all. The mega2560 is used on the Arduino mega boards, so it is fully supported. Do a Google on how to get the hex file from the Arduino tools.
Greetings Zoguis and welcome to AVR Freaks.
The first question is VERY important. Is this a one-off project or is it something that is going to be built in quantity?
On a Mega2560, there is a "Real Time Counter with Separate Oscillator". This is designed to explicitly work with 32.768KHz crystals and produce 1 second ticks. This runs in the background so writing to the uSD card will not interfere with time keeping. Minutes, hours, and such, can be derived though software counting from the 1 second ticks. The time.h library will handle all this for you.
The Elm Chan SPI memory card library does an excellent job of dealing with FAT-formatted memory media. Together, these work quite nicely,
If you look at the link below my signature, you will see a battery powered logger that records acceleration at up to 100Hz, and writes to a uSD card. It has a hardware/software real time clock and is based on M328P.
Best wishes
Jim
The Elm Chan SPI memory card library
FatFs ... I think is pretty much what everyone using plain AVRs uses when they want SD/MMC access.
Thoroughly Agreed. And it's not just AVRs - I think FatFs is pretty much what everyone using any microcontroller uses when they want SD/MMC access.
It is widely - if not universally - used by other manufacturers in their demos/examples of SD Card usage.
It's very good.
Indeed it is.
#SDCardUseFatFs
thanks for all your help, im using the arduino board, but i have to program it on atmel studio in C, so how i import the FatFS libreary to that Uc(atemga2560).
Have you visited the FatFs main page - http://elm-chan.org/fsw/ff/00index_e.html - and studied the information there?
In particular, the 'Resources' at the end of that page?
Or just googled for examples?
EDIT
Or, if it's "How To Get Started With Atmel Studio" you're looking for:
https://www.google.co.uk/search?q=atmel+studio+getting+started