欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
stm32時基定時器是用程序
[打印本頁]
作者:
geige
時間:
2015-7-26 02:19
標題:
stm32時基定時器是用程序
#include "stm32f10x.h"
void Delay(unsignedint x);
unsigned intTimingDelay;
intmain(void)
{
SystemInit();//配置系統時鐘
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);//使能APB2外設時鐘
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB| RCC_APB2Periph_GPIOC |RCC_APB2Periph_GPIOD,ENABLE);//IO口使能設置
GPIO_InitTypeDef GPIO_InitStructure; //定義I/O口結構體
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_ResetBits(GPIOC, GPIO_Pin_6);
if (SysTick_Config(72000000 / 100)) //每10ms中斷一次
{
while (1);
}
while(1)
{
GPIO_SetBits(GPIOC, GPIO_Pin_6);
Delay(100); //100*10ms=1s
GPIO_ResetBits(GPIOC, GPIO_Pin_6);
Delay(100); //100*10ms=1s
}
}
void Delay(unsignedint x)
{
TimingDelay=x;
while(TimingDelay!=0);
}
voidTimingDelay_Decrement(void)
{
if (TimingDelay != 0x00)
{
TimingDelay--;
}
}
//以下是報錯函數
#ifdef USE_FULL_ASSERT
voidassert_failed(uint8_t* file, uint32_t line)
{
while (1)
{
}
}
#endif
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1