Mikroc, Mmc_fat_init, Mmc_fat_assign – ABL electronic PIC Microcontrollers PIC16 User Manual
Page 235

MikroElektronika: Development tools - Books - Compilers
227
page
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Prototype
unsigned short
Mmc_Fat_Init(unsigned short *port, unsigned short
pin);
Returns
Returns 0 if MMC card is present and successfully initialized, otherwise returns 1.
Description
Initializes hardware SPI communication; designated CS line for communication is RC2.
The function returns 0 if MMC card is present and successfully initialized, otherwise
returns 1.
This function needs to be called before using other functions of MMC FAT library.
Example
// Loop until MMC FAT is initialized at RC2
while
(Mmc_Fat_Init(&PORTC, 2)) ;
Mmc_Fat_Init
Prototype
void
Mmc_Fat_Assign(char *filename);
Description
This routine designates (“assigns”) the file we’ll be working with. Function looks for the
file specified by the
filename
in the root directory. If the file is found, routine will ini-
tialize it by getting its start sector, size, etc. If the file is not found, an empty file will be
created with the given name. The
filename
must be 8 + 3 characters in uppercase.
Requires
Library needs to be initialized; see
Mmc_Fat_Init
.
Example
// Assign the file "EXAMPLE1.TXT" in the root directory of MMC.
// If the file is not found, routine will create one.
Mmc_Fat_Assign("EXAMPLE1TXT");
Mmc_Fat_Assign