导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→如何让X9241正常响应。

* 52707: 如何让X9241正常响应。

   cuiiuc 
cuiiuc发表的帖子 

 如何让X9241正常响应。
我用I2C总线可以让24c16正常响应,但是不能让x9241正常响应。不知何故。望各位大侠不吝赐教。

我是这样发送字节和等待应答的(附程序):
void SendByte(uchar c)
{
    uchar BitCnt;

    //the length of data to be send is 8 bits
    for(BitCnt=0;BitCnt  <8;BitCnt++)  
    {
        if(c&0x80)
        {
            SDA=1;   //judge the sending bit
        }
        else
        {
            SDA=0;
        }
        _Nop();
        SCL=1;      //Set clock, and notice the device to receive
        _Nop();
        _Nop();     //Be sure the clock holding time >  4,7us
        _Nop();
        SCL=0;
        c = c   <  < 1;
    }

    _Nop();
    _Nop();
    SDA=1;         //The sending action is over
    _Nop();        //and release the data line
    _Nop();
    SCL=1;
    _Nop();
    _Nop();
    _Nop();
    ack = !SDA;  //judge whether the ack bit is received
    SCL=0;
    _Nop();
    _Nop();
}




发表时间:2004年4月15日17:18:30

  
回复该帖

本主题共有 1 帖,分页:>>>>>该主题的所有内容[1]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

[上一篇帖子]:[求助]利用串行口通信实现单片机作为下位机,PC机作为上位机。下位机负责采集数据 信号(这里
[下一篇帖子]:在LOGIC OPTION 更改下选项,如有问题联系我 KIT@DDL