SDCARDFILES.createfile(); //create a text file with 0 lengthSDCARDFILES.fileappend(); //append 512 bytes to the open file
unsigned char buffer ; //contains the 512 bytes to write to file
For larger code projects, assembler may not be nirvana. C/C++ may be. There is a number of good C compilers available for the AVR family of microcontrollers including the compilers from IAR and Imagecraft which can be purchased, or the AVR GCC compiler that can be downloaded from a number of sites, including www.avrfreaks.com.Using these compilers, you typically program in an environment set up by the compiler vendor. You maintain your code project in a 3rd party tool. You typically set the compiler to produce code in DEBUG mode, which means that references to the high level code will be added to the compiled source. When you compile and link, you create an object file, and that object file can be loaded directly in AVR Studio 4.
#define setupDDRB DDRB |= 0x2c; //set SS as output for cs, MOSI and SCK#define selectSDCARD PORTB &= ~0x04; //set the SS to 0 to select the sd card #define deselectSDCARD PORTB |= 0x04; //set the SS to 1 to deselect the sd card