port_d = 0xF0; // Preload RD0-RD3 with 0000
TRISD = 0xF0; // Set the tris register
As you can see, RD4-RD7 are inputs, while RD0-RD3 are outputs.
I now want to change RD4-RD7 into outputs (i'm doing Enhanced CCP, but that isn't relevant to my question).
How do i preserve the values in RD0-RD3?
I've thought of:
temp_d = port_d;
temp_d = temp_d | 0xF0; // next manipulate the bits in temp_d
port_d = temp_d;
set_tris_d(0x00);
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum