yy1.c

来自「移植UCOS2.00版内核到8051」· C语言 代码 · 共 79 行

C
79
字号
#include <includes.h>

void TaskStartyya(void *yydata) reentrant;
void TaskStartyyb(void *yydata) reentrant;
void TaskStartyyc(void *yydata) reentrant;

OS_STK TaskStartStkyya[MaxStkSize];//注意:我在ASM文件中设置?STACK空间为40H即64。
OS_STK TaskStartStkyyb[MaxStkSize];
OS_STK TaskStartStkyyc[MaxStkSize];

void main(void)
{
	  UserSysSP_Start=SP;
	  
    OSInit();
    
    InitTimer0();
#if SERIAL_OK>0    
    InitSerial();
    InitSerialBuffer();
#endif
    
    OSTaskCreate(TaskStartyya, (void *)0, &TaskStartStkyya[0],4);
    OSTaskCreate(TaskStartyyb, (void *)0, &TaskStartStkyyb[0],5);
    OSTaskCreate(TaskStartyyc, (void *)0, &TaskStartStkyyc[0],6);
    
    OSStart();
}


void TaskStartyya(void *yydata) reentrant
{
    yydata=yydata;
#if SERIAL_OK>0    
    clrscr();
    PrintStr("\n\t\t*******************************\n");
    PrintStr("\t\t*     Hello! The world.       *\n");
    PrintStr("\t\t*******************************\n\n\n");
#endif    
    for(;;){
#if SERIAL_OK>0    	
        PrintStr("\tAAAAAA111111 is active.\n");
        OSTimeDly(OS_TICKS_PER_SEC); 
#else        
	    	P1 = 0x01;
		    OSTimeDly(2);
#endif       
    }    
}

void TaskStartyyb(void *yydata) reentrant
{
    yydata=yydata; 
    
    for(;;){
#if SERIAL_OK>0    	
        PrintStr("\tBBBBBB333333 is active.\n");
        OSTimeDly(3*OS_TICKS_PER_SEC);  
#else
		P1 = 0x02;
		OSTimeDly(4); 
#endif  
    }    
}

void TaskStartyyc(void *yydata) reentrant
{
    yydata=yydata; 
    
    for(;;){
#if SERIAL_OK>0    	
       PrintStr("\tCCCCCC666666 is active.\n");
       OSTimeDly(6*OS_TICKS_PER_SEC);
#else       
		P1 = 0x04;
		OSTimeDly(8);  
#endif     
    }    
}

⌨️ 快捷键说明

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