|
- void DS3231_Delay(void) { //DS3231通信速率延時(shí),延時(shí)5微秒 12T單片機(jī)@12M
- unsigned char Number = 8;
- while (Number--){
- _nop_();
- _nop_();
- }
- }
-
- void DS3231_DelayForWrite(void){ //DS3231寫字節(jié)延時(shí),延時(shí)5毫秒 12T單片機(jī)@12M
- unsigned int Number = 2500;
- while (Number--)
- {
- _nop_();
- _nop_();
- _nop_();
- _nop_();
- _nop_();
- }
- }
復(fù)制代碼 單片機(jī)是STC89C52RC/12M,他的機(jī)器周期應(yīng)該是1us,那么DS3231_Delay(void)的延時(shí)時(shí)間不應(yīng)該是2us*8=16us嗎?怎么會(huì)是5us呢?
- //功能:12us延時(shí)
- //STC89C52為1T單片機(jī),即1個(gè)時(shí)鐘/機(jī)器周期,速度為AT89C52的12倍
- void Delay_xus(uint t)
- {
- for(;t>0;t--)
- {
- _nop_();
- }
- }
復(fù)制代碼
這個(gè)備注不對(duì)吧,STC89C52應(yīng)該是6/12T單片機(jī),那么當(dāng)t=1時(shí),延時(shí)應(yīng)該是1us吧?
|
|