The standard way to do this is read-modify-write. To change lower 4 bits only, read all 8 bits, strip off lower 4 bits, add your new value, then write 8 bits back. To change upper 4 bits only is more complicated, but also doable (hint - use shift left / shift right). Still, this is unnecessarily complicated for what you want to do... just do it bit by bit. Place the code in a subroutine and call it to read/write your values for simplicity - use it like a new command.
Bookmarks