#include <iostm8s105k6.h> /* Registers and memory mapping file. */
void flashbty(unsigned char add,unsigned int dat)
{
unsigned char *eep;
eep=(unsigned char*)0x4000+add;
do
{
FLASH_DUKR = 0xAE;
FLASH_DUKR = 0X56;
}while((FLASH_IAPSR & 0x08) == 0);
*eep++=dat;
*eep++=dat>>8;
while((FLASH_IAPSR & 0x04) == 0);
}
unsigned char flashwr(unsigned char add)
{
return(*(unsigned char*)0x4000+add);
}
main()
{
unsigned char t;
flashbty(0x00,0x0203);
flashbty(0x02,0x1234);
t = flashwr(0x01); //想把这个地址当中的内容读出,但不行。怎么操作读?
while(1);
} |