智能车制作

标题: 关于变量类型选择的矛盾 [打印本页]

作者: chenrunshe_007    时间: 2009-5-9 15:07
标题: 关于变量类型选择的矛盾
本帖最后由 chenrunshe_007 于 2009-5-9 16:27 编辑

Apprently,16 bit MCU is good at dealing with the "unsigned int" variable(also we can say the "word"), so we had better use the "word" variables more often, compared with no matter the "byte" or "float" varialbes. But one rule often lead us is that we should try to use simple varialbes as much as possible, to make the program more simplfied, so that the MCU will operate more quickly. There is a contradiction here, how to judge this situation?when to use the "word" variable and when to use the "byte" variable on earth? Please help me, let's talk about it.
由于本人无聊,调试车调累了决定换一种方式提问,各位朋友大可不看上面的东西。我觉得还是有必要翻译一下:总所周知,十六位的单片机擅长处理16位变量,所以我们要尽量声明变量为unsigned int(或者word),但是编程有一条准着指导这我们:尽量用简单的变量,使程序更简洁运行跟更快。这时候就有矛盾了,到底什么时候声明变量为word好,什么时候声明变量为byte好?有什么准则么?希望大家能够帮我一把。
作者: woody1986513    时间: 2009-5-9 15:07
个人觉得够用就是了
作者: zxzxy1988    时间: 2009-5-30 12:35
差不多吧,嘿嘿,个人认为,还是简单点比较好,而且节省空间啊,呵呵,尤其是那种大数组...
作者: jackyu613    时间: 2009-5-31 00:18
选够用的就好
作者: chenrunshe_007    时间: 2009-6-15 00:08
觉得爽就行!




欢迎光临 智能车制作 (http://111.231.132.190/) Powered by Discuz! X3.2