LED工程建立
前言
建立简单的LED熟悉开发环境。
一、新建工程
新建LED工程
二、配置外设
1.配置PIT模块
2.配置GPIO模块
3.编辑添加初始化代码
代码如下(示例):
void pitCh0Handler(void)
{
PIT_DRV_ClearStatusFlags(INST_PIT1, 0U);
PINS_DRV_TogglePins(PTA, 1UL<<0);
}
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
CLOCK_DRV_Init(&clockMan1_InitConfig0);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
INT_SYS_InstallHandler(PIT_Ch0_IRQn, &pitCh0Handler, NULL);
PIT_DRV_Init(INST_PIT1, &pit1_InitConfig);
PIT_DRV_InitChannel(INST_PIT1, &pit1_ChnConfig0);
PIT_DRV_StartChannel(INST_PIT1, 0U);
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
4.生成外设代码
5.编译
三、调试工程