📄 c2812adcpwmtest_main.c
字号:
/*
* File: c2812adcpwmtest_main.c
*
* Real-Time Workshop code generated for Simulink model c2812adcpwmtest.
*
* Model version : 1.138
* Real-Time Workshop file version : 6.3 (R14SP3) 26-Jul-2005
* Real-Time Workshop file generated on : Thu Dec 11 22:05:31 2008
* TLC version : 6.3 (Aug 5 2005)
* C source code generated on : Thu Dec 11 22:05:34 2008
*/
#include "rtwtypes.h" // MathWorks types
#include "c2812adcpwmtest.h" // Model's header file
volatile int IsrOverrun = 0;
volatile boolean_T OverrunFlags[2] = {0,0};
/* Function: rt_OneStep -------------------------------------------
*
* Abstract:
* Perform one step of the model. Multi-rate multi-tasking implementation.
*/
void rt_OneStep(void)
{
boolean_T eventFlags[2];
disable_interrupts();
if (OverrunFlags[0]++) { // Check if base step time is too fast
OverrunFlags[0]--; // allow future iterations to succeed
IsrOverrun = 1;
return;
}
enable_interrupts();
/*
* For a bare-board target (i.e., no operating system), the rates
* that execute this base step are buffered locally to allow for
* overlapping preemption. The generated code includes function
* c2812adcpwmtest_SetEventsForThisBaseStep() which sets the rates
* that need to run this time step. The return values are 1 and 0
* for true and false, respectively.
*/
c2812adcpwmtest_SetEventsForThisBaseStep(eventFlags);
c2812adcpwmtest_step(0);
OverrunFlags[0]--;
if (eventFlags[1]) {
disable_interrupts();
if (OverrunFlags[1]++) {
OverrunFlags[1]--; // allow future iterations to succeed
IsrOverrun = 1;
return;
}
enable_interrupts();
c2812adcpwmtest_step(1);
OverrunFlags[1]--;
}
}
void main(void)
{
/* This is to avoid being optimized away by c2000 compiler o/w
rtmGetErrorStatus() could be used directly */
volatile int_T errorStatus;
init_board();
c2812adcpwmtest_initialize(1);
errorStatus = rtmGetErrorStatus(c2812adcpwmtest_M) != NULL;
config_schedulerTimer();
enable_interrupts();
while (!errorStatus) {
if (IsrOverrun) {
/* Interrupt overrun detected; User selected action = Continue */
enable_interrupts();
}
errorStatus = rtmGetErrorStatus(c2812adcpwmtest_M) != NULL;
}
disable_interrupts();
/* Disable rt_OneStep() here */
/* Terminate model */
c2812adcpwmtest_terminate();
}
/* File trailer for Real-Time Workshop generated code.
*
* [EOF]
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -