Using 'SIMULINK Support Package for Arduino Hardware' like 'LabVIEW'
27 次查看(过去 30 天)
显示 更早的评论
Hello,
I am working on implementing LabVIEW-like functionality using the <SIMULINK Support Package for Arduino Hardware> and uploading it to an Arduino.
My goal is to implement hard constraints in Simulink (as I understand that Simulink's default behavior is soft constraint).
Here's my understanding of the concepts:
Hard constraint: In a 1kHz loop, if a loop started at time 't ms' exceeds 1ms, it stops processing the current sensor value (t ms) and moves to the next sensor value at 't+1 ms'.
Soft constraint: If the loop exceeds 1ms, it completes processing the current loop(t ms) and skips the next cycle(t+1 ms), moving to the loop with value at 't+2 ms'.
In LabVIEW, I understand that the `Deadline` command allows for implementing hard constraints.(Link: https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/structures/timed-loop.html)
I tried to achieve this using `tic` and `toc` in the following code, but it failed to upload on the Arduino board
%% matlab code %%
function [num, y] = fcn(a,b)
persistent t
if isempty(t)
t = 0;
end
t = t+1;
num = t;
startTime = tic;
A = rand(a,b);
y = toc(startTime);
end
%%
Does anyone know a solution to this problem?
Thank you in advance.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!