Twincat 3 - How to define and map digital I/O

tevious

Member
Join Date
Feb 2015
Location
Balingen
Posts
22
Hello,

I'm new with Beckhoff technology and I'm learning twincat 3.
I use a CX2030 for the PLC and I plugged 2 modules for the I/O, EL1008 and EL2008 with 8 digital channels.

I put some buttons on inputs and some lights on outputs, I want to make a simple ST program where when a push a button it switch on/on an associated Led.

I made the quick start of Beckhoff Website and now I try to detect my I/O and map with variables to use in my program.

But I can't get through this step, when I scan Devices I don't get my I/O modules, but I see the Ethercat, could you help me to pass this step and then how can I use theses I/O variables in my S/T program?

Thank you
 
Me too ! I'm new to the BeckHoff World and am excited to see what we can accomplish with this thing.....

Going to be using it for a sortation and conveying system in a distribution center.

Cheers,

Bobb

🍻
 
Hi,

I finally made it with a part of luck!
You must go to Devices in the tree and make a scan, it'll detect the EtherCat Bus, then another popup windows is opened and click yes. You'll see under Devices the Ethercat bus and below in subpart another block with the names of your I/O modules. Actually these blocks (EL1008 and 2008 for me for digital I/O) are driven through Ethercat.

When you click to expand these blocks you'll see all your outputs and inputs and by clicking on each one you'll get the adress!

Just use theses adresses in your program in the VAR section and you're well.
Eventually, you'll need to make the link with your program's variables in the Task section in the left tree, for each variable you'll get a Main.myvar, right click on each and in the property windows which is opened you can define the mapping link in one click...

Then build, connect PLC, run and enjoy!
 
input 1 is %IX0.0
2 is %IX0.1 etc.
output is %QX0.0
in resources you can double click and give it a name then it is GLOBAL as you should.
 
IO Mapping on TwinCat 3

add all the inputs and outputs in the global variable. Once you added the device in the IO Devices, you can map the IOs in global variable by just double clicking the Input Outputs on the added IO modules.

GV.jpg map.jpg
 
Last edited:
How it works is a bit more obvious in TwinCAT2. The System Manager (SM) program manages I/O and lets you poll the inputs or poke the outputs for trouble-shooting. The PLC-Control (PLC_C) program (CodeSys based) is where you develop PLC code. You dimension PLC variables that you wish to link to IO as "%I*" or "%Q*" for input or output, resp. BTW, "Q" is not a German thing, but because "O" looks like "0". These PLC variables can be local or global.

TC2 then gets confusing because you must reference the compiled PLC code in SM (select *.tpy), which modifies a tab in PLC_C to state the byte mapping. In SM, you then link each PLC variable to I/O. I recall you must go back & forth between the two programs a few times, Activate Configuration, then it all works.

In TC3, SM is in the System folder and PLC_C is the PLC Project folder. The hand-shaking between the two now happens automatically. You still must Activate Configuration.

When calling for a PLC variable handle (ex. "PLCvar") from VB.net, in TC2 you used ".PLCvar" if global or "Main.PLCvar" if declared local to POU "Main". In TC3 you call as "GVL.PLCvar" if global (or name of your Global folder) and same "Main.PLCvar" if local. The difference might depend on which TC version is the "TwinCAT Service" installed on the HMI PC that runs your VB program. I didn't find this documented and took trial and error to figure out when I moved to TC3, and I didn't try every combination. It may also vary w/ the ADS interface for VB6 vs VB.net, since I have used both as HMI.
 
Last edited:

Similar Topics

I am using twincat 3 to send some strings over TCP/IP. Where the server is a sensor and my PLC is the client. I noticed that the sensor didnt...
Replies
2
Views
108
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
260
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
118
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
85
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
172
Back
Top Bottom