Hello again. I know I have another thread right below this one, but I like to keep different topics separate for search-ability reasons. So I'm going to try to write a program based on lots of timers and PWM stuff.
My first question is... how do you set certain pins for output/PWM/ anything. I see this stuff all the time in sample programs, but I don't know exactly how to find it.
DDRF = 0b11111111; //configure all F ports for output *
DDRK = 0b11111111; //configure all K ports for output *
DDRB |= (1 << 0); // Set LED as output **
*From AXON test code.
** From
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=50106&highlight=timers+tutorialQuestion number 1: The "DDRF" and "DDRK" come from the datasheet, correct? How do you know to use those things? Those are just bits right?
Question number 2: This "0b11111111" is in...hex right? What does it mean and why were the two things set to this number?
Question number 3: Bits can only be "On" and "Off" right? So when you are setting these things (which I'm assuming are bits) to these hex (I think) numbers, you're essentially just turning it on or off right?
Question number 4: So to use certain features on a MCU, such as PWM or timers, you simply have to find what bits to turn on, and which to turn off, then your MCU will be set up as desired? If this is true, how can you find which bits to turn on and off? I'm assuming in the datasheet, but it's really hard to understand those things.
EDIT: So, if I see something like this in my datasheet:

Are the things on the left bits that I would set to get the desired operation on the right?
Question number 5: Why in the first two examples is there an "=" but in the third one it's "|=" I know the "|=" means DDRB = DDRB | (1 << 0), but if both all three statements are essentially doing the same thing, why have two completely different ways of doing it?
Question number 6: What's up with "(1 << 0)". I know << means shift the bit one to the left... but there are no bits there, just two numbers...

I thank anybody who can help me clear this stuff up...