bit EA_Save_bit = 1;
void Clear_BOF(void)
{
EA_Save_bit = EA;
EA = 0;
TA = 0xAA;
TA = 0x55;
PMCR &= 0xF3;
EA = EA_Save_bit;
}
//-----------------------------------------------------------------------------------------------------------
void Enable_ISP_Mode(void)
{
/* Enable ISP */
ISPCN=0x30;
EA_Save_bit = EA;
EA = 0;
TA = 0xAA;
TA = 0x55;
CHPCON |= 0x01;
EA = 1;
Trigger_ISP();
}
//-----------------------------------------------------------------------------------------------------------
void Disable_ISP_Mode(void)
{
/* Disable ISP */
ISPCN=0x30;
Trigger_ISP();
EA_Save_bit = EA;
EA = 0;
TA = 0xAA;
TA = 0x55;
CHPCON &= 0xFE;
EA = 1;//EA_Save_bit;
}
//-----------------------------------------------------------------------------------------------------------
void Trigger_ISP(void)
{
EA_Save_bit = EA;
EA = 0;
EA = 0;
TA = 0xAA;
TA = 0x55;
ISPTRG |= 0x01;//start
EA = 1;//EA_Save_bit;
}
//-----------------------------------------------------------------------------------------------------------
void Erase_DATA(void)
{
static uint u16Count;
Enable_ISP_Mode();
ISPCN = ERASE_ALL_DATA;
for(u16Count=96;u16Count<128;u16Count++)
{
ISPAL = LOBYTE(u16Count*128); // 96*128=12288=0x3000
ISPAH = HIBYTE(u16Count*128); // 96*128=12288=0x3000
Trigger_ISP();
}
Disable_ISP_Mode();
}
//-----------------------------------------------------------------------------------------------------------
void Read_DATA(void)
{
uchar j = 0;
Enable_ISP_Mode();
ISPAL = 0x00;
ISPAH = 0x30;
ISPCN = FLASH_READ_DATA;
if(j < 4)
{
Trigger_ISP();
status_buff.flash_value[j] = ISPFD;
ISPAL++;
if(ISPAL == 0)
{
ISPAH++;
}
}
j++;
Disable_ISP_Mode();
}
//-----------------------------------------------------------------------------------------------------------
void Program_DATA(void)
{
uchar j = 0;
Enable_ISP_Mode();
ISPAL = 0x00;
ISPAH = 0x30;
ISPCN = BYTE_PROGRAM_DATA;
if(j < 4)
{
ISPFD = status_buff.flash_value[j];
Trigger_ISP();
ISPAL++;
if(ISPAL == 0)
{
ISPAH++;
}
}
j++;
Disable_ISP_Mode();
}
有大神可以帮我指点上面的程序在N79E815芯片中为什么没办法工作呢?
本人想要将键值保存到下次开机显示,请问我该怎么修改?@版主
|