ProgramFlash Method
UP ]

 

Description

This method is used to write a single word to one position of the target’s on-chip flash.

Syntax

HCS121.ProgramFlash (Address, wData)

Part Type Description
Address long Target’s on-chip flash memory address to be written to. It only can be a 16 bit address, linear addresses not supported.
wData Word Word to be written.

Remarks

Before to write a word, you have to be sure that the position is erased (read as $FFFF), in other case you will have to erase the sector first using SectorEraseFlash, be careful because you will lose all data in the sector after the invocation of the last method. If you do not want to lose other data into the sector but still need modify a word not erased, use BlockFill instead of ProgramFlash. Additionally, this method do not support linear addresses so you have to modify the registers PPAGE and FCNFG in order to select the right flash page and flash block number respectively. You do not need to modify PPAGE in case of writing some address belonging to the ranges [$4000-$7FFF] or [$C000-FFFF], but still have to write FCNFG selecting the flash block number 0 (field BKSEL).

See also:

SectorEraseFlash method

BlockFill method

 

If you have a question or suggestion please contact me. Updated: 03.27.2003
Copyright (c) 2003-2004 J.Gorgas. All rights reserved. All trademarks mentioned are the property of their respective owners.