TwinCAT EtherCAT Help Needed

sujal.sheth

Member
Join Date
Nov 2009
Location
Bangalore
Posts
3
Hi all,
I'm working on BeckHoff's EtherCAT Device EK1101 (Coupler). My project is to write an application which can communicate to this device.
Currently, I have trial version of TwinCAT software by which I'm able to access the Device. I'm new to EtherCAT communication and even first time using TwinCAT software. Strange behavior I'm facing while operating EtherCAT device through TwinCAT System manager is that if I start device in Config Mode then I'm able to change output buffer and can see LED on/off on EtherCAT device but same is not happening if I put Device in Run Mode (using TwinCAT software). anybody knows what I'm doing wrong ?
Second problem is with my development: I'm developing application in Visual studio (C++) and using TwinCAT library to interact with EtherCAT device. I'm able to read the state of device through API call. But I'm facing problem with reading/writing to input/output buffer of device. I'm totally clueless here.
Does anybody have some experience with TwinCAT library and provide me some help on this ? I needed very urgently.
Any immediate help will be appreciated. Thanks in advance.
Please let me know if any other information is required.

Thanks,
Sujal Sheth
 
EK1101 is a coupler but not a processor; it does not run its own program and does not have its own I/O or internal memory. It just links the actual I/O modules to the "brain" which, in your case, is the PC that runs TwinCAT.

The demo version of TwinCAT is valid for 30 days only; after that is can still be used for configuration, but cannot run. If that is the case, you would either have to buy a license for the PC or get a CX controller with EtherCAT bus - those come with a runtime license pre-installed.
 
Hi LadderLogic,
thanks for reply. Ya I know EK1101 is coupler but it has 1 byte input (EL1008 terminal) and 1 byte output channel (EL2008 Terminal) memory.
As you mentioned, it is also true. i have C6290 Beckhoff WinCE based controller and EK1101 is connected on it via ethernet port (TCP/IP).
Let me explain how I made a setup.I have my private network and I'm working on Machine-1 on which WinXP installed. Beckhoff WinCE controller is also on my network. EK1101 is connected on WinCE controller on TCP/IP port so indirectly it also comes on Network. Now TwinCAT software is installed on my WinXP machine from which I'm scanning the network and it is detecting both the devices.
Please refer the attached screen shot for more information. Now EK1101 has two terminals one is EL1008 (input) and EL2008 (output) and size of both is 1 byte (8 channels in each ).
Now If i run twinCAT software in config mode then I'm able to change each bit in output buffer and can see LED on/off on respective position in actual device. But If I run device in Run mode and if I do this then LED on/off is not happening. I don't know where is the problem? But right now I'm not very much concerned with this.
My real problem is I'm developing the application C++ based in which i have to interact with EtherCAT coupler through TwinCAT library (supplied with TwinCAT software). In which I'm calling API and my reading/writing calls to I/O channel is failing. Yesterday I have investigated the error code and found it is telling Service not supported and then I tried with different parameters values like port and Indexgroup and Indexoffset and I'm getting return value like Invalid Indexgroup, Invalid Offset etc. I tried my best but none of the values are working with API. Now Do you have any idea how can I pass the proper values to reading/writing to I/O channel of EK1101 (Which is internally I/o channel of EL1008 and EL2008 Terminals).

TwinCAT Device Tree.jpg
 
Hi sujal.sheth let me try to help. First, the reason why you can't set IO in run mode is that you need an additional task to link to the IO on the field devices, this is documented here...
http://infosys.beckhoff.com/content/1033/tcsystemmanager/basics/tcsysmgr_configaddusertask.htm

The C++ Interface is documented here in the Information System...
http://infosys.beckhoff.com/content/1033/tcadsdll2/html/tcadsdll_api_overview.htm

The sample code is here...
http://infosys.beckhoff.com/content/1033/tcsample_vc/html/tcadsdll_api_cpp_setup.htm

Once your "Additional Task" is running, your C++ Program should be able to connect to port 310 for Task 1 on the local PC. Then, you should be able to read and set IOs from C++.

I hope this answers your question, if you have further questions, please let us know.
 
