?由于設(shè)備準備數(shù)據(jù)耗時比較長,用CH341控制時需要在寫入設(shè)備地址后等待SDA變低后再去讀寄存器。
public?static?bool?WriteReadI2C1(UInt32?iIndex,?byte?iDevice,?byte?iAddr,?ref?byte?iByte)?//讀8位寄存器 { ????uint?i?=?0,?iStatus?=?CH341DLL.mStateBitSDA; ????byte[]?iOutBuffer?=?new?byte[2]?{?iDevice,?iAddr?};?//設(shè)備寫地址+寄存器地址 ????byte?iDevice2?=?(byte)(iDevice?|?1);?//設(shè)備讀地址 ????IIC_OutBlockSkipAckStart(iIndex,?2,?iOutBuffer);?//Start+寫16bit ????IIC_OutByteCheckAckStart(iIndex,?iDevice2);?//Restart+寫8bit ????while?(i?<?100)?//等待SDA變低 ????{ ????????CH341DLL.CH341GetInput(iIndex,?ref?iStatus);? ????????if?((iStatus?&?CH341DLL.mStateBitSDA)?==?0)?break; ????????i++; ????} ????return?IIC_InByteNoAckStop(iIndex,?ref?iByte);?//讀8bit+Stop }
請問用CH347能否實現(xiàn)類似功能?
熱門產(chǎn)品 :
CH182: 以太網(wǎng)PHY收發(fā)器芯片