新聞中心

stm32的微秒延時(shí)程序

作者: 時(shí)間:2016-11-11 來(lái)源:網(wǎng)絡(luò) 收藏
我的stm32系統(tǒng)時(shí)鐘為72MHZ,用軟件延時(shí)方法實(shí)現(xiàn)微秒級(jí)的延時(shí),既空循環(huán):

延時(shí)函數(shù)為:

本文引用地址:http://www.2s4d.com/article/201611/316910.htm

#definedelayUs(x){ unsigned int _dcnt;
_dcnt=(x*16);
while(_dcnt-- > 0)
{ continue; }
}

x---------為延時(shí)時(shí)間(單位為us)

其中_dcnt=(x*16); 中的16,是可以改的,改為8的時(shí)候延時(shí)間時(shí)間為x*0.5。



關(guān)鍵詞: stm32微秒延時(shí)程

評(píng)論


技術(shù)專區(qū)

關(guān)閉