User manual

390
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
Mmc_Read_Sector
Mmc_Write_Sector
Prototype
function Mmc_Read_Sector(sector: dword; var dbuff: array[512] of byte):
word;
Description The function reads one sector (512 bytes) from MMC card.
Parameters - sector: MMC/SD card sector to be read.
- dbuff: buffer of minimum 512 bytes in length for data storage.
Returns - 0 - if reading was successful
- 1 - if an error occurred
Requires MMC/SD card must be initialized. See Mmc_Init.
Example
// read sector 510 of the MMC/SD card
var error : word;
sectorNo : dword;
dataBuffer : array[512] of byte;
...
sectorNo := 510;
error := Mmc_Read_Sector(sectorNo, dataBuffer);
Notes None.
Prototype
function Mmc_Write_Sector(sector: dword; var data: array[512] of byte):
word;
Description The function writes 512 bytes of data to one MMC card sector.
Parameters - sector: MMC/SD card sector to be written to.
- dbuff: data to be written (buffer of minimum 512 bytes in length).
Returns - 0 - if writing was successful
- 1 - if there was an error in sending write command
- 2 - if there was an error in writing (data rejected)
Requires MMC/SD card must be initialized. See Mmc_Init.
Example
// write to sector 510 of the MMC/SD card
var error : word;
sectorNo : dword;
dataBuffer : array[512] of byte;
...
sectorNo := 510;
error := Mmc_Write_Sector(sectorNo, dataBuffer);
Notes None.