main.c
来自「我写的针对lpc2141的ucos源码」· C语言 代码 · 共 85 行
C
85 行
/****************************************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"
#include "lpc214x.h"
#define Task0StkLengh 64 //Define the Task0 stack length 定义用户任务0的堆栈长度
#define TaskLED1StkSize 128 //定义任务TaskLED1的堆栈长度
OS_STK Task0Stk [Task0StkLengh]; //Define the Task0 stack 定义用户任务0的堆栈
OS_STK TaskLED1Stk[TaskLED1StkSize]; //定义任务TaskLED1的堆栈
void Task0(void *pdata); //Task0 任务0
void TaskLED1(void *pdata); //TaskLED1 任务
int main(void)
{
OSInit ();
OSTaskCreate (Task0,(void *)0, &Task0Stk[Task0StkLengh - 1], 9);
OSStart ();
return 0;
}
/*********************************************************************************************************
** Task0 任务0
********************************************************************************************************/
void Task0(void *pdata)
{
pdata = pdata;
TargetInit ();
OSTaskCreate(TaskLED1,(void * )0,&TaskLED1Stk[TaskLED1StkSize-1],10);
while (1)
{
OSTimeDly(10);
}
}
void TaskLED1(void *pdata)
{
pdata = pdata;
//PINSEL0 =(~(0X00000003<<20)& PINSEL0)|0X00<<20;
IO0DIR |= 0x400;
//IO0SET = 0x400;
for(;;) {
IO0CLR = 0x400;//turn on the LED
OSTimeDly(OS_TICKS_PER_SEC);
IO0SET = 0x400;//turn off the LED
OSTimeDly(OS_TICKS_PER_SEC);
}
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?