Hier mal mein Code, den ich selbst für die diskio.c geschrieben habe.
CodeBox C
CodeBox C
void init_spi (void){ //SPI-Konfiguration SD DDR_SPI = (1<<DD_MOSI)|(1<<DD_SCK)|(1<<Soft_SS); DDR_SPI &= ~(1<<DD_MISO); SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //MSB zuerst, SPI Modus 0 } void select(void){ PORTB &= ~(1<<1); } void deselect(void){ PORTB |= (1<<1); }