请问大峡void flash(),在这程序中起什么作用

[复制链接]
3077|6
 楼主| fengyeu 发表于 2007-10-14 08:57 | 显示全部楼层 |阅读模式
void flash() 
{  ;  ; }

void x24c08_init()  //24c08初始化子程序
 {
 scl=1; 
 flash(); 
 sda=1; 
 flash();
 }
void start()        //启动I2C总线
{
sda=1; 
flash(); 
scl=1; 
flash(); 
sda=0; 
flash(); 
scl=0; 
flash();
}
void stop()         //停止I2C总线
{
sda=0; 
flash(); 
scl=1; 
flash(); 
sda=1; 
flash();
}
void writex(unsigned char j)  //写一个字节
{  
unsigned char i,temp;
temp=j;
for (i=0;i<8;i++)
{
temp=temp<<1;
scl=0; 
flash(); 
sda=CY; 
flash(); 
scl=1; 
flash();
}
scl=0; 
flash(); 
sda=1; 
flash();
}
unsigned char readx()   //读一个字节
{
   unsigned char i,j,k=0;
   scl=0; 
   flash(); 
   sda=1;
   for (i=0;i<8;i++)
   {  
   flash(); 
   scl=1; 
   flash();
   if (sda==1) j=1;
   else j=0;
   k=(k<<1)|j; 
   scl=0;
   }
   flash(); 
   return(k);
}
void clock()         //I2C总线时钟
{
   unsigned char i=0;
   scl=1; 
   flash();
   while ((sda==1)&&(i<255))
   i++;
   scl=0; 
   flash();
}
沉思的鱼 发表于 2007-10-14 09:07 | 显示全部楼层

延时

延时
beike 发表于 2007-10-14 09:30 | 显示全部楼层

=同于

“_nop_();_nop_();”
51延时应该在6个_nop_();
hotpower 发表于 2007-10-14 09:30 | 显示全部楼层

被优化后什么都不干了~~~

 楼主| fengyeu 发表于 2007-10-14 09:34 | 显示全部楼层

谢谢!各位大虾

谢谢!各位大虾
computer00 发表于 2007-10-14 10:00 | 显示全部楼层

看看编译后的结果吧,空函数有可能被优化掉

如果要延迟的话,函数名改成delay会更好些.
lxyscls 发表于 2007-10-14 14:27 | 显示全部楼层

延时~

延时吧~确认确实修改成功~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

53

主题

446

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部