App Designer - timer with random interruption
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, maybe somebody know what is not working correct.
I implanted a timer (replaced a loop) for measurements my motor data. But sometimes if I increase/decrease with a spinner my velocity of the motor, the timer finished before I push the stop bottom. It happen always randomly. I guess something is affecting each other but I don’t know what. Maybe anyone has an idea?
Thanks a lot :)
methods (Access = private)
function MemoryTimerFcn(app,~,~)
% read my data (now I just put two inside=
app.actualVelocity.Value = webread()
app.actualMotorCurrent.Value = webread()
end
% .....a lot of other functions
end
function startupFcn(app)
app.MemoryTimer = timer(...
'ExecutionMode', 'fixedRate', ...
'Period',0.2, ...
'BusyMode', 'drop',...
'TimerFcn', @app.MemoryTimerFcn);
end
function MotorON(app, event)
start(app.MemoryTimer);
end
function MotorOFF(app, event)
stop(app.MemoryTimer);
end
2 Commenti
Geoff Hayes
il 26 Gen 2021
Chris - can you show where you call MotorON and MotorOff? Is the second function only called when you want to stop the motor (how do you know when to call this?) and is this function the only way to stop the timer? Also, how do you know that the timer has stopped prematurely - is there some sort of indication in the console (or whatever) output?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!