24F16KA102,参看手册,编译使用内部ee通不过,哪位有用过呢,请指导下。

2020-02-08 09:21发布

int __attribute__ ((space(eedata))) eeData = 0x1234; // Variable located in EEPROM

unsigned int offset;


// Set up NVMCON to erase one word of data EEPROM

NVMCON = 0x4058;

// Set up a pointer to the EEPROM location to be erased

TBLPAG = __builtin_tblpage(&eeData); // Initialize EE Data page pointer


offset = __builtin_tbloffset(&eeData); // Initizlize lower word of address

__builtin_tblwtl(offset, 0); // Write EEPROM data to write latch

asm volatile ("disi #5"); // Disable Interrupts For 5 Instructions

__builtin_write_NVM(); // Issue Unlock Sequence & Start Write Cycle



error: Argument to __builtin_tblpage() is not the address
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。