So what I need to do is a three-state logic application using a PIC18F4550 a 74LS244 and a HCT573. The problem here is that I need to use a single port of the PIC as both inputs and outputs. I need to use 7 pins of the port because I need to connect a 7-segment-display and four of those pins have to work as inputs at the same. Those inputs are connected to the 74LS244 and from there to four push buttons so when I introduce the numbers from 0 to 15 in binary with them in the display must be shown that number or letter for the cases from 10 to 15. The display is connected to the HCT573 and from there to the PIC. The main problem here is that I don't really know how to use the port as inputs and outputs at the same time. The software that I'm using for write the code is CCS Compiler (PIC C Compiler).