|
4、選擇外部晶振->Pinout&configurationg->RCC->HighSpeedClock(HSE)->內(nèi)置DisAble/外置Crystal Ceramic Resonator
5、控制LED燈,在Pinout&configurationg->pinout view->在PB12口點(diǎn)擊左鍵選擇GPioout模式;
PB12命名->在PB12口點(diǎn)擊右鍵選擇 Enter user label->輸入定義名稱LED
6、點(diǎn)擊Project Manager->Project->Toolchain/IDE->選擇EWARM->MinVersion->按照IAR版本選擇-> 點(diǎn)擊生成代碼-> GENERATE CDDE
CubeMX圖形配置:可以在一個(gè)文件目錄下生成EWARM/MDK-ARM 兩個(gè)工程文件,IAR里面代碼變了,那么MDK-KEIL也同步變了
8、使用IAR下載到開發(fā)板->Project->Options->Debugger->ST-link->在選擇ST-link里面的SWD模式 ;
IAR擦除程序Project->Dowenload->Erase memory
使用MDK-Keil下載到開發(fā)板->點(diǎn)擊魔術(shù)棒->Debug->Use里選擇ST-link Debugger->在點(diǎn)擊Settings->Port里面選擇SW
MDK-Keil擦除程序Flash->Erase
while (1)
{
/* USER CODE END WHILE */
HAL_Delay(100); //延時(shí)100ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //滅燈
HAL_Delay(100); //延時(shí)100ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮燈
HAL_Delay(600); //延時(shí)600ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //滅燈
HAL_Delay(600); //延時(shí)600ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮燈
HAL_Delay(1000); //延時(shí)1000ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //滅燈
HAL_Delay(1000); //延時(shí)1000ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮燈
}
|
|