Call PC program from PLC and return results from PC to PLC

adavi231

Member
Join Date
Apr 2012
Location
Kansas City, MO
Posts
7
I am very new to PLC programming, so I don't know whether this is an easy question or not.

I want a PLC to call a program I have on a computer, then after the programs runs it should return the result to the PLC.

The program is written in C++ with the .NET framework. It should run whenever it receives the signal from the PLC, then it should return 2 numbers to the PLC. The 2 numbers are X,Y coordinates.

How can I do this? How do I connect the computer to the PLC? Is there PLC code for calling an external computer program? Is there C++ code for sending data to a PLC?
 
Unless your c++ program has the code to look for an external event, I would create a simple supervisor program that looks for an event, be it digital or through some communications channel, and start the C++ program.

How does your program report the results? To a file? The supervisor program would monitor for the end of the c++ program, read the file contents and send it to the PLC.

Lots of ways to skin this cat; this is one method but the devil is in the details.
 
I guess then it is the supervisor program that I would need help with. I don't know how the supervisor program can send data to the PLC, and I don't know how the supervisor program would look for an event from the PLC.
 
I'm not doing this for a class. I work in a manufacturing environment. We normally outsource this type of stuff to contractors or consultants. I have been learning a lot of programming recently. I've learned enough to write the C++ program, but I still don't know how to implement it because it can't talk to the PLC.
 
I'd have a look at this site:
http://advancedhmi.com/default.html

A regular contributor here has developed and made freely available via GPL license a set of drivers and an HMI package that runs in the Visual Studio Express programming environment from Microsoft.

I would think this would be the quickest and easiest way to develop the interface you describe if your PLC is one of the handful that are supported by Advanced HMI.
 
One option would be to use ASCII serial communcations via the serial port. You could have the PC wait on the PLC send an ASCII code through the serial port that will start the routine, then send the the result back via ASCII. Shouldn't be all the hard if you are familiar with serial communications.
 

Similar Topics

Hi All, I am writing a piece of software for some research and would like to retrieve a running program from a PLC using python or some other...
Replies
5
Views
1,980
Hi, I'm learning GX Works 2 for upcoming project. I want to use ST Function Blocks in Ladder Program and it works if the FB(Structured text)...
Replies
5
Views
1,583
I can't find any information in the Red Lion Crimson documentation about how to use Sub-Programs. I have a number of ladder logic main programs...
Replies
2
Views
1,483
Hi I have a small script I wrote in "Programs" that I want to call when a buttom is pressed on the HMI. How do I call this program from a button...
Replies
6
Views
2,038
In codesys how do you call another program from a Ladder program? and I don't mean function blocks.
Replies
9
Views
8,792
Back
Top Bottom