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

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Guillaume
Guillaume el 10 de Mayo de 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.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by