我的数字电位器max5483 I/O口模拟程序大家帮看一下对吗?时序图如附图所示: void max5483write(uchar direct,uchar data1,uchar data2) { uchar i; MAX5483_SCLK = 0; MAX5483_CS18=0; for (i=0;i<8;i++) //上升沿写入命令 { MAX5483_SCLK =0; MAX5483_DIN = (bit)(direct&0x01); direct = direct>>1; MAX5483_SCLK =1; } for (i=0;i<8;i++) //上升沿写入数据 { MAX5483_SCLK =0; MAX5483_DIN = (bit)(data1&0x01); data1 = data1>>1; MAX5483_SCLK =1; }
for (i=0;i<8;i++) //上升沿写入数据 { MAX5483_SCLK =0; MAX5483_DIN = (bit)(data2&0x01); data2 = data2>>1; MAX5483_SCLK =1; } MAX5483_CS18=1; } |