can you read or write 8 bits at once?

PORTC = 21; //set bits 0,2,4 to a 1, the rest to 0.

A far better way to accomplish this would be to use binary. Typically it is the bits that are important, not the numerical value. When you try to do the conversion yourself the very best you can do is get it correct. The compiler gets it correct every time.

PORTC = B00010101; //set bits 0,2,4 to a 1, the rest to 0.

For some unfathomable reason this is not possible with some C compilers but as far as I know it works ok with the Arduino.

Don

1 Like