TwinCAT Programming

Manoj M

Member
Join Date
Feb 2014
Location
London
Posts
59
Hello Experts,
I have simple query regarding defining memory bits in Global Variables. In my system I have two drives and CX2020 (Beckhoff). The communication protocol is Ethercat.Now I am checking the status of two drives like if they are healthy, fault state, ready to run etc...... via status word. I have made simple program which says Drive_statusword.3=Drive1_Healthy. Its very crude way of writing but I have used Move Function block to write this. Now the problem is this bit Drive1_healthy has been defined in one program and becomes local variable, but now I have to use this same bit somewhere else and it is not appearing in the list for obvious reason. I know I can use drive_statusword.3, but is there any other way out.

Regards
Manoj
 
Being local or not (TwinCAT 2 here) you can read from that variable writing PROGNAME.VARNAME, if you want to be able to write into that variable too you should declare it as an input variable.

Hope this helps!
 
all Markers (M bits should be declared in Global Variables, under resources. all inputs and outputs are there too, maybe not obvious when you declare them in the io list.

if you need any variable press F2 and you will see the inputassistant.
and while writing you can get this only after pressing F11(rebuild).
i use F11 very frequent (almost every line i write to see if i made any errors)
 
@shooter

F11 rebuilds but it tries to connect to the controller too.

Have you tried Alt+P+R? it rebuilds all.
Or Ctrl+F8 which only builds the differences...

Regards!
 
while writing i am always in simulation mode.
and alt F8 is for making connection
and ctrl F8 is breaking connection.
(as is in original codesys, but any manufacturer can have its own)
 

Similar Topics

Hello everyone: I have been able to read and write data via canopen interface through ADS read and write functional blocks in Twincat PLC...
Replies
9
Views
4,296
Dear Members: I am new at Twincat PLC System. I am working on a project. I have connected CX9020 with a PSI-9750 high voltage power supply via...
Replies
2
Views
1,805
Hello everyone, Lately, I started working around with Beckhoff hardware (CX1010 CPU and a few I/O modules) and got pretty familiar with...
Replies
10
Views
4,533
Hello Experts, It may look very simple to all you experts but for me it is a big hurdle to cross. I have Twincat 2 and Vacon drives which are...
Replies
10
Views
2,898
Hello Experts I am trying for a program which increase/decrease value in steps of 1. If the push button is pressed there for less than 1 second...
Replies
5
Views
2,344
Back
Top Bottom