Twincat PLC - how declare variable

derickloo

Member
Join Date
Mar 2015
Location
Malaysia
Posts
36
I'm new in PLC programming. I have a small project which have 12 temperature sensor. How I should declare the variable for this 12 sensor.

I try code below

temp0 AT %IW10: INT;
temp1 AT %IW12:INT;

I also have 24 controller which use to control/adjust the temperature. How I should declare this 24 controller?
 
Hello: I am not fully understanding the statement "24 controller". Can you please add more information? With regards to the declaration of the variables, it looks OK, but you do need to have the physical IO connected either through local or remote IO such as fieldbus or real-time Ethernet (such as EtherCAT), actually configured to the IO addresses indicated in the declaration's "AT" qualifier.
 
For variables that will be linked to physical I/O, Beckhoff recommends that you use automatic addressing in your variable declarations:

temp0 AT %I*: INT;
temp1 AT %I*: INT;

The asterisk means that TwinCAT will assign available memory to the address at compile time.

You can also use automatic addressing in arrays, so a quick way to make variables for your 12 sensors would be:

temp AT %I*: ARRAY[0..11] OF INT;

Each element of the array could then be linked to the corresponding integer in the I/O image.
 

Similar Topics

I'm new in PLC programming. I have a small project which have 15 temperature sensor. How I should declare the variable for this 15 sensor. I...
Replies
3
Views
1,907
Hello, I was wondering if anyone know how to upload a PLC program to the Beckhoff TwinCAT 3 from a file? i.e. without having the development pc...
Replies
0
Views
728
Hi All I am not very skilled on TwinCat This is the situation: We are switching from phisical PLC (CX5120) to softPLC (we use HMI, that is a...
Replies
3
Views
1,479
Hello. I have been using CODESYS for years and had taken for granted that the PLC part was very similar to TwinCAT. but just found one issue that...
Replies
1
Views
1,962
Hi, I have no knowledge of TwinCat:shoot: We have a system running TwinCat PLC v.2.11 on a XP computer, EtherCAT BECKHOFF EK1100, 8 24 vOLTS i/O...
Replies
10
Views
3,277
Back
Top Bottom