EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #82 background imageLoading...
Page #82 background image
82
__bis_SR_register(GIE); // Enable Interrupts
FCTL1 = FWKEY; // Lock
FCTL3 = FWKEY + LOCK; // Set Lock bit
}
void Flash_Write_Char(unsigned int address, char value)
{
char *FlashPtr = (char *)address;
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
FCTL3 = FWKEY; // Clear Lock bit
__bic_SR_register(GIE); // Disable Interrupts
*FlashPtr = value; // Save Data
while((FCTL3 & BUSY) == BUSY); // Busy
__bis_SR_register(GIE); // Enable Interrupts
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
char Flash_Read_Char(unsigned int address)
{
char value = 0x00;
char *FlashPtr = (char *)address;
value = *FlashPtr;
return value;
}
void Flash_Write_Word(unsigned int address, unsigned int value)
{
unsigned int *FlashPtr = (unsigned int *)address;
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
FCTL3 = FWKEY; // Clear Lock bit
__bic_SR_register(GIE); // Disable Interrupts
*FlashPtr = value; // Save Data
while((FCTL3 & BUSY) == BUSY); // Busy
__bis_SR_register(GIE); // Enable Interrupts
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
unsigned int Flash_Read_Word(unsigned int address)
{
unsigned int value = 0x0000;
unsigned int *FlashPtr = (unsigned int *)address;
value = *FlashPtr;
return value;
}

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals