Author Topic: Modbus can't do twice  (Read 852 times)


  • Newbie
  • *
  • Posts: 15
    • View Profile
Modbus can't do twice
« on: June 02, 2015, 09:04:37 am »

  HQ_RegBase:=$00A8;      //
  nrModbus1.ASCII := grpMode.ItemIndex > 0;
  // write register value by using modbus function 6       //
  nrModbus1.WriteRegister(HQ_RegBase, HQ_RegVal, HQ_RegAddr);
  HQ_RegBase:=$00C8;      // 4-20mA
  nrModbus1.WriteRegister(HQ_RegBase, HQ_RegVal, HQ_RegAddr);
this procedure can't run twice,
if there is one  nrModbus1.WriteRegister(HQ_RegBase, HQ_RegVal, HQ_RegAddr);  modify nrModbus1 timeout to 100,can be do any time.but when there are two writeregister ,whatever nrModbus1 timeout is ,can't do twice,
if i reopen nrComm1,it can writeregister again ,but not twice.It's seem nrModbus1 want some date back,
if I want some writeregister in one  procedure ,How can i do?BTW:I use  trial version of nrcomm to test

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1008
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Modbus can't do twice
« Reply #1 on: September 07, 2015, 06:08:35 pm »

TnrMobus places requests into internal queue.
It sends one request and waits reply (confirmation) or timeout.
After that sends next request from queue.

We inserted your code into Modbus demo and all works fine.

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.