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

📄 main.cpp

📁 嵌入式计算机及接口技术
💻 CPP
字号:
/****************************************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:
**
********************************************************************************************************/
#include "config.h"

#include "NrLib.h"
#include "Application.h"
#include "Led.h"


//----------------------------------------------------- 引脚声明


Pin_LPC2138 PIN019,PIN021;//串口0

Pin_LPC2138 PIN031,PIN033,PIN034,PIN035;//------------LED控制用引脚


PinDevice_Virtual_Device    Led1,Led2,Led3,Led4;  //Led控制用引脚设备


Uart_LPC2138   UartDevice0;          /*串口0*/



//-----------------------------------------------------管理器声明
Manager WinManager;
//-----------------------------------------------------窗口声明

Application AppWin;
Led WinLed;

char testStr[5] = "123";

void DelayMs()
{  int i;
	for(i=0;i<10000;i++);
}



void Ini_Pin()
{
 //------------------------------------
  PIN031.SetPinTag("P007");
  PIN031.Function=0;
  PIN031.Dirction=PinDirOut;//表示方向为输出
  PIN031.Ini();  
  PIN031.Set(); 

  PIN033.SetPinTag("P008");
  PIN033.Function=0;
  PIN033.Dirction=PinDirOut;//表示方向为输出
  PIN033.Ini();  
  PIN033.Set();

  PIN034.SetPinTag("P009");
  PIN034.Function=0;
  PIN034.Dirction=PinDirOut;//表示方向为输出
  PIN034.Ini();
  PIN034.Set();  

  PIN035.SetPinTag("P010");
  PIN035.Function=0;
  PIN035.Dirction=PinDirOut;//表示方向为输出
  PIN035.Ini(); 
  PIN035.Set();


//------------串口0的引脚 ------------/
 
  PIN019.SetPinTag("P000");
  PIN019.Function=1;
  PIN019.Ini();  

  PIN021.SetPinTag("P001");
  PIN021.Function=1;
  PIN021.Ini();  

}




//------------串口0中断响应函数------------/

void __irq IRQ_Uart0()

{
	UartDevice0.HardInt(Null);
	VICVectAddr = 0x00;	
}


int main (void)
{  
 

Ini_Pin();

//-------关联Led引脚
Led1.PinDevice=&PIN031;
Led2.PinDevice=&PIN033;
Led3.PinDevice=&PIN034;
Led4.PinDevice=&PIN035;





//初始化串口0*/
   UartDevice0.SubDeviceName=Uart0;
   UartDevice0.WorkFreq=Fpclk;
   UartDevice0.BandBps=9600;
   UartDevice0.Ini();

 
   VICIntSelect = 0x00;				// 所有中断通道设置为IRQ中断	


	

 ////////////////串口0中断设置

   VICVectCntl1 = 0x20 |(UartIrqBase+UartDevice0.SubDeviceName);	
   VICVectAddr1 = (uint32)IRQ_Uart0;	           
   VICIntEnable=1<<(UartIrqBase+ UartDevice0.SubDeviceName);
   


	
 
//-----------------------------窗口连接

   //设置启动窗口
     AppWin.StartWindow=&WinLed;
   

/***************将各个窗口控件压入Manager的窗口堆栈***************/



      WinManager.ControlerRegister(&AppWin);
      WinManager.ControlerRegister(&WinLed);

//////////////将设备向窗口堆栈中的窗口派发///////////////////////

     WinManager.IntRegister(&UartDevice0);
     WinManager.IntRegister(&Led1);
     WinManager.IntRegister(&Led2);
     WinManager.IntRegister(&Led3);
     WinManager.IntRegister(&Led4);



//     WinLed.IndextLed1.Clear();
   
     
//     WinLed.Com0.SendData(testStr,3);
////////////////////////////////////////////////////////////// 
 //    WinManager.busy=false;
     
      IRQEnable();
       
     WinManager.Start();
    
     while(1);
     return 0;

}
/*********************************************************************************************************
**                            End Of File
/********************************************************************************************************/

⌨️ 快捷键说明

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