beautypg.com

2 in-application programming functions, 1 urom_flashwrite, 3 urom_flasheraseall – Maxim Integrated MAX31782 User Manual

Page 216: 21 .2 in-application programming functions -3, 2in-applicationprogrammingfunctions, 1urom�flashwrite, 2urom�flasherasepage, 3urom�flasheraseall

background image

MaximIntegrated 21-3

MAX31782 User’s Guide

Revision 0; 8/11

21.2In-ApplicationProgrammingFunctions

21.2.1UROM�flashWrite

Notes:
• This function uses two stack levels to save and restore values .
• If the watchdog reset function is active, it should be disabled before calling this function .
• Interrupts are disabled while in this function .
• If the flash location has already been programmed to a non-FFFF value, this function returns with an error (Carry

set) . In order to reprogram a flash location, the location must first be erased by calling UROM_flashErasePage or
UROM_flash EraseAll .

21.2.2UROM�flashErasePage

Notes:
• If the watchdog reset function is active, it should be disabled before calling this function .
• Interrupts are disabled while in this function .
• When calling this function from flash, care should be taken that the return address is not in the page which is being

erased .

21.2.3UROM�flashEraseAll

Notes:
• If the watchdog reset function is active, it should be disabled before calling this function .
• Interrupts are disabled while in this function .
• This function can only be called by code running from the RAM . Attempting to call this function while running from

the flash results in an error .

Function

UROM_flashWrite

Summary

Programs a single word of flash memory

Inputs

A[0]: Word address in program flash memory to write .
A[1]: Value to write to flash memory .

Outputs

Carry: Set on error and cleared on success

Destroys

PSF, LC[1]

Function

UROM_flashErasePage

Summary

Erases (programs to FFFFh) a 512-byte page of flash memory .

Inputs

A[0]: Word address located in the page to be erased . (The page number is the upper 8 bits of A[0] .)

Outputs

Carry: Set on error and cleared on success .

Destroys

PSF, LC[1], GR, AP, APC, A[0]

Function

UROM_flashEraseAll

Summary

Erases (programs to FFFFh) all locations in flash memory

Inputs

None

Outputs

Carry: Set on error and cleared on success .

Destroys

PSF, GR, LC[1], LC[0], AP, APC, A[0]