基于STM32F103ZET6芯片,實際使用沒有問題
單片機源程序如下:- /** @addtogroup IAP
- * @{
- */
- /* Includes ------------------------------------------------------------------*/
- #include "common.h"
- #include "bsp.h"
- #include "cortexm3_macro.h"
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- /* Private function prototypes -----------------------------------------------*/
- /*******************************************************************************
- * Function Name : main
- * Description : Main program.
- * Input : None
- * Output : None
- * Return : None
- *******************************************************************************/
- int main(void)
- {
- u8 flg = 0;
- #ifdef DEBUG
- debug();
- #endif
-
- BspInit();
- CommonInit();
- while (1)
- {
- CommonExec();
-
- if (IS_TIMEOUT_1MS(eTim1, 1000))
- {
- flg? LedOn(LED_5) : LedOff(LED_5);
- flg = !flg;
- }
- }
- }
- #ifdef DEBUG
- /*******************************************************************************
- * Function Name : assert_failed
- * Description : Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * Input : - file: pointer to the source file name
- * - line: assert_param error line source number
- * Output : None
- * Return : None
- *******************************************************************************/
- void assert_failed(u8* file, u32 line)
- {
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- /* Infinite loop */
- while (1)
- {
- }
- }
- #endif
復制代碼
原理圖: 無
仿真: 無
代碼(僅供參考,有錯誤請指出):
bootloader.7z
(198.05 KB, 下載次數: 28)
2024-1-18 14:47 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|