Quote:
Originally Posted by MPaulHolmes
...
P.S.: Sorry about the nonstandard way of setting A/D channel for conversion. It's sort of like I was on a desert island, and was just programming as if there were no standards at all, just reading the ridiculous 308 page documentation and making stuff up as I went.
....
|
Paul,
Some of us in here are proffesional uC programmers. Some (including myself) are not. It is however benefic if more than one pair of eyes (hopefully connected to brains) are checking up the code. In order to allow everibody to understand faster we should think about refactoring the existing code to use as much as posible the same programming style/conventions. It's usefull in more than one way.
For example, the code:
Code:
ADCSRA |= 64; // 64 = 01000000. So, this sets the ADSC Start Conversion Bit.
while (ADCSRA & 64); // Do nothing until the conversion is done.
could be written as:
Code:
ADCSRA |= _BV(ADSC); // Set Bit7 on ATMega8. So, this sets the ADSC Start Conversion Bit.
while (ADCSRA & _BV(ADSC)); // Do nothing until the conversion is done.
Let the standard include files worry about which bit is ADSC and our code will perform the same on all uCs ...
We know you are bussy testing and improving. Let others (the pro-people preferably) take care of the refactoring and just concentrate on your work. But a group will not be able to work on the same code (not reliably) using snipplets in a forum. Please use the central repository: you will be able to see very fast what has changed, who did it and why, even decide to go back.
The use the example above here's how it looks (diff betwenn versions 7 and 8 of the file in the svn):
Changes r7:r8
Sorry if it sounds like a lecture ...