|
4、选择外部晶振->Pinout&configurationg->RCC->HighSpeedClock(HSE)->内置DisAble/外置Crystal Ceramic Resonator
5、控制LED灯,在Pinout&configurationg->pinout view->在PB12口点击左键选择GPioout模式;
PB12命名->在PB12口点击右键选择 Enter user label->输入定义名称LED
6、点击Project Manager->Project->Toolchain/IDE->选择EWARM->MinVersion->按照IAR版本选择-> 点击生成代码-> GENERATE CDDE
CubeMX图形配置:可以在一个文件目录下生成EWARM/MDK-ARM 两个工程文件,IAR里面代码变了,那么MDK-KEIL也同步变了
8、使用IAR下载到开发板->Project->Options->Debugger->ST-link->在选择ST-link里面的SWD模式 ;
IAR擦除程序Project->Dowenload->Erase memory
使用MDK-Keil下载到开发板->点击魔术棒->Debug->Use里选择ST-link Debugger->在点击Settings->Port里面选择SW
MDK-Keil擦除程序Flash->Erase
while (1)
{
/* USER CODE END WHILE */
HAL_Delay(100); //延时100ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //灭灯
HAL_Delay(100); //延时100ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮灯
HAL_Delay(600); //延时600ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //灭灯
HAL_Delay(600); //延时600ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮灯
HAL_Delay(1000); //延时1000ms
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); //灭灯
HAL_Delay(1000); //延时1000ms
HAL_GPIO_WritePin(LED_GPIO_Port,LED_Pin,GPIO_PIN_RESET); //亮灯
}
|
-
|