• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 06, 2025, 10:38:52 am

News:

SMF - Just Installed!


Recent posts

Pages1 2 3 ... 10
1
nrComm Lib / Re: TnrUSB memory leak
Last post by Roman Novgorodov - March 12, 2025, 04:41:28 am
Please check in v9.71

Roman Novgorodov
2
nrComm Lib / Re: TnrUSB memory leak
Last post by Roman Novgorodov - January 31, 2025, 01:29:37 am
Hello

Thank you for information.
We use by default following flag in project for quick leak checking:

initialization
  ReportMemoryLeaksOnShutdown := true;

We will check but Can you show more details: any log or screenshot?

Roman Novgorodov

3
nrComm Lib / TnrUSB memory leak
Last post by bflorac - January 30, 2025, 04:09:22 pm
I installed MadExcept and turned on its memory leak detector.

If I take a new project, put a TnrUSB component on it and simple run nrUSB1.Update, when the program closes MadExpect reports some memory leaks. In fact, every time I run update, the number of items it finds increases.

I can send you the leak report if you have MadExcept. It looks like it is forgetting to free some Window handles and descriptors.

Running on Windows 11, Delphi 12, nrComm version v9.43. I know this is an older version of nrComm (which I have tweaked to work with Delphi 12). I'd update it if this is fixed.

4
General / Re: Modbus slave
Last post by Roman Novgorodov - January 25, 2025, 05:24:56 am
Hello

If MASTER writes to 200 register, the SLAVE gets that value in its 200 register. It works correct.
Why do you want to see value in register 100 in slave, if MASTER writes to 200?
I do not understand.

Roman Novgorodov

5
General / Re: Modbus slave
Last post by MTZOVARAS - January 23, 2025, 12:54:57 pm
Hello,

is it a bug ?

should i wait for a correction ?
6
General / Re: Modbus slave
Last post by Roman Novgorodov - January 23, 2025, 07:38:24 am
Hello

Yes it is correct.

Th 200 and 201 regs are not 100 and 101

Roman Novgorodov
7
General / Re: Modbus slave
Last post by MTZOVARAS - January 23, 2025, 07:08:55 am
Hello,

master send reg 200 value 1
                201 value 2

slave receives reg 100 value 0
               reg 101 value 0
8
General / Re: Modbus slave
Last post by Roman Novgorodov - January 23, 2025, 04:02:19 am
Hello

Slave app code can read or change current values for registers or coils as follows

nrModbus1.SlaveRegisters.Register[1234] :=  456; // access and change register 1234;
 nrModbus1.SlaveCoils.Coil[88] :=  true;          // access and change coil 88;


If you need to handle moment writing value you need to handle following event:

procedure TForm1.nrModbus1ModbusRequest(sender: TObject; Reply: TnrModbusPacket;
  Registers: TnrModbusRegisterList; Coils: TnrModbusCoilList; isWrite: Boolean;
  var error_code: TnrModbusError);
var
    sCoil : string;
    i:integer;
begin
  sCoil := '';
  for I := 0 to Coils.Count - 1 do
  begin
   sCoil := sCoil + 'Device: ' + IntToStr(Reply.Address) + ' Coil:' + IntToStr(Coils.GetCoilNumber(i)) + ' = ' + IntToHex(Coils.GetCoilValue(i).ToInteger(), 4) + #13#10;
  // listbox1.items.add('in modbus request : '+sreg);
  end;
  mmoErrorLog.Lines.Add(sCoil);
end;

Roman Novgorodov
9
General / Re: Modbus slave
Last post by MTZOVARAS - January 22, 2025, 10:10:03 am
Hello,

thank you for your help !

can you please send me some lines of code or some tips for my slave application to take values from Modbus Master ?

Do i need "holding registers" or "input registers"

Until now i have "holding registers" where i give initial values but i do not see Modbus Master to give them the new values !
10
General / Re: Modbus slave
Last post by Roman Novgorodov - January 21, 2025, 06:31:54 am
Yes, it is ordinary behaviour. Master device polls slave app for coils and regs and, when needed, changes that regs and coils.

Roman Novgorodov
Pages1 2 3 ... 10