KlausST
Advanced Member level 7
Hi,
the port register doesn´t know about the OR-ing.
So it still accesses 4 data bits, 2 control bits, one PWM bit and one unsued bit.
With the OR you definitely clear 4 bits. But this is not what the OP wants. He wants the bits to be unchanged.
A 1 should be unchanged and a 0 should be unchanged.
As said before: a read-modify-write (RMW) is the way to go.
Read the previous port status, modify just the (4) bits you need to change (leave the other bits unchanged), write data to the port.
Klaus
the port register doesn´t know about the OR-ing.
So it still accesses 4 data bits, 2 control bits, one PWM bit and one unsued bit.
With the OR you definitely clear 4 bits. But this is not what the OP wants. He wants the bits to be unchanged.
A 1 should be unchanged and a 0 should be unchanged.
The OP is correct on this.When i send data to port C. It will make PORTC lower nibble 0000. But i don't want to make these pins 0. i want to leave these pins in previous status.
As said before: a read-modify-write (RMW) is the way to go.
Read the previous port status, modify just the (4) bits you need to change (leave the other bits unchanged), write data to the port.
Klaus