Let X/S be a smooth morphism of schemes in characteristic p and let $(E,\nabla)$ be a sheaf of $\mathcal{O}_{X}$-modules with integrable connection on X. We give a formula for the cohomology sheaves of the de Rham complex of $(E,\nabla)$ in terms of a Higgs complex constructed from the p-curvature of $(E,\nabla)$. This formula generalizes the classical Cartier isomorphism, with which it agrees when $(E,\nabla)$ is the constant connection.