Secure digital library, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 257

Advertising
background image

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.

Sd_Init

Sd_Read_Sector

Sd_Write_Sector

Sd_Read_Cid

Sd_Read_Csd

MikroElektronika: Development tools - Books - Compilers

249

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Secure Digital Library

Library Routines

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

Sd_Init

Advertising
This manual is related to the following products: