In the past years the study of continuous or discontinuous piecewise differential systems has attracted significant interest, due to their wide use to model many natural phenomena. Important questions such as finding an upper bound for the number of limit cycles of such systems and their possible configurations have been considered by many authors. These problems are known as the extension of the second part of the 16th Hilbert’s problem to the piecewise differential systems. In this paper, we solve an extension of the second part of the 16th Hilbert’s problem for two families of discontinuous piecewise differential systems separated by the straight line [Formula: see text]. The first family is formed by a linear center and a cubic Hamiltonian isochronous center, and the second family is formed by cubic Hamiltonian isochronous centers. As a result we prove that the first family can exhibit [Formula: see text] or [Formula: see text] limit cycle, for the second one there are either three limit cycles or no limit cycles. We also show that there are examples of all types of these systems with one or three limit cycles.