1, 设单片机晶振频率为12MHZ,试编写一延时1s的子程序.

日期:2017-05-18 09:45:14 人气:1

1, 设单片机晶振频率为12MHZ,试编写一延时1s的子程序.

//----假设,系统工作于 12MHz/12T的传统51单片机下.#include sbit Test = P1^0; void Delay_50ms(unsigned char Times) { while(Times -- ) { TH0 = 0x3C; //----装入初值,定时器0定时50ms TL0 = 0xB0; TR0 = 1; //-----启动定时器 while(!TF0)
    A+
热门评论