Quote Originally Posted by AndrewC View Post
One project I'm working on is a controller for a linear stepper driver. The driver has 4 configuration bits setting microstepping mode, power and direction. So if I set these as adjacent bits in a register (eg B.0 thru B.3) can I write them (and only them) in one go ? I know I can write the whole port in one go but how about a subset of the port ?

thanks, Andrew
Read the port into a temp variable, change the bits, then write it back. Even if the port is an output, you'll still be able to read the last thing you output (assuming that whatever is connected to the pin isn't overdriving that pin and pulling it the wrong way).