|
adc = GetADC();
/* 注意: 末尾只有 \r回车, 没有\n换行,可以使PC超级终端界面稳定在1行显示 */
{
/* 超级终端界面上会显示一个不断旋转的字符
增加这个功能,是为了避免程序死机的假象,因为ADC采样值很稳定
*/
static uint8_t pos = 0;
if (pos == 0)
printf("|");
else if (pos == 1)
printf("/");
else if (pos == 2)
printf("-");
else if (pos == 3)
printf("\\"); /* 注意:这个特殊字符需要转义 */
if (++pos >= 4)
{
pos = 0;
}
printf(" PC4口线ADC采样值 = %5d , 电压 = %4dmV\r",
adc, ((uint32_t)adc * 2500) / 4095);
根据历程提示,始终达不到红色字体说明的效果,这段代码是不是有问题?
|
|