[mw_shl_code=c,true]#include "stm32f10x.h"
#include "delay.h"
#include "sys.h"
#include "usart.h"
void GPIO_Configuration()
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP ;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_ResetBits(GPIOA, GPIO_Pin_All);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP ;
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_ResetBits(GPIOD, GPIO_Pin_All);
}
void Systick_Configuration(void)//systick初始化函数
{
[mw_shl_code=c,true] SysTick_CounterCmd(SysTick_Counter_Disable);//停止系统定时器[/mw_shl_code]
[mw_shl_code=c,true] SysTick_CounterCmd(SysTick-Counter_Disable);[/mw_shl_code]
SysTick_ITConfig(DISABLE); //停止systick中断
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);//systick使用HCLK作为时钟源,频率值除以8。
SysTick_SetReload(9000);//重置时间1毫秒(以72MHz为基础计算)
SysTick_ITConfig(ENABLE);//开启systic中断
}
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOD, ENABLE); //使能PA,PD端口时钟
GPIO_Configuration();
Systick_Configuration();
}[/mw_shl_code]
已经按不完全手册配置了MDK,也成功编译下载过一回修改的LED的程序。 |