Hi SteveMaves,
Thanks for very useful reply. It's really working.Now with the TwinCAT software, I'm able to change I/O buffer in Run mode using Additional Tasks. And even from my application I'm also able to access the same I/O buffer through additional task by specifying Indexgroup and offset of additional task variables.
I really appreciate your help in time.
Thanks to you again and Thanks to PLCTALK forum too.

Thanks,
Sujal Sheth.:p
 
Hi Guys,

I have been working on Beckhoff CX1010-0021 CPU Module. I have got CX1100-0002 power supply and 8 Channel Input (KL1408) and Output (KL2408) Terminals attached to it. I am using TwinCAT trial version. Everything seems to be good , I can actually play with the inputs and output using TwinCAT system Manager & PLC Control.

My next task is to create an interface in Visual Basic 6.0 with 8 inputs & 8 outputs so that if I press the output 1 on my VB screen, the output 1 on the terminal (KL2408) should turn on, similarly if I have Input1 high on Input Terminal (KL1408) it should be displayed on the VB Interface.

The link b/w my laptop to CX1010 is ethernet cable as this CPU has only 1 ethernet connector. I haven't worked on Ethernet communication using VB, So I desperately need some help in data communication using VB & ethernet.
Even If I get only one input and output working that would be fine for me. The rest would be the replicas.

Any help would be highly appreciated. Thanks
 
Hi ujria, for VB 6.0, there are two way to interface with TwinCAT, the Active X control, or the COM control, if you are not familiar with COM, the Active X is probably best. It is documented here...
http://infosys.beckhoff.com/content/1033/tcadsocx/html/tcadsocx_intro.htm?id=8661

With sample programs here...
http://infosys.beckhoff.com/content/1033/tcsample_vb/html/tcadsocx_sample01.htm?id=9348

You will also need either the free version of TwinCAT, TwinCAT CP, or the ADS Communications library on the PC running the VB code.
 
Beckhoff CX1010-0021

Thanks Steve for you prompt reply. I have got a Trial version of TwinCAT and ADS Communication Library. As you have mentioned I am going to give it a shot using Active X Control first and see if it works for me. Thanks anyway.
 
Hi, I have a question for SteveMaves.

When using the EtherCAT module and the aditional task configuration on port 310 that you explained to sujal.seth, which has the priority when setting I/O points? The C++ application or the Twincat Runtime system connected to the EtherCAT?
 
Hi Klikopc, the TwinCAT runtime will always have priority over Windows, that behavior can not be changed. You can change how often TwinCAT interrupts Windows, the default is 1 ms.

However, the way that these two examples shown work is that the C++ application talks to TwinCAT IO software on the local PC. TwinCAT IO's real-time communications then communicates to the network hardware. The C++ application does not direclty interface to the hardware.

Also note, the default ADS port for the Additional Task is port 301, not port 310.
 
TwinCAT error when switched to Run Mode.

Hi,

I am new to TwinCat 3 and to PLC programming.

I made a program on TwinCat 3 to experiment a little bit. When I switched to Run Mode TwinCat gave me the following error:

Error 15 27/01/2015 23:23:48 551 ms | 'TwinCAT System' (10000): Sending ams command >> Init4\RTime: Start Interrupt: Ticker started >> AdsWarning: 4115 (0x1013, RTIME: system clock setup fails.
Hint: On Windows8 system execute win8settick.bat in TwinCAT\3.1\System as administrator and reboot.) << failed!

I am running TwinCat 3.1, Engineering eddition on Windows 8.1 64-bit operating systems.

Any suggestion of how I can solve this error is more than welcome.

Thanks alot
 

Similar Topics

Hello. I must be doing something really dumb but I cannot crack it. I have this one EtherCAT device and my CODESYS program works as expected. The...
Replies
3
Views
1,422
Hello, Does anyone have some good advice on using TwinCAT to control Altivar Drives from Schneider Electric. In this example I am using ALT320...
Replies
0
Views
2,169
Hello all, First time I have to use twincat. My configuration is very simple: A CX1100, One EK1122 Ethercat junction and two Unidrive SP inverters...
Replies
0
Views
2,108
Hi, May someone could help me concerning the use of TwinCAT as an EtherCAT master? I must set this up only to verify if a slave is working...
Replies
1
Views
2,068
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
1
Views
60
Back
Top Bottom