中级会员
- 积分
- 458
- 威望
- 246
- 贡献
- 122
- 兑换币
- 144
- 注册时间
- 2013-9-12
- 在线时间
- 45 小时
|
2#
楼主 |
发表于 2014-2-17 21:32:07
|
只看该作者
编译时出了以下问题
Warning[Pa084]: pointless integer comparison, the result is always true F:\可以跑得程序\2.16 - 超声波\src\drivers\mcg\mcg.c 121
Warning[Pa084]: pointless integer comparison, the result is always true F:\可以跑得程序\2.16 - 超声波\src\drivers\mcg\mcg.c 122
Warning[Pa084]: pointless integer comparison, the result is always true F:\可以跑得程序\2.16 - 超声波\src\drivers\mcg\mcg.c 136
Warning[Pa084]: pointless integer comparison, the result is always true F:\可以跑得程序\2.16 - 超声波\src\drivers\mcg\mcg.c 137
/* 这里提示警告,但是安全的,是为了安全才故意添加进去 */
if (opt <= 1 * MAX_BUS_CLK) mcg_div.bus_div = 0; // bus = MCG
else if(opt <= 2 * MAX_BUS_CLK) mcg_div.bus_div = 1; // bus = MCG/2
这一行有问题 else if(opt <= 3 * MAX_BUS_CLK) mcg_div.bus_div = 2; // bus = MCG/3
这一行有问题 else if(opt <= 4 * MAX_BUS_CLK) mcg_div.bus_div = 3; // bus = MCG/4 这里提示警告,不过没关系
/* 这里提示警告,但是安全的,是为了安全才故意添加进去 */
if (opt <= 1 * MAX_FLASH_CLK) mcg_div.flash_div = 0; // flash = MCG
else if(opt <= 2 * MAX_FLASH_CLK) mcg_div.flash_div = 1; // flash = MCG/2
else if(opt <= 3 * MAX_FLASH_CLK) mcg_div.flash_div = 2; // flash = MCG/3
else if(opt <= 4 * MAX_FLASH_CLK) mcg_div.flash_div = 3; // flash = MCG/4
else if(opt <= 5 * MAX_FLASH_CLK) mcg_div.flash_div = 4; // flash = MCG/5
else if(opt <= 6 * MAX_FLASH_CLK) mcg_div.flash_div = 5; // flash = MCG/6
else if(opt <= 7 * MAX_FLASH_CLK) mcg_div.flash_div = 6; // flash = MCG/7
else if(opt <= 8 * MAX_FLASH_CLK) mcg_div.flash_div = 7; // flash = MCG/8
这一行有问题 else if(opt <= 9 * MAX_FLASH_CLK) mcg_div.flash_div = 8; // flash = MCG/9
这一行有问题 else if(opt <= 10 * MAX_FLASH_CLK) mcg_div.flash_div = 9; // flash = MCG/10
else mcg_div.flash_div = 15; // flash = MCG/16
|
|