STM8L101F3P的程序无法烧写,求高人指点,以下是我的代码:
void main(void){
DelayMS(2000);
RST_CR = 0xD0; //设置PA1 为general purpose output
 

A_DDR = 0x0F; // PA0-3输出
 

A_CR1 = 0x0F; // 0x0F 推挽输出
 

A_CR2 = 0x00; // External interrupt disabled // out 2MHz
 

A_ODR = 0x00; // PA0-3 out L
while (1){
}
}
设置RST_CR = 0xD0后, 第一次可以烧写程序,但第二次就再也连接不通了,电脑提示错误:**Connection error(usb://usb): swim error[30006]:comm init error:chip does not answer
自己解决吧:现在只能报废一颗IC了,再次修改了程序,在 RST_CR = 0xD0;前面增加了2秒延时,方便烧写程序
void DelayMS(unsigned int ms){
unsigned char i;
while(ms != 0){
for(i=0;i<255;i++){}
for(i=0;i<76;i++){} // 75-77
ms--;
}
}
一周热门 更多>