How to disable the stopping of a timer when it executes its TimerFcn

3 vues (au cours des 30 derniers jours)
Zdravko Pavic
Zdravko Pavic le 10 Mai 2017
Commenté : Zdravko Pavic le 10 Mai 2017
Hello, this is my first question here. For now found every solution i needed I wrote a small software to count some values of my geigercounter. I query some counts via serial port from an arduino nano.
Therefor i have a timer that queries every specific period some counts.
My problem ist, that this specific period is falsified by the time it takes to run the "TimerFcn".
I make this to create the timer:
intervalltimer = timer('TimerFcn',{@intervallfunktion, handles},'Period',Zeitschritt,'ExecutionMode','fixedSpacing','StartDelay',Zeitschritt);
The time it takes to run the function "intervallfunktion" is allways shorter then the period "Zeitschritt". The problem is that the timer stops when the TimerFon is running :/ Is there a way to force the timer not to stop running while the TimerFcn "intervallfunktion" is beeing executed?
Thank You very much! And please apologize my grammar, my English is not that good and I have to use it more often.
Zdravko Pavic

Réponse acceptée

Guillaume
Guillaume le 10 Mai 2017
Simply change the 'ExecutionMode' to 'fixedRate' instead of 'fixedSpacing'. 'fixedSpacing' tells the timer to start counting 'Period' after the TimerFcn returns, so the behaviour you're seeing is as expected.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown 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!

Translated by