//**********************************************************
下面是用两种方法,读flash的内容:
volatile unsigned char code data_flash[128] _at_ 0x4700;
unsigned int Read_APROM_BYTE(unsigned int code *u16_addr)
{
unsigned int rdata;
rdata = *u16_addr; //>>8,不移位
return rdata;
}
//*********************************************************
//*********************************************************
下面是主函数写,并读,再显示出来
while(1)
{
for(i=0;i<128;i++)
{
showshuzi_8X16( 32, 12, (data_flash>>4)&0x0F,BLACK,WHITE);
showshuzi_8X16( 40, 12, data_flash&0x0F,BLACK,WHITE); //这两行是直接显示数组的数据
rus_read_eeprom = Read_APROM_BYTE((unsigned int code *)(0x4700+i));//读地址方法
showshuzi_8X16( 16, 30, (rus_read_eeprom>>12)&0x0F,RED,WHITE);
showshuzi_8X16( 24, 30, (rus_read_eeprom>>8)&0x0F,RED,WHITE);
showshuzi_8X16( 32, 30, (rus_read_eeprom>>4)&0x0F,RED,WHITE);
showshuzi_8X16( 40, 30, rus_read_eeprom&0x0F,RED,WHITE); //这四行是读地址,显示数组的数据
HOLD_DISP();//等待,按下按键再运行
}
}
|