📄 os_start.c
字号:
/* $$$$$$$$$$$$$$$$$$ Copyrigth (c) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
File name: OS_Start.c
Function describe: start timer 0,and then sleep
Compiler: Keil uVision2
Version: 1.01
Programmer: Shawyoo
最近修改日期:20040729
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
If you want to use standard main function,please change the
const "USER_ENTRANCE=0"
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
#include "RTOS.h"
#define USER_ENTRANCE 1
void UserInit(void);
void MiniRTOS_Init(void);
#if(USER_ENTRANCE) //
void OSStart() // 自己定义的程序复位入口
#else
void main(void) // 标准main函数作为程序复位入口
#endif
{
NOP(); NOP();
#if(USER_ENTRANCE)
SP=STACK_POINTER;
#endif
UserInit();
NOP(); NOP();
MiniRTOS_Init();
while(1)
{
NOP(); NOP();
NOP(); NOP();
PCON|=0x01;
NOP(); NOP();
NOP(); NOP();
}
}
// ////////////////////////////////////////////
void ResetWatchDog(void)
{
NOP(); NOP(); // your watchdog code
}
void MiniRTOS_Init(void) //
{
//stop errant interrupts until set up
NOP(); NOP();
DisableInterrupt(); //disable all interrupts
OSCreateTask(0);
OSDeleteTask(0);
OSDeleteAllTask();
///////////////////////////////////////
TR0=TF0=0;
TMOD|=0x01; //ctc0 is mod1
ET0=1; //enable timer0 interrupt
PT0=1;
OSCreateTask(0); //
OSDeleteTask(0); //
OSDeleteAllTask(); //
NOP(); NOP();
//// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
TR0=1;
EnableInterrupt(); //re-enable interrupts
// all peripherals are now initialised
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -