Modbus TCP slave programming

D

Thread Starter

Dan Fuchs

I have to write a small Modbus application that will be running on a Windows XP PC.

It will be running constantly and every 2 seconds it will be collecting the values of 10 Modbus registers and inserting them into a file or database.

The Computer running the application is connected to the DCS computer system that acts as the Modbus master. The master will be sending commands every 2 seconds to update the values of the registers. The connection will be through Modbus TCP (RTU). The application will be using the second on board Ethernet connection on the PC which is the slave.

(I am quite a newbee in Modbus) Here are my questions:

• What I thought I need is to set up a slave program that listens for Modbus commands 06 (write single register) and 16 (write multiple registers) and sending me the values. It should also know how to handle errors.

• Can someone recommend a package that would do this? Preferably something that would be easy to automate, I use Matlab, autoit3 and Labview, anything that would work with one of these would be great. I looked through the link list and I get a bit lost.

• So far I have been able to find mainly software that would emulate a slave in order to test communication with a master, or others that would act as a master. However what I need is something that would act as a slave. That means as far as I know accept and handle all the commands and would be able to know what is in the registers. Where can I find something like that?

I am currently using autoit for automation. I can also program Matlab or Labview. I know all of these can handle external DLL’s or perhaps Active X. Can you recommend anything in specific that would be easy to set up?

Thanks
 
With our framework http://pvbrowser.org you can do it but you need some C programming knowledge.

Within the "additional package" you find a good template.
pvbaddon/daemons/modbus/modbus_tcp_simulation_and_server
 
> With our framework http://pvbrowser.org you can do it but you need some C
> programming knowledge.

> Within the "additional package" you find a good template.
> pvbaddon/daemons/modbus/modbus_tcp_simulation_and_server

In http://pvbrowser.de/pvbrowser/index.php?lang=en&menu=6&left=9

I hit "download pvbaddon.tar.gz" and downloaded.
when opening it I get an error:

! C:\Users\dan.fuchs\Desktop\pvbaddon.tar.gz: The archive is corrupt

when I look inside it I cannot find pvbaddon/daemons/modbus/modbus_tcp_simulation_and_server

can you please clarify?

thanks
Dan
 
I am able to download and insert it into Labview.

Is there some documentation for the methods?

When does it start listening and when does is stop?

Is there some error numbers list?

how are register numbers handled? Do I have to use 40000, 40001 ... or 0, 1 ...

Dan
 
> Is there some documentation for the methods?

Yes, there is a full context sensitive Help system. Start> Programs> Automated Solutions ActiveX> Modbus Slave> Help

> When does it start listening and when does is stop?

Start listening by calling the Control's OpenPort method, stop with ClosePort.

> Is there some error numbers list?

Yes, in the Help system.

> how are register numbers handled? Do I have to use 40000, 40001 ... or 0, 1

The register numbers that you listed are basically just different schemes used by different devices. Our Modbus Slave supports several addressing schemes, which you can select using the AddressType property.
 
Top