Texas Instruments MSP430x1xx User Manual
Page 436

Flash Memory Access via JTAG and Software
C-24
C.5.3.2 Example: Programming One Word Into the Same Flash Memory Module via Software
The program execution waits after the write-to-flash instruction (MOV
#123h,&0FF1Eh) until the busy bit is reset again. If no other write-to-flash
instruction method is used the BUSY bit test may not be needed to ensure cor-
rect flash-write handling.
Lock = 0, WRT = 1
Write Data to Flash Address
Disable all interrupt sources
and Watchdog
Restore or Enable Required
Interrupt Sources and
Watchdog
Fxkey .set 03300h
Fwkey .set 0A500h
; No interrupt request may happen while the flash is programmed
MOV
#(Fwkey+WRT),&FCTL1: : Enable Write to flash
MOV
#123h,&0FF1Eh
: Write a word to flash
MOV
#Fwkey,&FCTL1
: Reset Write bit
XOR
#(Fxkey+Lock),&FCTL3
: Change Lock bit to 1
WRT = 0, Lock = 1
; Enable those interrupt sources that should be accepted