• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
November 21, 2024, 07:38:49 am

News:

SMF - Just Installed!


Modbus can't do twice

Started by crestxa, June 02, 2015, 06:04:37 am

Previous topic - Next topic

crestxa


begin
  HQ_RegBase:=$00A8;      //
  HQ_RegVal:=StrToInt(e420mAMax1.Text)*10;
  HQ_RegAddr:=StrToInt(eAddress.Text);
  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
  HQ_RegVal:=StrToInt(e420mAMin1.Text)*10;
  sleep(100);
  nrModbus1.WriteRegister(HQ_RegBase, HQ_RegVal, HQ_RegAddr);
end;
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
thanks!

Roman Novgorodov

Hello

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.