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

 *第21036篇: 如何让X9241正常响应。

  
楼 主:cuiiuc 2004年4月15日17:18
 如何让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();
}



>>>>>>对该主题发表你的看法

本主题贴数1,分页: [第1页]


[上一篇主题]:[求助]

[下一篇主题]:VFD 电源(由12V车载电源)这么设计合适吗???