main.c
上传用户:ssllxx2007
上传日期:2022-06-12
资源大小:784k
文件大小:3k
- /****************************************Copyright (c)**************************************************
- ** Guangzou ZLG-MCU Development Co.,LTD.
- ** graduate school
- ** http://www.zlgmcu.com
- **
- **--------------File Info-------------------------------------------------------------------------------
- ** File name: main.c
- ** Last modified Date: 2004-09-16
- ** Last Version: 1.0
- ** Descriptions: The main() function example template
- **
- **------------------------------------------------------------------------------------------------------
- ** Created by: Chenmingji
- ** Created date: 2004-09-16
- ** Version: 1.0
- ** Descriptions: The original version
- **
- **------------------------------------------------------------------------------------------------------
- ** Modified by:
- ** Modified date:
- ** Version:
- ** Descriptions:
- **
- ** mcu123.com add keil
- ********************************************************************************************************/
- #include "config.h"
- #include "stdlib.h"
- #define TaskStkLengh 64 //Define the Task0 stack length 定义用户任务0的堆栈长度
-
- OS_STK TaskStk [TaskStkLengh]; //Define the Task0 stack 定义用户任务0的堆栈
- OS_STK TaskStk1 [TaskStkLengh]; //Define the Task1 stack 定义用户任务1的堆栈
- void Task0(void *pdata); //Task0 任务0
- void Task1(void *pdata); //Task1 任务1
- int main (void)
- {
- OSInit ();
- OSTaskCreate (Task0,(void *)0, &TaskStk[TaskStkLengh - 1], 2);
- OSTaskCreate (Task1,(void *)0, &TaskStk1[TaskStkLengh - 1], 3);
- OSStart ();
- return 0;
- }
- /*********************************************************************************************************
- ** Task0 任务0
- ********************************************************************************************************/
- void Task0 (void *pdata)
- {
- pdata = pdata;
- TargetInit ();
-
- while (1)
- {
- FIO2CLR|=0x000000FF;
- OSTimeDly(100);
- }
- }
- /*********************************************************************************************************
- ** Task1 任务1
- ********************************************************************************************************/
- void Task1 (void *pdata)
- {
- pdata = pdata;
- while (1)
- {
- FIO2SET|=0x000000FF;
- OSTimeDly(500);
- }
- }
- /*********************************************************************************************************
- ** End Of File
- ********************************************************************************************************/