求助MA805-64 存储数据ISP/IAP编程时候不能保存数据
时间:10-02
整理:3721RD
点击:
求助哪位大能帮我分析下我遇到的情况,用芯片MA805-64的AP保存数据的时候,代码都是根据文档书写,但就是不能保存数据,但原先用MA805-24的时候保存数据就完全没有问题,数据都正常。
代码如下:
#define IAP_READ 0X01
#define IAP_WRITE 0X02
#define IAP_ERASE 0X03
#define IAP_ADDRESS 0X6000
void ISP_enable()
{
EA = 0;
ISPCR &= 0X7F;
ISPCR |= 0X80;
}
void ISP_disable()
{
IFMT = 0x00;
ISPCR &= 0X7F;
SCMD = 0X00;
// EA = 1;
}
void ISP_start()
{
ISP_enable();
SCMD &= 0X00;
SCMD = 0X46;
_nop_();
SCMD = 0XB9;
_nop_();
}
unsigned char IAP_read(unsigned int IAP_startADDR)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_READ;
ISP_start();
ISP_disable();
return(IFD);
}
void IAP_write(unsigned int IAP_startADDR, unsigned char write_data)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_WRITE;
IFD = write_data;
ISP_start();
ISP_disable();
}
void IAP_erase(unsigned int IAP_startADDR)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_ERASE;
ISP_start();
ISP_disable();
}
MA805-64调用上面的代码就是无法保存数据,但用MA805-24就可以
IAP_write(IAP_ADDRESS + 0x00, 0x55);
请哪位能帮忙分析下,或能帮忙解答下,谢谢!
代码如下:
#define IAP_READ 0X01
#define IAP_WRITE 0X02
#define IAP_ERASE 0X03
#define IAP_ADDRESS 0X6000
void ISP_enable()
{
EA = 0;
ISPCR &= 0X7F;
ISPCR |= 0X80;
}
void ISP_disable()
{
IFMT = 0x00;
ISPCR &= 0X7F;
SCMD = 0X00;
// EA = 1;
}
void ISP_start()
{
ISP_enable();
SCMD &= 0X00;
SCMD = 0X46;
_nop_();
SCMD = 0XB9;
_nop_();
}
unsigned char IAP_read(unsigned int IAP_startADDR)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_READ;
ISP_start();
ISP_disable();
return(IFD);
}
void IAP_write(unsigned int IAP_startADDR, unsigned char write_data)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_WRITE;
IFD = write_data;
ISP_start();
ISP_disable();
}
void IAP_erase(unsigned int IAP_startADDR)
{
IFADRH = (unsigned char)(IAP_startADDR >> 8);
IFADRL = (unsigned char)(IAP_startADDR);
IFMT &= 0XF8;
IFMT |= IAP_ERASE;
ISP_start();
ISP_disable();
}
MA805-64调用上面的代码就是无法保存数据,但用MA805-24就可以
IAP_write(IAP_ADDRESS + 0x00, 0x55);
请哪位能帮忙分析下,或能帮忙解答下,谢谢!