标题: STM32之GPIO使用proteus8.6仿真 [打印本页]

作者: judejie82    时间: 2019-3-20 23:26
标题: 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. }
复制代码

所有资料51hei提供下载:
stm32_gpio_jude.7z (191.96 KB, 下载次数: 50)


作者: 陈帅真的是帅    时间: 2019-4-27 23:13
请问可以给qq吗,我有些问题想问你
作者: 18660570270    时间: 2019-9-5 14:54
不错,先下来看看
作者: liuhiong    时间: 2019-9-5 23:32
不错,很好,学习
作者: yhbzyl    时间: 2019-9-6 09:38
不错,学习




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1