Executing a routine only once in a simulink model for mpc555

3 views (last 30 days)
Hi, I am using simulink and real time workshop to develop my project which will be downloaded on phyCORE MPC555. Now simulink acts like a while loop where at each sampling time all the blocks are updated. What can I do if I want a block to execute only once. To be specific I want to provide a routine for the user to initialize the microcontroller clock if he presses a button say s1 in the 1st second after reset.
All I can think of is using an enabled subsystem. S1 triggers the clock initialize subsystem to be enabled and the remaining algorithms in another subsystem to be disabled. But the clock subsystem has to remain enabled till all inputs have been given by the user. any ideas or suggestions?

Accepted Answer

Saurav Kumar
Saurav Kumar on 25 Apr 2011
Well I think we can try and use the discrete states available in s-function ( I am using this since I don't know stateflow yet) and check which state the system is in!
When in the required state (i.e needing 8 bytes) it takes data from buffer, Now in buffer we can choose to insert say 'N' if no data is available. So, after the buffer is full we can check if anything other than 'N' there in the array, if yes we increment the state.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!