Click here to learn the biblical way to get to heaven! (The most important page on this site)


Disclaimer: This document is written in the hope that you can utilize for your own education to gain knowledge of PLC systems (should you decide to utilize this document). Although I believe the information in this document to be accurate, it is YOUR responsibility to verify this information before implementing it in any way, especially when damage to personnel or equipment could result. By continuing to read this document, you agree to hold no one who writes, modifies, or distributes this document liable in any way (even negligence). Due to the wide variety of plant applications, some of the examples in this document may be prohibited at your location, or could cause damage to equipment, or harm personnel.
[Visit my Church Website] -- [Return to Index Page] -- [View Training Courses] -- [Contact ATI for Training] *Copyright 2005
Author: Ricky Bryce (Montgomery County, IL)
VPS Hosting Referral Code MJDCDJYou can have your very own virtual server though VPSLink! Using REFERRAL code MJDCDJ you will receive a 10% discount on your new account, and I will get a service credit on my account. My personal preference is the Link 2 package running XEN for starting out (You can upgrade any time). You can choose from a variety of Linux distributions such as CENTOS, Fedora, Debian, and Ubuntu. This is a great package for learning Linux, and setting up your own web page, or email server.
Disclaimer: This document is written in the hope that you can utilize for your own education to gain knowledge of PLC systems (should you decide to utilize this document). Although I believe the information in this document to be accurate, it is YOUR responsibility to verify this information before implementing it in any way, especially when damage to personnel or equipment could result. By continuing to read this document, you agree to hold no one who writes, modifies, or distributes this document liable in any way (even negligence). Due to the wide variety of plant applications, some of the examples in this document may be prohibited at your location, or could cause damage to equipment, or harm personnel.
[Return to Index Page] [View Training Courses] [Contact ATI for Training] *Copyright 2005

Using DDE with Visual Basic 6


This tutorial assumes you already have a Topic set up in a professional version of RSLinx. If you have not yet configured the topic, see the section titled 'Connecting to a Spreadsheet using DDE'. (I'm also assuming VB6 is installed on your computer) For this example, we will create a simple program that can view a memory location, and write to a memory location in the controller.


Acquiring Data from the processor


  1. Open Microsoft Visual Basic 6.




  1. Choose to create a standard executable file (standard exe)





  1. Click the texbox object from the general toolbox, and draw a textbox onto your form.






  1. On the Lower left side of your IDE, you will see a properties window. (If it is not there, turn it on from the view menu. We will be setting the LinkTopic, LinkItem, and LinkMode as shown for this example. RSLinx is the application we are going through to acquire the data, MyTopic is the topic we created within RSLinx to point to the processor, and the LinkItem is the memory location you wish to acquire data from for display in the textbox object. By putting the LinkMode in automatic, the textbox will update at the intervals we specified under the data collection tab in RSLinx.





  1. You will see your textbox is now updating in real time.





  1. To build this project as an executable, click File | Make Project1.exe. You can then store the executable on your desktop or any convenient location.



Sending data to the processor


In the last exercise, we acquired data from the processor. Occasionally, you may want to send data to the processor. We will be using the same application, RSLinx, and the same topic within that application for this exercise (MyTopic). We will change the preset of a timer such as T4:0.PRE. Since the operator will be entering a value, we don't want to get that value automatically. (We don't know if the operator has finished entering a value or not). We will want the operator to hit a button that sends the value he entered to the processor.


  1. Open VB6 as before.





  1. This will be a standard executable





  1. Using the general toolbox, grab the textbox object, and draw the object on your form.






  1. On the Lower left side of your IDE, you will see a properties window. (If it is not there, turn it on from the view menu. We will be setting the LinkTopic, LinkItem, and LinkMode as shown for this example. RSLinx is the application we are going through to acquire the data, MyTopic is the topic we created within RSLinx to point to the processor, and the LinkItem is the memory location you wish to acquire data from for display in the textbox object. By putting the LinkMode in manual this time, an event will be required to trigger the linkpoke command such as a command_click event. (Be sure you are looking at the properties of the textbox)





  1. Next, grab a command button from the general toolbox. Draw the command button onto the form.






  1. Double click on the command button to get to the code window. In the command1_click event (subroutine), type the following text:


Text1.LinkPoke


  1. Text1 is the name of the textbox. When you press the period, the intellisense will appear giving you a list of options available for Text1. We chose the LinkPoke method because we want to send whatever value is in text 1. When the command button is pressed, the code for the command1_click event will execute, and the Text1.LinkPoke method will be executed. You can test run your project to verify it's operation.





  1. When finished, you can close the form you started, and build your project as we did before.