I don't know the compiler you are using, but with mine it's
set_tris_b(0xF0); or whatever.
The TRIS registers are the only way to enable/disable the output drivers in the PIC chip itself.
You may have to use compiler options to force it to allow you to control the TRIS settings, mine defaults to adding code to set the TRIS bits every time you read or write a port or port bit unless you explicitly disable this, which for the CCS compiler is:
#use fast_io(ALL)
You can then set all the TRIS registers to suit your hardware design & change them yourself as needed for I/O operations.
set_tris_b(0xF0); or whatever.
The TRIS registers are the only way to enable/disable the output drivers in the PIC chip itself.
You may have to use compiler options to force it to allow you to control the TRIS settings, mine defaults to adding code to set the TRIS bits every time you read or write a port or port bit unless you explicitly disable this, which for the CCS compiler is:
#use fast_io(ALL)
You can then set all the TRIS registers to suit your hardware design & change them yourself as needed for I/O operations.