Upper bounds for energies of spherical codes of given cardinality and separation