itoa(ADC_ConvertedValue[0], ADC_STR1,10);
itoa(ADC_ConvertedValue[1], ADC_STR2,10);
一直说ADC_STR1没有定义:
..\..\Output\Template.axf: Error: L6218E: Undefined symbol ADC_STR1 (referred from app.o).
..\..\Output\Template.axf: Error: L6218E: Undefined symbol ADC_STR2 (referred from app.o).
可是在前面我已经定义了它:
extern unsigned char ADC_STR1[5];
extern unsigned char ADC_STR2[5];
这是什么原因?
itoa函数如下:
char *itoa(int value, char *string, int radix)
{
int i, d;
int flag = 0;
char *ptr = string;
/* This implementation only works for decimal numbers. */
if (radix != 10)
{
*ptr = 0;
return string;
}
if (!value)
{
*ptr++ = 0x30;
*ptr = 0;
return string;
}
/* if this is a negative value insert the minus sign. */
if (value < 0)
{
*ptr++ = '-';
/* Make the value positive. */
value *= -1;
}
for (i = 10000; i > 0; i /= 10)
{
d = value / i;
if (d || flag)
{
*ptr++ = (char)(d + 0x30);
value -= (d * i);
flag = 1;
}
}
/* Null terminate the string. */
*ptr = 0;
return string;
}
|
|