Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Modbus Func


JamesMc Apr 8, 2022 08:50 PM

 Are there any modbus experts out there that can help me?  I am trying to read some discrete inputs on a scada device.  Here is a successful command with modpoll.exe

C:\WINDOWS\system32>modpoll.exe -0 -m tcp -t 1 -r 101 -c 8 -1 192.168.1.63
modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2021 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP, FC2
Slave configuration...: address = 1, start reference = 101 (PDU), count = 8
Communication.........: 192.168.1.63, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: discrete input

-- Polling slave...
[101]: 1
[102]: 0
[103]: 0
[104]: 0
[105]: 1
[106]: 0
[107]: 0
[108]: 0

 I am using the following related CR1000 program statements to accomplish what is posted above:

Public FSModBusPort As Long
Public FSReadResult As Long
Public FlexScadaSW(8) As Boolean


FSModBusPort = TCPOpen("192.168.1.63",502,1,500)
ModbusMaster(FSReadResult,FSModBusPort,9600,1,02,FlexScadaSW,101,8,3,1000)
TCPClose(FSModBusPort)

The FSReadResult is assigned -02 Illegal data address with different values of the Start argument (I have tried 0,1,100,101).  Any suggestions?


JamesMc Apr 8, 2022 11:13 PM

Fixed, off by one.  Used starting register 102.

Log in or register to post/reply in the forum.