.setsector Method

Function:

Writes the entire 264 bytes of the specified sector with the data from the currently selected RAM buffer of the flash memory (selection is made through the fd.buffernum property).

Syntax:

fd.getsector(num as word) as pl_fd_status_codes

Returns:

One of the following pl_fd_status_codes, also affects fd.laststatus:

0 — PL_FD_STATUS_OK: Completed successfully.

1 — PL_FD_STATUS_FAIL: Physical flash memory failure (fatal).

4 — PL_FD_STATUS_INV_PARAM: specified sector number is in the firmware/application area of the flash memory; access has been denied.

16 — PL_FD_STATUS_FLASH_NOT_DETECTED: Flash IC wasn't detected during boot, fd. object cannot operate normally.

See Also:

Direct Sector Access, Sharing Flash Between Your Application and Data, File-Based and Direct Sector Access Coexistence, fd.buffernum, fd.getbuffer, fd.setbuffer, fd.getsector, fd.checksum, fd.copyfirmware, fd.copyfirmwarelzo


Part

Description

num

Logical number of the sector to write to (logical numbers are in reverse: writing to the logical sector 0 actually means writing to the last physical sector of the flash IC). The acceptable range is 0 - fd.availableflashspace - 1.


Details

The data area of the flash memory may house a formatted flash disk. Writing to the sector that belongs to the flash disk when the disk is mounted will automatically dismount the disk (set fd.ready = 0 — NO) and may render the disk unusable.

This method always accesses the specified target sector and not its cached copy even if a disk transaction is in progress (fd.transactionstarted = 1 — YES) and the target sector has been cached already.


.setsector Method

Details