⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_init_sp.h

📁 MCS-51的一个小型操作系统,在KeilC中大模式下编译工作
💻 H
字号:
 
 /*任务数目*/ 
#define N             5	            
#define TASK1         0
#define TASK2         1
#define TASK3         2
#define TASK4         3
#define TASK5         4
#define FREE_TASK     N	   //空闲任务数据下标
#define TASK_8N       1

 /*任务分配*/  
#define SPEED_TASK	 0		 //第一个任务_计算电机转速
#define SEND_8019    1		 //第二个任务_发送数据
#define	RECE_ETH	 3		 //第四个任务_接收数据
#define SHOW_TASK	 4		 //第五个任务_数码管显示
  
/* 中断宏*/
#define   INIT_SP       0X0F             //中断时各寄存器压入堆栈个数
#define   ISR_NUM       1		         //最大中断嵌套个数
#define   OS_CLOSEISR   EA=0;	         //开中断宏 关
#define   OS_OPENISR    EA=1;   	     //关中断宏

/*任务嵌套调用个数声明*/
//#define	FREE_FUNCTION_NUM	  (0*2)
#define	TASK1_FUNCTION_NUM	  (3*2)	 //各任务嵌套函数最高个数 ,每次调用堆栈+2
#define	TASK2_FUNCTION_NUM	  (3*2)
#define	TASK3_FUNCTION_NUM	  (3*2)
#define	TASK4_FUNCTION_NUM	  (3*2)
#define	TASK5_FUNCTION_NUM	  (5*2)
#define	FREE_FUNCTION_NUM     (0*2)

/*任务私有堆栈空间初始化*/
#define FREE_SP      (INIT_SP*ISR_NUM+FREE_FUNCTION_NUM)
#define T1_SP        (INIT_SP*ISR_NUM+TASK1_FUNCTION_NUM)  
#define T2_SP        (INIT_SP*ISR_NUM+TASK2_FUNCTION_NUM)
#define T3_SP        (INIT_SP*ISR_NUM+TASK3_FUNCTION_NUM)
#define T4_SP        (INIT_SP*ISR_NUM+TASK4_FUNCTION_NUM)
#define T5_SP        (INIT_SP*ISR_NUM+TASK5_FUNCTION_NUM) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -