mg84fl54b Megawin Technology, mg84fl54b Datasheet - Page 79

no-image

mg84fl54b

Manufacturer Part Number
mg84fl54b
Description
Full-speed Usb Micro-controller
Manufacturer
Megawin Technology
Datasheet
21. In-Application-Programming (IAP)
The device is In Application Programmable (IAP), which allows some region in the Flash memory to be used as
non-volatile data storage while the application program is running. This useful feature can be applied to the
application where the data must be kept after power off. Thus, there is no need to use an external serial
EEPROM (such as 93C46, 24C01, .., and so on) for saving the non-volatile data.
21.1. IAP-memory Boundary/Range
In fact, the operating of IAP is the same as that of ISP except the Flash range to be programmed is different.
The programmable Flash range for ISP operating is located within the AP-memory, while the range for IAP
operating is located within the configured IAP-memory.
Prior to using the IAP feature, users should configure an IAP-memory through OR1 (IAPLB) by using a universal
Writer or Programmer. The range of the IAP-memory is determined by IAPLB and the ISP starts address as
listed below.
For example, if IAPLB=0x12 and the ISP start address is 0x3800, then the IAP-memory range is located at
0x1200 ~ 0x37FF.
Refer to Section “Hardware Option” for OR1 (IAPLB).
21.2. Update the data in the IAP-memory
Because the IAP-memory is a part of Flash memory, only Page Erase, no Byte Erase, is provided for Flash
erasing. To update “one byte” in the IAP-memory, users can not directly program the new datum into that byte.
The following steps show the proper procedure:
To read the data in the IAP-memory, users can use either the “MOVC A,@A+DPTR” instruction or the Read
mode of ISP.
MEGAWIN
Step1) Save the data in the whole page (with 512 bytes) which contains the data to be updated into a buffer.
Step2) Erase this page (using Page Erase mode of ISP).
Step3) Update the wanted byte(s) in the buffer.
Step4) Program the updated data out of the buffer into this page (using Byte Program mode of ISP).
IAP lower boundary = IAPLBx256, and
IAP higher boundary = ISP start address –1.
MG84FL54B Data sheet
79

Related parts for mg84fl54b