Changing direction of a 8 bit port using Code

we are trying to interface the XBEE900HP module with one of our other MCU using parallel interface of 8 bits(8GPIO). just wondering is there a way of changing the direction of the port using the code? because xbee will transmit on the parallel interface but it also need to receive, therefore need to change the direction of the GPIO regularly .