This chapter details the important steps for the embedded real-time implementation of a multi-rate control law. The embedded code is obtained using MPLAB Device Blocks for Simulink. It enables Embedded Coder for automated build and execution of real-time executable for any board equipped with a dsPIC :registered:, PIC32 :registered: or SAM from a Simulink model. Any model can thus be embedded. To compile the generated code and program the board from the Simulink interface with a single “Build” push button on top right of the Simulink interface :

The reasons why MPLAB device blocks for Simulink tool was chosen are:
Finally, embedded codes need to respect some constraints described in this chapter, divided into 3 pages:
(Delpoux2021) Delpoux, R., Kerhuel, L., & Léchappé, V. (2021). On Chip Rapid Control Prototyping for DC Motor. J3eA, Journal Sur l’enseignement Des Sciences et Technologies de l’information et Des Systèmes.
Romain Delpoux and Lubin Kerhuel (2023). ctrl + elec - Embedded code. Ampère Lab, INSA Lyon. https://doi.org/10.5281/zenodo.24636948 (accessed 2026-11-30).
@misc{ctrlelec2023_embeddedcode,
author = {Romain Delpoux and Lubin Kerhuel},
title = {ctrl + elec - Embedded code},
year = {2023},
publisher = {Ampère Lab, INSA Lyon},
howpublished = {\url{https://ctrl-elec.fr/university/embedded-code/}},
doi = {10.5281/zenodo.24636948},
note = {Accessed: 2026-11-30}
}Content licensed under CC BY 4.0.