Sieh mal hier, vieleicht hilft dir das: www.mikrocontroller.net/articles/Bitmanipulation