mikroC

making it simple...

Secure Digital Library

mikroC - C Compiler for Microchip PIC microcontrollers

Secure Digital (SD) is a flash memory memory card standard, based on the older Multi Media Card (MMC) format. SD cards are currently available in sizes of up to and including 2 GB, and are used in cell phones, mp3 players, digital cameras, and PDAs.

mikroC provides a library for accessing data on SD Card via SPI communication.

Note: Secure Digital Library works only with PIC18 family.

Library Routines

Sd_Init

Sd_Read_Sector

Sd_Write_Sector

Sd_Read_Cid

Sd_Read_Csd

Sd_Init

Prototype

unsigned short Sd_Init(unsigned short *port, unsigned short pin);

 

 

Returns

Returns 0 if SD card is present and successfully initialized, otherwise returns 1.

Description Initializes hardware SPI communication; parameters port and pin designate the CS line used in the communication (parameter pin should be 0..7). The function returns 0 if SD card is present and successfully initialized, otherwise returns 1. Sd_Init needs to be called before using other functions of this library.

Example

error = Sd_Init(&PORTC, 2); // Init with CS line at RC2

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

249