下面这段程序是从万利板的DEMO程序中抠出来的,看了半天,也只看到主程序循环中似乎只干了一件事,就是把那几个字母“STM32 LCD DEMO”,翻来覆去颠来倒去颠鸾倒凤地显示。 没有看到按键处理程序(不过好像看到了按键初始化代码),估计是在中断中? 更没有看到ADC处理程序,以及显示ADC结果的代码。 但是DEMO板上,通电后再按KEY2 后却可以看到,LCD显示内容被切换成了ADC结果。明明有这个功能,怎么程序里没有找到对应的代码呢? (来源于C:ManleyEKBoardEKSTM32FLCDDemo(lcd+led+buttom)LCDDemo。。。)
/******************************************************************************* * Function Name : main * Description : Main program * Input : None * Output : None * Return : None *******************************************************************************/ int main(void) {
#ifdef DEBUG debug(); #endif
/* System Clocks Configuration */ RCC_Configuration();
/* GPIO ports pins Configuration */ GPIO_Configuration();
/* NVIC Configuration */ NVIC_Configuration();
/* Configure the systick */ SysTick_Config();
LcdShow_Init(); Led_Config(); Button_Config();
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource3); /* Configure EXTI Line9 to generate an interrupt on falling edge */ EXTI_InitStructure.EXTI_Line = EXTI_Line3; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource4); /* Configure EXTI Line9 to generate an interrupt on falling edge */ EXTI_InitStructure.EXTI_Line = EXTI_Line4; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure);
while(1) { write_string("STM3"); /*STM32 LCD demo*/ delay(); write_string("TM32"); delay(); write_string("M32 "); delay(); write_string("32 L"); delay(); write_string("2 LC"); delay(); write_string(" LCD"); delay(); write_string("LCD "); delay(); write_string("CD D"); delay(); write_string("D DE"); delay(); write_string(" DEM"); delay(); write_string("DEMO"); delay(); } } |