The specification of cyber-physical systems usually relies on continuous functions over dense real numbers whereas their implementation is discrete. Proving the correctness of the discrete implementation with respect to the continuous specification remains a challenge in the presence of dense real numbers. In this paper, we propose a refinementbased formal method, relying on Event-B, for such developments. We illustrate our proposal with the development of a simple stability controller for a generic plant model. The continuous function that models the system behavior is refined as a discrete model of the same kind preserving stability expressed as a safety invariants of the continuous model. The obtained discrete model uses discrete time (instants modeled on N), whereas the continuous model is based on dense time (on R). The Rodin Platform, together with the Theory plug-in handling the Real datatype and its properties supported the whole developments and proofs.