Problem with overlapping of S-functions in embedded program

1 次查看(过去 30 天)
Hello to all,
I have a problem with my project of an autopilot for an UAV. I'm using a launchpad Tiva C and I'm making an embedded program.
The problem is that I'm using a GPS (by UART), Radio Link (by UART) and an IMU (by I2C) and in Simulink I made a s-function in C for each hardware to read the data.
When I tested each hardware separately all works fine, but when I tried to run all the blocks at the same time with these samples times:
-GPS every 1 sec
-IMU every 0.01sec
-Radio link every 3 sec
The program hangs in a few seconds, so I suppose that the problem is that the first S-functions initiate but the simulink program continue and initiate the second S-function so the S-function overlap and get blocked, so I decided to use subsystems with diferent triggers but the same occurs. I tried to use function caller with mux but the same.
The problem is because the diferent rate of calling for each s-functions in some moment the calling will be in the same time.
So I need to find the way to run one s-function and wait it to finish the process and then run the next, but I don't have idea of how do that.
Thanks Regards

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Block and Blockset Authoring 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by