#include #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 ; }