View Single Post
Old 06-07-2009, 08:31 PM   #1608 (permalink)
squiggles
EcoModding Apprentice
 
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 2 Times in 2 Posts
Being picky again, and I am sure I am stating something that has been said before. However in my opinion this

PORTB &= (128 + 64 + 32 + 16 + 8 + 4 + 1); // this sets PB1 (the pwm output) to 0 at startup. Notice '2' is missing!


Is better written as
PORTB &= 0xFD; // this clears PB1 (the pwm output) at startup.

I appreciate that hexadecimal may be unfamiliar at first, believe me if you are going to be programming regularly it is highly advisable to become familiar with HEX.
Also in programming speak you don't "set" something to "0".
  Reply With Quote