標(biāo)題: STM32之GPIO使用proteus8.6仿真 [打印本頁]

作者: judejie82    時間: 2019-3-20 23:26
標(biāo)題: STM32之GPIO使用proteus8.6仿真
STM32F103  +PROTEUS 8.6    之GPIO 仿真。

仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)


單片機源程序如下:
  1. #include "stm32f10x.h"

  2. #include "led.h"


  3. void RCC_Configuration(void);




  4. void Delay(u32 count)
  5. {
  6.                 u32 i=0;
  7.                 for(;i<count;i++);
  8. }


  9. int main(void)
  10. {
  11.          RCC_Configuration(); // 時鐘配置
  12.    GPIO_Configuration();
  13.                         
  14.         while(1)
  15.                 {
  16.                         
  17.                                 GPIO_ResetBits(GPIOB,GPIO_Pin_5);
  18.                                 
  19.                                         Delay(3000000);
  20.                                 GPIO_SetBits(GPIOB,GPIO_Pin_5);
  21.                                 
  22.                                 Delay(3000000);
  23.                         
  24.                         
  25.                 }
  26. }

  27. void RCC_Configuration(void)
  28. {
  29.         ErrorStatus HSEStartUpStatus;
  30.          RCC_DeInit();
  31.          RCC_HSEConfig(RCC_HSE_ON);
  32.          HSEStartUpStatus = RCC_WaitForHSEStartUp();


  33.           if(HSEStartUpStatus == SUCCESS)
  34.           {
  35.             
  36.             RCC_HCLKConfig(RCC_SYSCLK_Div1);
  37.              RCC_PCLK2Config(RCC_HCLK_Div1);
  38.              RCC_PCLK1Config(RCC_HCLK_Div2);

  39.             FLASH_SetLatency(FLASH_Latency_2);
  40.             FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
  41.          
  42.             RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
  43.   
  44.             RCC_PLLCmd(ENABLE);
  45.          
  46.             while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
  47.            
  48.             RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
  49.             
  50.             while(RCC_GetSYSCLKSource() != 0x08);
  51.           }
  52.                     
  53.   
  54.                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);  
  55.         
  56. }
復(fù)制代碼

所有資料51hei提供下載:
stm32_gpio_jude.7z (191.96 KB, 下載次數(shù): 50)


作者: 陳帥真的是帥    時間: 2019-4-27 23:13
請問可以給qq嗎,我有些問題想問你
作者: 18660570270    時間: 2019-9-5 14:54
不錯,先下來看看
作者: liuhiong    時間: 2019-9-5 23:32
不錯,很好,學(xué)習(xí)
作者: yhbzyl    時間: 2019-9-6 09:38
不錯,學(xué)習(xí)




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1