本帖最后由 xbyu520 于 2014-2-16 15:37 编辑
这个是新华龙网站下载的参考代码。
// FLASH_ByteRead
////
// Return Value :
// 1) unsigned char - byte that was read from Flash
// Parameters :
// 1) FLADDR addr - target address to write to
// range is 0 to (FLASH_TEMP-1)
//
// This routine reads a <byte> from the linear FLASH address <addr>.
//
//
unsigned char FLASH_ByteRead (FLADDR addr)
{
bit EA_SAVE = EA; // Preserve EA
char code * data pread; // FLASH read pointer
unsigned char byte;
EA = 0; // Disable interrupts
pread = (char code *) addr;
byte = *pread; // Read the byte
EA = EA_SAVE; // Restore interrupts
return byte;
}
|