ade7169f16 Analog Devices, Inc., ade7169f16 Datasheet - Page 100

no-image

ade7169f16

Manufacturer Part Number
ade7169f16
Description
Single-phase Energy Measurement Ic With 8052 Mcu, Rtc And Lcd Driver
Manufacturer
Analog Devices, Inc.
Datasheet
ADE7169F16
Table 92. Flash High Byte Address SFR (EADRH, 0xC7)
Flash functions
Sample 8051 code is provided below to demonstrate how to use
the Flash functions. For these examples, the byte of flash
memory, 0x3C00 is accessed.
Write Byte: Write F3H into flash memory byte 0x3C00.
MOV EDATA, #F3h
MOV EADRH, #3Ch
MOV EADRL, #00h
MOV FLSHKY, #3Bh
MOV ECON, #01H
Erase Page: Erase the page containing flash memory byte
0x3C00.
MOV EADRH, #3Ch
MOV EADRL, #00h
MOV FLSHKY, #3Bh
MOV ECON, #02H
Erase All: Erase all of the 16kbyte flash memory
MOV FLSHKY, #3Bh
MOV ECON, #03H
Read Byte: Read flash memory byte 0x3C00.
MOV EADRH, #3Ch
MOV EADRL, #00h
MOV FLSHKY, #3Bh
Bit
Location
7-0
Bit
Mnemonic
EADRH
; Data to be written
; Write Flash security key.
; Write Byte
; Select page through byte address
; Write Flash security key.
; Erase Page
; Write Flash security key.
; Erase All
; Write Flash security key.
; Setup byte address
; Setup byte address
0
Default
Value
EADRL.4: Page 20
EADRL.3: Page 19
EADRL.2: Page 18
EADRL.1: Page 17
EADRL.0: Page 16
Flash pointer high byte address
This SFR is also used to write the write/erase protection bits for pages 24
to 31 of the Flash memory – see Protecting the Flash. Clearing the bit
enables the protection.
EADRH.7: Page 31
EADRH.6: Page 30
EADRH.5: Page 29
EADRH.4: Page 28
EADRH.3: Page 27
EADRH.2: Page 26
EADRH.1: Page 25
EADRH.0: Page 24
Description
Rev. PrD | Page 100 of 140
MOV ECON, #04H
; Data is ready in EDATA register
Erase Page and Write Byte: Erase the page containing flash
memory byte 0x3C00 and then write F3H to that address. Note
that the other 511 bytes in this page will be erased.
MOV EDATA, #F3h
MOV EADRH, #3Ch
MOV EADRL, #00h
MOV FLSHKY, #3Bh
MOV ECON, #05H
PROTECTING THE FLASH
Two forms of protection are offered for this flash memory: read
protection and write/erase protection. The read protection
ensures that any pages that are read protected will not be able to
be read by the end user. The write protection ensures that the
flash memory cannot be erased or written over. This protects
the end system from tampering and can prevent the code from
being overwritten in the event of a runaway program.
Write/erase protection is individually selectable for all of the 32
pages. Read protection is selected in groups of 4 pages. See
Figure 66 for the groupings. The protection bits are stored in
the last flash memory locations, addresses 0x3FFA through
0x3FFF– see Figure 68. 4 bytes are reserved for write/erase
protection, 1 byte for read protection and another byte to set the
protection security key. The user must enable read and
write/erase protection for the last page at a minimum for the
entire protection scheme to work.
Preliminary Technical Data
; Read Byte
; Data to be written
; Setup byte address
; Write Flash security key.
; Erase page and then write byte

Related parts for ade7169f16