今天本来是改一个东西,要打印出一组字符,我用下面的方式做的。
const char *pt_cmdlist[]=
{
"R:read address of mcu.\n",
"W:write something into mcu.\n",
"RF:read address of flash.\n",
"WF:write something in flash.\n",
"RX:read address of flash.\n",
"\0"
};
void PrintfCmdList(void)
{
uint8 i=0;
while(*pt_cmdlist!='\0')
{
UART0ConstSendStr(pt_cmdlist[i++]);//UART0SendStr函数没问题,打印字符串常量,遇到\0结束。
}
}
运行结果很奇怪,如果我用hjtag单步运行的话,打印完全正常:
“
R:read address of mcu.
W:write something into mcu.
RF:read address of flash.
WF:write something in flash.
RX:read address of flash.
”。
但是如果下载到flash中跑,或者hjtag直接运行的话都打印出:“R:read address of mcu.u.\n”就复位了,注意,比正常的“R:read address of mcu.”多出三个字符。
请问各位怎么回事啊?