Saxdude,
Please forgive me if I am being too elementary here, but I want to start at the beginning in case there are other readers who need this information.
Registers, like those controlling a timer, typically contain multiple fields. Each field is made up of one or more bits. For example, a field that can have four different values would have two bits, and the possible values would be 00, 01, 10, and 11.
In your program, it's easy to have the constants B00, B01, etc., but those have the two bits in the least significant bits of the constant. In the register, those bits might be three bits to the left, like this:0 0 0 X X 0 0 0
where X X represents those two bits.
Using the shift operator repositions those bits in the number. For the above example, to put the value 10 into that field on the register, you would sayREG = B10 << 3;
Of course, that would put zeroes in the other six bits of the register. If you wanted to put something besides zeroes in other fields in the register, you would use the OR operator ( | ) to set those values, as in the example in your first post.
So, the point of the shift is to move the bit or bits into the correct position to set a field in a register.
There is another way to do it, without the shifts. You could pre-define constants for each value in the field. The constants would have the bits already in the right place. You can then combine constants with OR operators to build the correct value for the register. For example, let's say that the two bits I mentioned above set one of four different modes for the register. Let's also say that the least significant bit turns a function on or off. We could define these constants and use them like this:
#define REG_MODE_A B00000000
#define REG_MODE_B B00001000
#define REG_MODE_C B00010000
#define REG_MODE_D B00011000
#define REG_OFF B00000000
#define REG_ON B00000001
// turn function on, mode c
REG = REG_ON | REG_MODE_C;
// turn function off, mode b
REG = REG_OFF | REG_MODE_B;
// etc.
As you can imagine, with all of the fields and values, just thinking up names for all of those constants can be quite a chore! That's why it's sometimes easier to just code up a shift.
-Mike