How to Configure Excel READ Communication from PLC (DDE)
Do you require monitoring, controlling or testing, using real-time manufacturing or process plant data from an Excel spreadsheet? This data could be helpful to you as an automation professional, or your management, research and other department personnel requiring real-time data for decision making or accounting purposes. With this lesson, I’ll show you how to achieve this and more using Microsoft Excel and communication called Dynamic Data Exchange or DDE, a method of Microsoft windows interprocess communication so that one program can communicate with or control another program.
Which Softwares Will be Used?
In this lesson, we will be using Microsoft Excel, Rockwell Automation Studio 5000, RSLinx Classic, and Studio 5000 Logix Emulate software.
Studio 5000 Logix Designer
We will be using Studio 5000 Logix Designer programming software to create a sample program with floating-point and integers arrays, timers, and other simulated process values to display in Excel spreadsheets.
The overall block diagram of how the programs are interconnected is displayed here. The RSLogix PLC or emulator will communicate with RSLinx Classic and in turn, RSLinx will communicate with Studio 5000 Logix Designer and Excel.
What is DDE?
DDE is a Windows mechanism that enables applications to communicate with each other and automates the manual copying and pasting of data via the clipboard.
Who are the DDE Communication Client and Server?
A DDE communication is known as a conversation and the application, which initiates the conversation, is the client.
The other (responding) application is known as the server.
What is DDE Communication Poking?
Normally, the client initiates the conversation in order to get some data from the server. The client can send data to the server too, known as poking.
DDE Conversation Client Items
To initiate a DDE conversation, a client specifies the three items:
The Application: the name of the application it wants to talk to. Usually, this is the application’s executable filename, for example, RSLinx.
The Topic: which is the subject of the conversation created by the user and should be something which makes sense, for example, RealParsExcel.
The Item: Any number of different Items may be referred to identify data to be passed between the applications, for example, Excel recognizes cell references as items, Word recognizes bookmarks as items and RSLinx recognizes program tag names as items.
Logix Designer Sample Program
So, let us begin with the sample PLC program.
We’ve created a Studio 5000 Logix Designer program called Realpars_Excel.
Open up the Controller Tags folder and create two tag arrays, called REAL_array and DINT_arrray.
Creating Tags
In the Edit Tags area, Under the Name column, type in the REAL_array.
In the Data Type column, select REAL and then enter 10 for the DIM 0 in the Array Dimensions area.
Next, let’s do the same thing for the DINT_array.
Under the Name column, type in DINT_array. In the Data Type column, select DINT and then enter 10 for the DIM 0 in the Array Dimensions area.
We added a timer that will reset after the done bit is set.
In the Controller Organizer pane, expand the Main Program and then double-click on Main Routine.
As you can see, on rung 0, Timer01 was created with a 60-second preset value.
When the timer accumulator reaches 60,000 milliseconds, the Timer01 will reset and begin timing again.
Now, save the program.
Run Studio 5000 Logix Emulate
This is a good time to startup Studio 5000 Logix Emulate software.
The emulate software will emulate a virtual Rockwell Software PLC on a personal computer.
Locate the Studio 5000 Logix Emulate icon by selecting the Windows Start Menu button, and then type Emulate to find the Studio 5000 Logix Emulate software application from the list.
Once started, Studio 5000 Logix Emulate software will appear.
Setting Up the Emulator Modules
We have already set up the emulator, with the Emulator 5570 controller in slot 2, RSLinx in slot 0 and 1, and a 1789-Sim 32 Point I/O module in slot 3.
Run RSLinx Classic
Now, let’s select the Windows Start button again to start up the RSLinx Classic communication software.
Select the Windows Start Menu button and then type RSLinx to find the RSLinx Classic Desktop application, select the RSLinx Classic application from the list.
RSLinx will start. The communication driver for Studio 5000 Logix Emulator needs to be configured.
How to Configure the Communication Driver
So, select the Communications menu and then select Configure Drivers.
Now under the Available Driver Types drop-down list, select the Virtual Backplane (SoftLogix58xx, USB) driver and then press the Add New button.
Give the driver the name of RealPars_VBP-1, and then select OK.
Leave the Slot Number as 0 and then press OK.
The new virtual driver will be added to the Configured Drivers list.
The Status will indicate Running.
How to Create the RSLinx DDE Topic
Now let’s create the RSLinx DDE Topic. Select the DDE/OPC menu item and then select the Topic Configuration from the drop-down list.
The DDE/OPC Topic Configuration window will appear.
Select New to create a new Topic. Enter RealParsExcel for the name.
Then expand the RealPars_VBP-1 item and select Studio 5000 Logix Emulate, for the topic.
Next, select the Done button to complete the DDE Topic configuration.
Ok, we are done with RSLinx Classic, for now.
Now let’s download the Studio 5000 Logix Designer program to the virtual PLC.
To do this, from the Communications menu in the Studio 5000 Logix Designer software, select Who Active.
The Who Active window will appear, displaying all of the configured drivers, in this case, the Realpars_VBP-1 driver.
Select the Studio 5000 Logix Emulate icon and then press the Go Online button.
The Studio 5000 Logix Designer program has not been downloaded. To do this, in the Connected To Go Online window, select Download.
The download warning popup will display; select Download again to begin the download process.
After Downloading, the progress bar completes to 100%.
Let’s return to the Studio 5000 Logix Designer program.
Notice that the controller is in the Remote Program, which means the controller is not running.
You can verify this RUN state by observing that the RUN Light in the Studio 5000 Logix Emulator PLC in slot 2, is off.
In Studio 5000 Logix Designer, change the Remote Program state to Remote Run.
Select the icon next to the Remote Program indicator and from the list select the Run Mode.
A configuration window appears asking to confirm putting the controller in Remote Run, select YES.
Now, let’s look at the Timer01 rung we added earlier to verify it is running.
If the accumulator is incrementing, then the program is in RUN mode and we are now ready to set up the DDE configuration of these tags to Excel.
Microsoft Excel
Open up Microsoft Excel.
Pick cell D2 and create the DDE function to read data from our Timer01 accumulated value. Type the RealPars Excel Application, Topic, and Item, as the following format.
In cell E2, name the cell, Timer01 Milliseconds. In cell D3, divide cell D2 by 1000 in getting seconds. Finally, in cell E3, Give the seconds value the name of Timer01 Seconds.
/* Timer01 Miliseconds */=RSLINX|RealParsExcel!'Timer01.ACC,L1,C1'/* Timer01 Seconds */=D2/1000
view rawRealPars RSLinx Sample Excel File .xlsm hosted with ❤ by GitHub
You can download the Excel file here.
We hope you have enjoyed learning what will support you in your upcoming project.
If you would like to get additional training on a similar subject please let us know in the comment section.
Want to Learn More?
If you would like to get additional training on a similar subject please let us know in the comment section.
Check back with us soon for more automation control and PLC communication topics.
Got a friend, client, or colleague who could use some of this information? Please share this article.
The RealPars Team
▶ How to Configure Excel READ Communication from PLC (DDE) – (Part 1 of 2)
How to Configure Excel WRITE Communication to PLC (VBA) – (Part 2 of 2)
Join the Top 1% of Automation Engineers
Start Your 7-day Free TrialLearn from Industry Experts
With a 7-day trial, then €25/month