In this paper, a power flow management algorithm for photovoltaic system feeding DC and AC loads is presented. PV being a major energy source enables the DC loads to be connected directly to the DC bus. A grid connected PV system involves one power source (PV array), one power sink (load) and two power sources/sink (utility and battery), and hence a power flow management system is required to balance the power flow among these sources. A unique control algorithm is developed for selecting the operating mode of the bidirectional converter by sensing the battery voltage. The bidirectional converter has three modes of operation namely, the rectifier mode, inverter mode and the voltage control mode. In both the rectifier and inverter modes of operation, the converter current is controlled by employing a hysteresis current controller and unity power factor is achieved in both the cases. In voltage control mode, the converter regulates the inverter voltage and supplies the reactive power to the grid. Detailed simulation studies are carried out on a single phase bidirectional converter in MATLAB/Simulink environment. The viability of the scheme has been ascertained by performing experimental studies on a laboratory prototype. The control strategy is digitally implemented on an Altera Cyclone II FPGA board and the algorithm is verified for different modes of operation by varying the load and the relevant results are presented.