i2cex2.usc

来自「upa代码 调表软件」· USC 代码 · 共 31 行

USC
31
字号
// This example writes 256 from 24c01/24c16
Program WriteI2CEx;
var d: byte;
    i: integer;
begin
  ShowHexEdit;
  SetSizeHexEdit( 256 );
  PowerOn;
  ConfigI2C( 10, 10000 );//clock=10us,write=10ms
  for i := 0 to 255 do
    begin
      StartI2C;
      d := 10;
      if WriteByteAI2C( $a0 ) = false then //control byte
        AddMsgDebug( 'Control Byte Error'+ intToStr(i) )
      else if WriteByteAI2C( i ) = false then //address
        AddMsgDebug( 'Address Error')
      else begin
             StartI2C;
             if WriteByteAI2C( $a1 ) = false then  //control byte
               AddMsgDebug( 'Control Byte Error'+ intToStr(i) )
             else if ReadByteI2C( d ) = false then //data
               AddMsgDebug( 'Data Error');
           end;
      StopI2C;
      SetByteHexEdit( i, d );
    end;
  PowerOff;
  RefreshHexEdit;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?