A new analytical potential function for doubly charged diatomic ions is proposed as V(R)=(∑k n=0anRn-1)exp(-ak+1R)+C/R,where an, ak+1 and C are parameters, and R is the nuclear distance. This function can be used to describe the potential curves for doubly charged diatomic ions with both potential minimum and maximum, or without any stationary point. As examples, potential functions of this form for ground states of BH2+, He22+ and HF2+ have been derived.The calculations using the theoretical method QCISD with basis set 6-311++G* have shown that the potential minimum of BH2+is at Rmin=0.147nm, the maximum at Rmax=0.185nm, and ΔE = Emax - Emin=0.062 eV; for He22+Rmin=0.0736nm, Rmax=0.105nm, and ΔE = Emax - Emin=0.71 eV. It is found that the potential curve for HF2+ is one with a singly repulsive branch. The force constants and spectroscopic data for BH2+ and He22+ have also been worked out.