This is a code from TI example for CCE:
void write_SegA (char value)
{
char *Flash_ptr; // Flash pointer
unsigned int i;
Flash_ptr = (char *) 0x1080; // Initialize Flash pointer
FCTL1 = FWKEY + ERASE; // Set Erase bit
FCTL3 = FWKEY; // Clear Lock bit
*Flash_ptr = 0; // Dummy write to erase Flash segment
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i=0; i<128; i++)
{
*Flash_ptr++ = value; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
can you tell me, why the pointer is a char?
that means it can contain only half of the address, and here: Flash_ptr = (char *) 0x1080;
They put the 0x80 to the pointer, so how it works??
and the variable i can be easily unsigned char - they don't need 2 bytes for it.
Greetings