App Designer - timer with random interruption
2 views (last 30 days)
Show older comments
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 Comments
Geoff Hayes
on 26 Jan 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?
Answers (0)
See Also
Categories
Find more on Multicore Processor Targets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!