mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

Compact Flash Library

Compact Flash Library provides routines for accessing data on Compact Flash card (abbrev. CF further in text). CF cards are widely used memory elements, commonly found in digital cameras. Great capacity (8MB ~ 2GB, and more) and excellent access time of typically few microseconds make them very attractive for microcontroller applications.

In CF card, data is divided into sectors, one sector usually comprising 512 bytes (few older models have sectors of 256B). Read and write operations are not performed directly, but successively through 512B buffer. Following routines can be used for CF with FAT16, and FAT32 file system. Note that routines for file handling can be used only with FAT16 file system.

Important! Before write operation, make sure you don’t overwrite boot or FAT sector as it could make your card on PC or digital cam unreadable. Drive mapping tools, such as Winhex, can be of a great assistance.

Library Routines

Cf_Init

Cf_Detect

Cf_Total_Size

Cf_Enable

Cf_Disable

Cf_Read_Init

Cf_Read_Byte

Cf_Read_Word

Cf_Write_Init

Cf_Write_Byte

Cf_Write_Word

Cf_Find_File

Cf_File_Write_Init

Cf_File_Write_Byte

Cf_Read_Sector

Cf_Write_Sector

Cf_Set_File_Date

Cf_File_Write_Complete

Function Cf_Set_Reg_Adr is for compiler internal purpose only.

page

 

162

MikroElektronika: Development tools - Books - Compilers