📄 embedded.c
字号:
#include <dos.h>
#include "libepc.h"
#include "os_cpu.h"
#include "os_cfg.h"
#include "ucos_ii.h"
#define TASK_STK_SIZE 1024
void Task1()
{
int n = 0 ;
while (1)
{
OSSchedLock() ;
SetCursorPosition(10, 30) ;
PutString("Task #1: ") ;
PutUnsigned(n++, 10, 10) ;
OSSchedUnlock() ;
OSTimeDly(10) ;
}
}
void Task2()
{
int n = 0 ;
while (1)
{
OSSchedLock() ;
SetCursorPosition(12, 30) ;
PutString("Task #2: ") ;
PutUnsigned(n--, 10, 10) ;
OSSchedUnlock() ;
OSTimeDly(10) ;
}
}
int main(void)
{
static OS_STK Task1Stk[TASK_STK_SIZE] ;
static OS_STK Task2Stk[TASK_STK_SIZE] ;
ClearScreen(0x07) ;
OSInit() ;
OSTaskCreate(Task1, NULL, &Task1Stk[TASK_STK_SIZE], 11) ;
OSTaskCreate(Task2, NULL, &Task2Stk[TASK_STK_SIZE], 12) ;
OSStart() ;
return 0 ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -