16-bits fixed-point PID implementations in C
Nessuna licenza
The effect of fixed-point arithmetic in 16-bits PID controller C routines
on the closed-loop precision is shown in this Simulink model.
Two Simulink blocks that implement single and double
precision 16-bits PID C routines are generated with the LCT. The C sources
are supplied for user modifications if required.
Controllers work with 16-bits data and coefficients word lengths. Coefficients
and data fixed-point numbers have respectively 12-bits and 10-bits fractionnal part.
For a reference step excitation, you will see that the permanent errors for
the fixed-point pids do not equal zero. Without rounding (look inside model
for rounding mode switching), the single precision pid exibits an error about
8 data lsb when the double precision one is just around 2 lsb.
After changing the rounding mode to "nearest", the single precision
implementation error falls to 3 lsb !
Look inside the code sources and you will see that the differences are i) the
internal controller state is stored in double precision and ii) the downcasts
(right shifts) are not done at the same point in the fixed-point computation.
Cita come
Gilles (2025). 16-bits fixed-point PID implementations in C (https://it.mathworks.com/matlabcentral/fileexchange/22078-16-bits-fixed-point-pid-implementations-in-c), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- Code Generation > Fixed-Point Designer > Fixed-Point and Floating-Point Basics > Digital Number Representation >
- FPGA, ASIC, and SoC Development > Fixed-Point Designer > Fixed-Point and Floating-Point Basics > Digital Number Representation >
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 |
