Twincat TCP/IP com betwenn PLC and a main computer

tevious

Member
Join Date
Feb 2015
Location
Balingen
Posts
22
Hello,

I use a Beckhoff PLC to control an industrial robot.
The CAD data come from a main computer which control the whole factory.

The main computer and the PLC are connected on the same network. I'd like to build a TCP/IP connection between them to get the CAD from this main computer (typicaly getting the data in a raw format, saving these in the PLC's memory and then do the process on the PLC).

Has someone already done that?
I saw somethings about ADS but I never used it, when I called Beckhoff they talked about an OPC-UA Module, but my team leader think they want to sell us that and we don't need it.

Is there a library to build the connection directly in Twincat?
As we have a Win7 on the PLC, maybe could we install a third part software to manage that but if we could make it directly in the PLC, it'd be better.

Thanks!
 
Your Beckhoff PLC, may already give you the license. If the latest TwinCAT 3 (~3 yrs old), the license is tied to the PLC itself and the programming environment is no extra cost, assuming your PLC has a valid "run-time license". Just download the latest TC3 "engineering" install from their website. Best that you first install Microsoft Visual Studio (2010+ I recall). If not, TC3 will install a working VS shell, but without any MS languages (VB, C#, ..) and it is more involved to add full VS later.

If an older TwinCAT 2 PLC, you only need install the free "CP" level (control panel) on your main PC. Push thru the license warnings. Indeed, people said one could install the full "PLC-Control" level (3rd choice) and it wouldn't kick you out after the 7 day trial as long as your PLC had a valid TC2 run-time. Anyway, you only need that if you want to develop (or debug) PLC code. The CP level lets you access PLC variables via ADS calls and configure I/O, including mapping PLC variables to physical I/O channels.

Re how to make ADS calls from your main PC, Beckhoff has many examples. In VB6, I call an "ActiveX control" ("AdsOcx.ocx" or such). In VB.net, I call a dll ("Ads***.dll or such). For the latter, I mostly use their "TwinCAT stream" function, which is similar to Microsoft's Binary Reader object for reading files. Indeed, I assign the return to a BR object and parse the bytes to variables like in reading a file stream. Basically, you first make calls to set a link to the PLC (similar to linking to a database), then make a call for a byte stream, with the PLC variable name (can be an array or structure) and how many bytes to return. So your PC program must separately know the details of the PLC variable (type, array dimensions). There may be ADS calls to determine the later (haven't tried). Your PC program can also make calls to control the PLC (start, stop, reset,...) and you can control the flow by setting PLC variables (ex. set exit gate of an SFC block TRUE). Above is TC3. I forgot the TC2 call details, but similar.

Beckhoff also has some lower level ADS-OCX functions. I haven't tried any of that. It might be more for people doing things at a basic level like from Unix. If you stay in the Visual Studio playroom, everything is easy and well-documented. Archie here developed VB.net program AdvancedHMI. You could view the source code for how he interacts w/ a TwinCAT PLC.

How it works underneath. TwinCAT "service" should launch on your main PC every bootup. You will see an icon (green/blue ball) in your System Tray. You first need to add a "route" to your PLC via "System Manager" in TC2 or "System" in TC3 VS project. You can even get there from the TC system icon - right-click - routes - Add. Then "Broadcast Search". Insure you can ping first and I turn off Firewalls (always?).
 

Similar Topics

Hi! I am trying to run the 'SimpleSample' (https://infosys.beckhoff.com/content/1033/TF5100_TC3_NC_I/Resources/3438746891/.zip ) to understand the...
Replies
2
Views
96
I am developing a library in twincat and one of the function uses IID_ITcVnAccess_TcVnPoint2_DINT and the definition of this type is defined in...
Replies
0
Views
69
Sorry if this has been asked before, and apologies if this seems like a trivial issue, but I am new to Beckhoff and have been banging my head...
Replies
2
Views
141
Hi everyone, This is my first time posting, so please forgive any omissions or mistakes. I am attempting to control the velocity of a stepper...
Replies
18
Views
952
I am trying to communicate between a 1769-L16 and a beckhoff EL6652 EtherNet/IP-Master. I need 8 INT and 2 REALS. When I generate the eds file, in...
Replies
1
Views
161
Back
Top Bottom