Lets say I use 4 pins on PORTB (we're talking 16f84a here) connected as data lines to a LCD display in 4-bit mode. If I want to send something to the LCD I would to something like this:
-movlw 'H'
-swap the nibbles
-AND with 0x0f to clear out the upper bits
-movwf PORTB
But this would make all ouput use of the other 4 pins on PORTB impossible wouldn't it? I mean this would set those pins to zero no matter if I want to or not. How are input pins affected? How would you solve this?
I guess there is a simple solution for this that I have missed. I don't want to check all the bits of the swaped byte and then manually set or clear all the pins, that feels like a pretty cycle-consuming method.
-movlw 'H'
-swap the nibbles
-AND with 0x0f to clear out the upper bits
-movwf PORTB
But this would make all ouput use of the other 4 pins on PORTB impossible wouldn't it? I mean this would set those pins to zero no matter if I want to or not. How are input pins affected? How would you solve this?
I guess there is a simple solution for this that I have missed. I don't want to check all the bits of the swaped byte and then manually set or clear all the pins, that feels like a pretty cycle-consuming method.