mikroC
mikroC - C Compiler for Microchip PIC microcontrollers
making it simple...
Multi Media Card Library
mikroC provides a library for accessing data on Multi Media Card via SPI communication.
Notes:
-Library works with PIC18 family only;
-Library functions create and read files from the root directory only;
-Library functions populate both FAT1 and FAT2 tables when writing to files, but the file data is being read from the FAT1 table only; i.e. there is no recovery if T1 table is corrupted.
Library Routines
Mmc_Init
Mmc_Read_Sector
Mmc_Write_Sector
Mmc_Read_Cid
Mmc_Read_Csd
Mmc_Fat_Init
Mmc_Fat_Assign
Mmc_Fat_Reset
Mmc_Fat_Rewrite
Mmc_Fat_Append
Mmc_Fat_Read
Mmc_Fat_Write
Mmc_Set_File_Date
Mmc_Init
Prototype | unsigned short Mmc_Init(char *port, char pin); |
|
|
Returns | Returns 0 if MMC card is present and successfully initialized, otherwise returns 1. |
Description Initializes MMC through hardware SPI communication, with chip select pin being given by the parameters port and pin; communication port and pins are designated by the hardware SPI settings for the respective MCU. Function returns 1 if MMC card is present and successfully initialized, otherwise returns 0.
|
| Example | while (Mmc_Init()) ; // Loop until MMC is initialized | ||
|
|
|
|
|
|
|
| page |
|
|
|
|
|
|
| ||
224 | MikroElektronika: Development tools - Books - Compilers | ||||
|
|
|