I am trying to create a flashing procedure in Simulink using a S-function (C language) and I need to send some frames and the time between 2 consecutive frames should be lets say 200 milisconds. How can I implement this waiting time? Is there any possibility of implementing it?
Asked
Active
Viewed 277 times
1 Answers
0
If you want to update something every 200ms, put your S-Function into a subsystem which is triggered every 200s.

Daniel
- 36,610
- 3
- 36
- 69
-
Or give it a 200ms sample time and call the corresponding model_stepX function every 200ms. (see multitasking grt main) – pmb Apr 01 '14 at 12:38
-
I want this waiting time to be in the function, I don – Alexandru Tat Apr 01 '14 at 12:54
-
If you let it wait in the function, no other block can be executed. Is this intended? – Daniel Apr 01 '14 at 12:55
-
I want this waiting time to be in the function, not the function to be executed every 200 ms – Alexandru Tat Apr 01 '14 at 12:55
-
1You should use the [mdlGetTimeOfNextVarHit](http://www.mathworks.com/help/simulink/sfg/mdlgettimeofnextvarhit.html) method, within the S-Function, to specify when the block should next be sampled. – Phil Goddard Apr 01 '14 at 14:28