How do I remove Timer0 from my built code?

1 次查看(过去 30 天)
Hello Everyone,
I'm using Simulink's Embedded Coder in a motor control application, and I'm trying to integrate ISR's into my model through the hardware interrupt and trigger model blocks. What I'd like to do is this: Create two hardware interrupts to control when I set some sample pins for my resolver (on ADC SOC), and when I actually take a position & velocity reading (on ADC EOC). I only need these two interrupts because they are going to be timed to when the PWM posts an interrupt when it completes, which initializes ADC SOC.
Now, although I only need two ISR's, Embedded Coder is automatically building an additional ISR into the model, Timer0 (at INT1.7 on the TI F28335), and integrating this into the final model. I'd like to delete Timer0, because it is now unnessessary. I'm not sure how to do this. Does anyone know how I can tell my Simulink/Embedded Coder model to not build Timer0 into my model anymore?
Thanks!
  2 个评论
Jonathan Lee
Jonathan Lee 2013-4-8
I want to add a bit to my question:
Essentially, I want to do what is described in the Simulink Coder Demo help files under the title "Schedule a Multi-Rate Controller for a Permanent Magnet Synchronous Machine." I'm currently (by default) using the base Timer0 rate to schedule the controller, but I'd like to time the control period to the ADC SOC (which ='s PWM EOC INT). This situation without using Timer0 is described in this help file with limited explanation:
"...Therefore, the controller and peripherals are scheduled by the ADC end-of-conversion interrupt. A separate custom code block inserts pre-processor macros that tell the compiler not to execute the controller and peripherals at the base rate."
How is this actually done?! Well...:
The subsystem wraps the algorithm "with a preprocesor macro such that it will not be executed at the base interrupt rate by generating the following code: #if 0, [some code], #endif"
The help file doesn't include the model, so I can't see the implementation. I assume that if I have a custom code block, I should be able to just wrap it in the #if 0 statement, and the Timer0 ISR will be shut off.
Does anyone have any experience with doing this? Any success stories?
Jonathan Lee
Jonathan Lee 2013-4-11
编辑:Jonathan Lee 2013-4-11
Another addition:
Essentially, I'm looking for the ADC EOC ISR and base rate timer disable details from this example:
In the fourth image, what is the code that is contained in the systems output block labeled "Disable Base Rate Timer Interrupt"?
Can this project .mdl file be shared?

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by