 RE: bits are not setting
Per Westermark
1) Wny did you create a new thread. What was wrong with your
previous thread?
http://www.keil.com/forum/19275/
2) In the previous thread, I did ask you about your bitclear() -
you didn't respond. Now, we have yet another thread with an identical
bitclear(). Have you still not spent any time considering if your
bitclear() really does what you intend it to do? Do you really want a
bitclear() that clears all bits but one? Wouldn't you expect
bitclear() to just clear one single bit, while leaving the other bits
untouched? What was your result of trying out the little example I
gave you in the previous thread - what does your bitclear() do?
3) When you start working at the bit level on integers, you should
make it a rule to use unsigned integer types to avoid potential
problems with the most significant bit potentially being a sign bit.
Note that it is compiler-specific if char is signed or unsigned. Much
better to use "unsigned char", or (if you have stdint.h) consider
using uint8_t.
4) Are you happy with the indenting of your code? Does it contain
any indent at all, or did you use tab characters - tabs do often not
work when posting source code on web forums. Whatever the problem is,
you should have been able to spot it and made sure your posted code
did intent properly to allow readers to easily see what you have
written.
5) If reading unknown code, what valuable insights would you get
when you see the variable name "ibase"? Do you fell that it is a very
descriptive name? Can you describe how the name describes the meaning
of the variable?
6) Maybe you could spend some time, and count the number of
comments you can find in your source code. Do you think that maybe
you have too many comments?
7) How many times do you plan to run the first part of
main()?
void main(void) {
if(firstscandone==0) init1();
....
}
Is "firstscandone" expected to have different values on different
runs of the program?
|