单片机问题
时间:10-02
整理:3721RD
点击:
单片机中for语句需要几个机器周期?
void clock(unsigned int Delay) //1ms延时程序 Delay=50
{ unsigned int i;
for(;Delay>0;Delay--)
for(i=0;i<124;i++);
这个是1ms的延时吗?怎么算的?
void clock(unsigned int Delay) //1ms延时程序 Delay=50
{ unsigned int i;
for(;Delay>0;Delay--)
for(i=0;i<124;i++);
这个是1ms的延时吗?怎么算的?
要看你的芯片系统频率1除以系统频率再是每次循环的时间,再乘以124
单片机晶振设定为12MHz,这就是系统频率吗?不是很理解你说的
晶振频率不一定是单片机的系统频率,可能有分频,要弄清楚单片机执行指令的时钟频率到底是多少,然后再算