Reemplace S-Function Level 2 with C-MEX to read IMU sensor by I2C, Possible???

1 次查看(过去 30 天)
Hi all;
I'm making a quadcopter controller with Simulink using the Energia add-on for TivaC embedded launchpad.
To read the inertial sensor by I2C I made a s-function block level 2, but the maximum read frequency that I can raise is 250Hz, I need at least 400 - 500 Hz. I know that is possible because I made it with C code in Energia and I could reach 750Hz.
Reading on the web I found that the S-function blocks have slow function and an option to increase the speed is to make C-mex codes, but I don't have any idea of how doing a program to read a sensor, and I'm not sure that C-mex can do that.
Do you know if it's possible?, or do you have some idea to reduce the sample time?
Thanks a lot
Regards

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by