最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CH32F103C8T6滴答定時器應(yīng)用

2023-02-02 18:15 作者:高_(dá)電平  | 我要投稿

//中斷方式

SysTick_Config(72000000/5);

void SysTick_Handler(void)

{

?GPIO_WriteBit( GPIOA, GPIO_Pin_0,!GPIO_ReadOutputDataBit( GPIOA, GPIO_Pin_0));

}


非中斷方式

//1s? 72000000? ? 1us? 72

void delay_us(uint32_t us)

{

SysTick->CTRL = 0;? ? // Disable SysTick

SysTick->LOAD = 72*us-1; // Count from 255 to 0 (256 cycles)

SysTick->VAL = 0;? ? ?// Clear current value as well as count flag

SysTick->CTRL = 5;? ? // Enable SysTick timer with processor clock

while ((SysTick->CTRL & 0x00010000)==0);// Wait until count flag is set

SysTick->CTRL = 0; // Disable SysTick

}



//1s? 72000000? ? 1ms? 72000

void delay_ms(uint32_t ms)

{

while(ms--)

{

SysTick->CTRL = 0;? ? // Disable SysTick

SysTick->LOAD = 72000-1; // 計數(shù)值

SysTick->VAL = 0;? ? ?// Clear current value as well as count flag

SysTick->CTRL = 5;? ? // Enable SysTick timer with processor clock

while ((SysTick->CTRL & 0x00010000)==0);// Wait until count flag is set

SysTick->CTRL = 0; // Disable SysTick

}

}


void delay_s(uint32_t s)

{

while(s--)

{

delay_ms(1000);

}

}


CH32F103C8T6滴答定時器應(yīng)用的評論 (共 條)

分享到微博請遵守國家法律
木里| 锦屏县| 兴安县| 富锦市| 祥云县| 调兵山市| 雷波县| 永平县| 桐乡市| 平果县| 长治市| 金华市| 瑞昌市| 廉江市| 邯郸市| 阜新市| 余姚市| 汝阳县| 扎兰屯市| 鄂尔多斯市| 鄂州市| 桃江县| 喀什市| 灌阳县| 拉萨市| 留坝县| 克什克腾旗| 龙岩市| 临西县| 竹山县| 昌宁县| 南江县| 恭城| 武乡县| 义马市| 张家港市| 明水县| 浦北县| 荔浦县| 正定县| 铜山县|