仿真文件在工程的生成二進制文件的OBJ文件夾下,打開即可仿真
單片機源程序如下:
- /**************************************************************************************************
- Title: main source program based on STM32F10 c
- Current version: v1.0
- Function:
- processor:
- Clock: 8-72M Hz
- Author:
- Company:
- Contact:
- E-MAIL:
- Data:
- ***************************************************************************************************/
- /**************************************************************************************************
- ========================================Include Head===============================================
- ***************************************************************************************************/
- #include "main.h"
- #include "sys.h"
- #include "delay.h"
- /**************************************************************************************************
- ========================================Program Start===============================================
- ***************************************************************************************************/
- /**************************************************************************************************
- Function: main
- Description:主函數
- Input: no
- Output: no
- Return: no
- **************************************************************************************************/
- int main(void)
- {
-
- RCC_Configuration();//重新設置使用外部8M時鐘,經過PLL為72M
- // SysTick_Config(SystemCoreClock / 1000); //系統時鐘:1ms滴答1次 //這兩個函數只可用其中一個
- delay_init(72);//初始化延時 //這兩個函數只可用其中一個
- Init_IO();//初始化I/O
- while(1)
- {
- GPIO_ResetBits(GPIOA,GPIO_Pin_0); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_1); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_2); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_3); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_4); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_5); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_6); //置0
- GPIO_ResetBits(GPIOA,GPIO_Pin_7); //置0
- delay_ms(1000); //隔一秒循環一次
-
- GPIO_SetBits(GPIOA,GPIO_Pin_0); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_1); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_2); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_3); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_4); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_5); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_6); //置1
- GPIO_SetBits(GPIOA,GPIO_Pin_7); //置1
- delay_ms(1000); //隔一秒循環一次
- }
- }
- /**************************************************************************************************
- Function: SysTick_Handler
- Description:系統時鐘:1ms滴答1次
- Input: no
- Output: no
- Return: no
- **************************************************************************************************/
- void SysTick_Handler(void)
- {
- }
- /**************************************************************************************************
- Function: void Init_IO(void)
- Description:I/O初始化
- Input: no
- Output: no
- Return: no
- **************************************************************************************************/
- void Init_IO(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- }
- /******************* (C)***Program End************文件結束*****************************************/
復制代碼
所有資料51hei提供下載:
Project.7z
(476.05 KB, 下載次數: 75)
2019-6-25 21:36 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|