coassoftwaresystems / delphi-modbus

Delphi ModbusTCP components
114 stars 61 forks source link

WriteCoils (WriteCoils sss) Problem #41

Open guverdik opened 4 years ago

guverdik commented 4 years ago

procedure TfrmMain.btnWriteClick(Sender: TObject); var iAmount: Integer; Data: array[0..4096] of Boolean; i: Integer; begin mctPLC.Host := edtIPAddress.Text; iAmount := StrToInt(edtReadAmount.Text);

if CheckBox1.Checked then Data[0] := True else Data[0] := False; if CheckBox2.Checked then Data[1] := True else Data[1] := False; if CheckBox3.Checked then Data[2] := True else Data[2] := False; if CheckBox4.Checked then Data[3] := True else Data[3] := False; if CheckBox5.Checked then Data[4] := True else Data[4] := False; if CheckBox6.Checked then Data[5] := True else Data[5] := False; if CheckBox7.Checked then Data[6] := True else Data[6] := False; if CheckBox8.Checked then Data[7] := True else Data[7] := False; if mctPLC.WriteCoils(StrToInt(edtWriteReg.Text), iAmount, Data) then Label6.Caption := 'PLC Write Success!' else Label6.Caption := 'PLC Write Not Success!';

But not success. What is the problem?