⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arm_00_os_main.c

📁 uCOS在LPC213X上的移植。适合ARM嵌入式系统初学者。
💻 C
字号:
/**********************************************************************************************
本程序只供学习使用,不得用于其它任何用途,否则后果自负。

  ARM_OS_main.c file

  LPC213x上的操作系统——ARM_OS

  作者:heciang
  联系电话:13811129591
  QQ:176780142
  Email:heciang@126.com
  建立日期:2006-5-1
  修改日期:2006-5-15
  最后修改时间:2006-08-25
  版本:V1.0
 
  Copyright(C) Computer-lov 2006-2016
  All rights reserved
**********************************************************************************************/

#include "CPU.H"

#include "My_type.h"
#include "LED.H"
#include "interrupt.h"
#include "ARM_00_OS_TaskSwitch.H"
#include "ARM_00_OS_Core.H"
#include "UART.H"
#include "KEYS.H"

/*********************************************************************************************/
void SysClkInit(void)
{
 PLLCON=0x01;     //Enable PLL
 PLLCFG=0x24;     //set M=4,P=2	   so the core clock is about 5*11.0592M
 PLLFEED=0xAA;
 PLLFEED=0x55;    //send PLL feed sequence

 while((PLLSTAT&(1<<10))==0);     //Wait for PLL Locked

 PLLCON=3;        //Enable and connect PLL
 PLLFEED=0xAA;
 PLLFEED=0x55;   //send PLL feed sequence

 VPBDIV=0x01;   //VPB clock set. 0x01 --- same as the core clock
		
 MAMCR=0x00;	 
 MAMTIM=0x03;    //set MAMTIM to 3cclk for core clock >40MHz
 MAMCR=0x02;	 //use MAM
}
///////////////////////////////////////////////////////////////////////////////////////////////

/**********************************************************************************************
main函数
**********************************************************************************************/
void main(void)
{

 DisEnableInterrupt(OS_I_Bit | OS_F_Bit);  //关中断
 
 SysClkInit();  //系统时钟初始化
 
 UART_init();   //串口初始化
 
 DelayXms(100);  //延迟100ms
 
 cls();         //清屏
 
 prints("SystemStart",1);  //显示开机信息

 OSInit();   //操作系统初始化

 DelayXms(2000);   //延时2S。软件仿真时最好去掉该句,否则有得你等^_^

 OSEnterCritical();  //进入临界段
 
 EnableInterrupt(OS_I_Bit | OS_F_Bit);  //开中断
 
 OSTickInit();  //系统时钟节拍初始化

 OSStart((uint32)OSSystemIdle,OS_THUMB_MODE);  //系统开始运行
 
}
//////////////////////////////////End of function//////////////////////////////////////////////

⌨️ 快捷键说明

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