Rechargeable batteries are widely used in many portable electronic products and consumer devices. This paper presents a unitized charging and discharging battery management system (UCD BMS) with distributed battery units allowing some battery units to be discharged their energy running the vehicle, while some other units are charged from the energy harvesting with photovoltaics or other technologies. The proposed UCD BMS comprises of a smart battery module, a programmable battery management (PBM) module, a charging module, and a discharging module. The PBM module contains a control circuitry and a programmable path array (PPA) module which is realized by switching circuits. The control circuitry turns on and off the corresponding switches in the PPA module forming two paths: (1) battery path; and (2) charging (discharging) path. The smart battery charger (load) included in the charging (discharging) path is then connected to the battery path which includes the smart battery units to be charged (discharged). The proposed PBM provides various output voltages so that the smart battery module is used more flexibly and enhances the utilization rate of the discharge energy, improving the overall power efficacy of the smart battery module. The PBM can also be applied for battery balancing and fault-tolerant BMS design.