How to set up a Simulink model to use external clock on my Arduino Mega 2560?

7 次查看(过去 30 天)
Hi, all, I have an Arduino board all configured, two potentiometers connected to it at the same time, pins A0 and A1, however, simulation runs a lot slower than real time. It is funny, but it seems, the lower the sampling frequency, the faster the simulation time. For instance, it takes about 13 to 14 seconds to simulate 1 second of data acquisition. It takes about a second to run 18 seconds of simulation with sampling frequency about 10 Hz. The samples appear in scope in real time, but the X axis is off, that irritates me, and I am afraid it will also hinder adequate data acquisition. I have read that you can configure external clock in older versions of Matlab, but I cant find this option in R2019b.
If you happen to know how to configure my board to run in real-time, please, do share!
Best regards, Alex
UPD. It seems that sampling is affected somehow, i only get 350 samples a second (the real-time second) with sampling freq 1000 Hz

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by