Mikroelektronika MIKROE-350 データシート

ページ / 526
Mmc_Write_Sector
259
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Mmc_Write_Sector(dim sector as longintdim byref
data_ 
as byte[512]) as byte
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) 
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). 
Requires
MMC/SD card must be initialized. See Mmc_Init.
Example
' write to sector 510 of the MMC/SD card
dim error as word
sectorNo 
as longword
dataBuffer 
as char[512]
...
main:
...
sectorNo = 510
error = Mmc_Write_Sector(sectorNo, dataBuffer)
...
end.