Cypress技术论坛
直播中

肖晓新

8年用户 172经验值
私信 关注
[问答]

为什么我用I2C主控器来复用GPIO PIN功能但其却不能作为输出来工作?

我正在尝试用I2C主控器来复用GPIO PIN功能,而我似乎不能把它作为输出来工作。
我可以让PIN输入并读取它;如果我从引脚上断开I2C模块的原理图,PIN工作得很好,所以我知道我的硬件是好的。
以下是我的代码:
int()
{
UIT88T温度=A4YBYP;
温度=温度和0xFe;
A4YBYP =温度;
A4X设置驱动器(A4A);
A4-写(0);
(;)
{
A4-写(1);
CyDelay(500);
A4-写(0);
CyDelay(500);
}
}
有什么想法吗?
迈克

以上来自于百度翻译


     以下为原文
  I'm trying to multiplex GPIO pin functionality with an I2C master, and I can't seem to get it to work as an output.
    I can make the pin an input and read it; if I disconnect the I2C module on the schematic from the pin, the pin works just fine, so I know my hardware is good.
    Here's my code:
    int main()
    {
        uint8_t temp = A4_BYP;
        temp = temp & 0xFE;
        A4_BYP = temp;
        A4_SetDriveMode(A4_DM_STRONG);
        A4_Write(0);
        for(;;)
        {
            A4_Write(1);
            CyDelay(500);
            A4_Write(0);
            CyDelay(500);
        }
    }
    Any ideas?
     
    Mike

更多回帖

发帖
×
20
完善资料,
赚取积分