time delay in simulink to be used with c code generation
I am trying to interface a STM32F411RE board with a 4 digital seven segment display via simulink and embedded coder support. To do so i need to introduce various time delays for example: the clock pin goes high and then after 2 micro-seconds it goes low etc. but i an unable to model such time delay. I have tried introducing a for loop that does nothing but the code generator optimizes the code and omits the for loop as it is not providing any fruitful output. is there any way that i can turn this optimization off so that it keeps the for loop? I have tried another way where i introduce a dummy variable inside for loop but the c code generator changes the order of the commands and moves the for loop in the start and not where i want the delay to be. please let me know if anyone has dealt with a similar problem? memory block/delay block also doesn’t work.
Thank you!!I am trying to interface a STM32F411RE board with a 4 digital seven segment display via simulink and embedded coder support. To do so i need to introduce various time delays for example: the clock pin goes high and then after 2 micro-seconds it goes low etc. but i an unable to model such time delay. I have tried introducing a for loop that does nothing but the code generator optimizes the code and omits the for loop as it is not providing any fruitful output. is there any way that i can turn this optimization off so that it keeps the for loop? I have tried another way where i introduce a dummy variable inside for loop but the c code generator changes the order of the commands and moves the for loop in the start and not where i want the delay to be. please let me know if anyone has dealt with a similar problem? memory block/delay block also doesn’t work.
Thank you!! I am trying to interface a STM32F411RE board with a 4 digital seven segment display via simulink and embedded coder support. To do so i need to introduce various time delays for example: the clock pin goes high and then after 2 micro-seconds it goes low etc. but i an unable to model such time delay. I have tried introducing a for loop that does nothing but the code generator optimizes the code and omits the for loop as it is not providing any fruitful output. is there any way that i can turn this optimization off so that it keeps the for loop? I have tried another way where i introduce a dummy variable inside for loop but the c code generator changes the order of the commands and moves the for loop in the start and not where i want the delay to be. please let me know if anyone has dealt with a similar problem? memory block/delay block also doesn’t work.
Thank you!! c code generation, time delay, matlab, simulink MATLAB Answers — New Questions