I’m just looking for a little education here. I have several programs that use something like this to set register bits (actually, these bits in particular on an ATTiny85).
CLKPR = 1<<CLKPCE | 0<<CLKPS3 | 0<<CLKPS2 | 0<<CLKPS1 | 0<<CLKPS0; CLKPR = 0<<CLKPCE | 1<<CLKPS1;
I’m trying to learn how to use timer/counter1 to manipulate PWM frequency so I can get whatever frequency I want. From the datasheet, these particular bits are part of the register CLKPR and what I am doing is setting the CLKPS1 bit (to get a prescaler of 4).
My question is can I use something like this
CLKPR = B10000000; CLKPR = B00000010;
to achieve the same thing. If so, is there a particular name for this type of manipulation (like “bit shifting” in the above code)?
I’m thinking I can clean up my code if I can set all bits at once instead of having to set each one individually.