找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3098|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

Proteus仿真STM32

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:325261 發(fā)表于 2019-6-25 12:02 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
仿真文件在工程的生成二進制文件的OBJ文件夾下,打開即可仿真

單片機源程序如下:
  1. /**************************************************************************************************
  2. Title:                                 main source program based on STM32F10 c
  3. Current                         version: v1.0
  4. Function:                       
  5. processor:                         
  6. Clock:                                8-72M  Hz
  7. Author:                               
  8. Company:            
  9. Contact:                       
  10. E-MAIL:                               
  11. Data:                       
  12. ***************************************************************************************************/
  13. /**************************************************************************************************
  14. ========================================Include Head===============================================
  15. ***************************************************************************************************/
  16. #include "main.h"
  17. #include "sys.h"
  18. #include "delay.h"


  19. /**************************************************************************************************
  20. ========================================Program Start===============================================
  21. ***************************************************************************************************/

  22. /**************************************************************************************************
  23. Function:   main
  24. Description:主函數(shù)
  25. Input:      no
  26. Output:     no
  27. Return:     no
  28. **************************************************************************************************/
  29. int main(void)
  30. {

  31.           RCC_Configuration();//重新設(shè)置使用外部8M時鐘,經(jīng)過PLL為72M
  32.          // SysTick_Config(SystemCoreClock / 1000);  //系統(tǒng)時鐘:1ms滴答1次    //這兩個函數(shù)只可用其中一個
  33.     delay_init(72);//初始化延時                                       //這兩個函數(shù)只可用其中一個
  34.           Init_IO();//初始化I/O
  35.           while(1)
  36.                 {
  37.        GPIO_ResetBits(GPIOA,GPIO_Pin_0); //置0
  38.        GPIO_ResetBits(GPIOA,GPIO_Pin_1); //置0
  39.        GPIO_ResetBits(GPIOA,GPIO_Pin_2); //置0
  40.        GPIO_ResetBits(GPIOA,GPIO_Pin_3); //置0
  41.                          GPIO_ResetBits(GPIOA,GPIO_Pin_4); //置0
  42.                          GPIO_ResetBits(GPIOA,GPIO_Pin_5); //置0
  43.                          GPIO_ResetBits(GPIOA,GPIO_Pin_6); //置0
  44.                          GPIO_ResetBits(GPIOA,GPIO_Pin_7); //置0
  45.                          delay_ms(1000); //隔一秒循環(huán)一次
  46.                
  47.                          GPIO_SetBits(GPIOA,GPIO_Pin_0); //置1
  48.                          GPIO_SetBits(GPIOA,GPIO_Pin_1); //置1
  49.                          GPIO_SetBits(GPIOA,GPIO_Pin_2); //置1
  50.                          GPIO_SetBits(GPIOA,GPIO_Pin_3); //置1
  51.                          GPIO_SetBits(GPIOA,GPIO_Pin_4); //置1
  52.                          GPIO_SetBits(GPIOA,GPIO_Pin_5); //置1
  53.                          GPIO_SetBits(GPIOA,GPIO_Pin_6); //置1
  54.                          GPIO_SetBits(GPIOA,GPIO_Pin_7); //置1
  55.                          delay_ms(1000); //隔一秒循環(huán)一次               
  56.                 }
  57. }




  58. /**************************************************************************************************
  59. Function:   SysTick_Handler
  60. Description:系統(tǒng)時鐘:1ms滴答1次
  61. Input:      no
  62. Output:     no
  63. Return:     no
  64. **************************************************************************************************/
  65. void SysTick_Handler(void)  
  66. {  

  67. }




  68. /**************************************************************************************************
  69. Function:   void Init_IO(void)
  70. Description:I/O初始化
  71. Input:      no
  72. Output:     no
  73. Return:     no
  74. **************************************************************************************************/
  75. void Init_IO(void)
  76. {
  77.           GPIO_InitTypeDef GPIO_InitStructure;
  78.                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);  
  79.     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ;
  80.     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;      
  81.     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;      //
  82.     GPIO_Init(GPIOA, &GPIO_InitStructure);
  83. }





  84. /******************* (C)***Program End************文件結(jié)束*****************************************/
復(fù)制代碼

所有資料51hei提供下載:
Project.7z (476.05 KB, 下載次數(shù): 75)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表