📄 main.c
字号:
//****************************************************************************
// @Module Project Settings
// @Filename MAIN.C
// @Project led.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC888CLM-8FF
//
// @Compiler Keil
//
// @Codegenerator 1.4
//
// @Description This file contains the Project initialization function.
//
//----------------------------------------------------------------------------
// @Date 2008-3-22 上午 10:17:49
//
//****************************************************************************
// USER CODE BEGIN (MAIN_General,1)
// USER CODE END
//****************************************************************************
// @Project Includes
//****************************************************************************
#include "MAIN.H"
// USER CODE BEGIN (MAIN_General,2)
// USER CODE END
//****************************************************************************
// @Macros
//****************************************************************************
// USER CODE BEGIN (MAIN_General,3)
// USER CODE END
//****************************************************************************
// @Defines
//****************************************************************************
// USER CODE BEGIN (MAIN_General,4)
// USER CODE END
//****************************************************************************
// @Typedefs
//****************************************************************************
// USER CODE BEGIN (MAIN_General,5)
// USER CODE END
//****************************************************************************
// @Imported Global Variables
//****************************************************************************
// USER CODE BEGIN (MAIN_General,6)
// USER CODE END
//****************************************************************************
// @Global Variables
//****************************************************************************
// USER CODE BEGIN (MAIN_General,7)
// USER CODE END
//****************************************************************************
// @External Prototypes
//****************************************************************************
// USER CODE BEGIN (MAIN_General,8)
// USER CODE END
//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************
// USER CODE BEGIN (MAIN_General,9)
// USER CODE END
//****************************************************************************
// @Function void MAIN_vInit(void)
//
//----------------------------------------------------------------------------
// @Description This function initializes the microcontroller. It is
// assumed that the SFRs are in their reset state.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2008-3-22
//
//****************************************************************************
// USER CODE BEGIN (MAIN_Init,1)
// USER CODE END
void MAIN_vInit(void)
{
// USER CODE BEGIN (MAIN_Init,2)
// USER CODE END
/// -----------------------------------------------------------------------
/// Configuration of the System Clock:
/// -----------------------------------------------------------------------
/// - On Chip Osc is Selected
/// - PLL Mode, NDIV = 20
/// - input frequency is 9.6 MHz
// FCLK runs at 2 times the frequency of PCLK.
SFR_PAGE(_su1, noSST); // switch to page1
CMCON = 0x10; // load Clock Control Register
SFR_PAGE(_su0, noSST); // switch to page0
/// *********************************************************************************
/// Note : All peripheral related IO configurations are done in the
/// respective peripheral modules (alternate functions selection)
/// *********************************************************************************
/// Initialization of module 'GPIO'
IO_vInit();
// Interrupt Priority
IP = 0x00; // load Interrupt Priority Register
IPH = 0x00; // load Interrupt Priority High Register
IP1 = 0x00; // load Interrupt Priority 1 Register
IPH1 = 0x00; // load Interrupt Priority 1 High Register
// USER CODE BEGIN (MAIN_Init,3)
// USER CODE END
//// Interrupt structure 2 mode 0 is selected.
//// Interrupt service routine choice 2 is selected.
// globally enable interrupts
EA = 1;
} // End of function MAIN_vInit
//****************************************************************************
// @Function void main(void)
//
//----------------------------------------------------------------------------
// @Description This is the main function.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2008-3-22
//
//****************************************************************************
// USER CODE BEGIN (MAIN_Main,1)
// USER CODE END
void main(void)
{
// USER CODE BEGIN (MAIN_Main,2)
uword a,b;
// USER CODE END
MAIN_vInit();
// USER CODE BEGIN (MAIN_Main,3)
// USER CODE END
while(1)
{
// USER CODE BEGIN (MAIN_Main,4)
for(a=0;a<10000;a++)
for(b=0;b<100;b++)
IO_vWritePort(P3,0x0f);
for(a=0;a<10000;a++)
for(b=0;b<100;b++)
IO_vWritePort(P3,0xf0);
// USER CODE END
}
} // End of function main
// USER CODE BEGIN (MAIN_General,10)
// USER CODE END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -