USING A MODBUS DDE SERVER WITH EXCEL

 

A few days ago, a gentleman from India wrote me concerning a mean to code VB to read/write to a modbus device.   I have read some manuals on modbus RTU functions, exception, requests, etc.  So far, I have a few

achivements to report. 

 

I have used a 16-bit MODBUS IOserver from Wonderware Factory Suite 2000.  This is a DDE server, wich can easily be used in Excel 97 and above.   MODBUS IOservers require a registered license to run.

 

 

However, by choosing “Ignore” it can run in demo mode for 60 minutes.

 

 

The com port has to be setup (baud rate, parity, data bits., etc.)  In my case I am using a Modicon MICRO

PLC.

 

 

 

Also a topic mus be defined.  There are a few types of devices though. But chances are that by one of these will work with the modbus device you whant to link to.

 

 

On the PLC, a simple logic that clocks every  TIMER time and counts to COUNT SET vale is written.

 

 

In Excel, three cells are used. B1 to input to 40003 register (Clock value).  B2 is used to input to 40006 register (Counter Set).  B3 is used to read from 40007 register  (Counting value).

 

 

To be able to read from the DDE server, we must “poke it”. A simple macro is made to do just that.   As or reading, a simple formula is written to B3 cell itself.

 

 

Every time the macro is run, the values in the output cells are written to the DDE server and from it to the PLC.   The input cell gets it value every 1000 mS (as it was set on the MODBUS topic definition of MICRO).

 

These are a few pictures of my setup:

 

My trusty Acer Aspire w/ NT4.0 using COM1 to interface to the MODICON MICRO

A close up of the brand.

This is the panel of leds showing status and in/out states.  On the bottom a RJ45 connector from the PC

PLC overview.

The Excel sheet running.  You can change values at

any time.  I selected CNTRL+X as s shortcut to run the DDEpoke macro.