仿真文件在工程的生成二进制文件的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)
|