Pause of Fractional Seconds in Generated Code
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Michael
le 1 Fév 2023
Commenté : Matthew DiBello
le 6 Fév 2023
The help file for pause.m says the following in the notes about Code Generation:
The generated code truncates pause delay values to uint32 range during run-time execution.
I believe that means that fractional seconds less than 0.5 s (i.e. pause(0.1) ) will round to zero and no pause will happen in the generated code. Can someone confirm this?
If I am correct about this, is there a work around to do fractional exectuation pauses in generated code?
0 commentaires
Réponse acceptée
Matthew DiBello
le 3 Fév 2023
Modifié(e) : Matthew DiBello
le 6 Fév 2023
Hi Michael,
Your understanding is incorrect. In code generation, pause supports fractional values. The line from the documentation that you are referring to indicates that the maximum sleep duration is the max value of uint32.
Best,
Matthew
4 commentaires
Matthew DiBello
le 6 Fév 2023
The code generation implementation of pause uses nanosleep on POSIX systems and Sleep on Windows systems. If you want to see exactly how it's implemented, you can run non-MEX code generation and then use packNGo to get all the source in one place.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!