Questions tagged [iec61131-3]

IEC 61131-3 specifies a family of programming languages for PLCs.

IEC 61131-3 specifies a family of programming langues for programmable logic controllers (PLCs). It describes both textual and graphical languages.

  • Instruction List (IL): textual, assembly-like
  • Structured Text (ST): textual, Pascal-like
  • Ladder Diagram (LD): graphical
  • Function Block Diagram (FBD): graphical

References:

68 questions
0
votes
0 answers

How to map a .usercontrol to a REFERENCE TO a STRUCT within a FunctionBlock in Twincat 3

PLC: ST_StopStatus: PLC custom type containing 5 boolean variables. ReferenceBlock: PLC function block containing two variables: stStopStatus: ST_StopStatus refStopStatus: REFERENCE TO ST_StopStatus refStopStatus is set to reference…
nah_ny
  • 37
  • 1
  • 8
0
votes
2 answers

Why can't I pass output variable as a parameter to function block constructor in IEC61131-3 structured text (TwinCAT3)?

I have a function block A that has one variable output (defined in the FUNCTION_BLOCK A method) and this FB_init method: METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; // if TRUE, the retain variables are initialized (warm start /…
Jakub Szlaur
  • 1,852
  • 10
  • 39
0
votes
4 answers

How to pass variable type as an argument to an function in IEC61131-3 structured text (TwinCAT3)?

This is what I would like to have (this is a constructor for FB object): METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; bInCopyCode : BOOL; //My variables: typeOfVariable : TYPE; // This obviously doesn't…
Jakub Szlaur
  • 1,852
  • 10
  • 39
0
votes
3 answers

Is it possible to indirectly index an array in structured text (IEC 61131-3 standard)

I have an array of a structure: myStructure[0..100] I would like to index that structure by name. It works by giving each index a name: P101_AI := 9 P102_AI := 10 P103_AI := 11 P104_AI := 12 So indexing a member in the structure:…
tomatoeshift
  • 465
  • 7
  • 23
0
votes
1 answer

How to create a timing to to controller states in motors?

The timing can be used to create a delay in triggering or switching off the same motor or to create a delay in switching on or off between different motors. This is a feature used to protect the motors, avoiding drives with very short intervals. In…
Apach3
  • 3
  • 2
0
votes
2 answers

If a VAR_INPUT is of INTERFACE type, is the value pass-by-reference or pass-by-value?

In the TwinCAT and CodeSys IEC-61131 programming environments, it's possible to declare POU VAR_INPUTs using an INTERFACE as a type specification. I believe the support for interfaces in TwinCAT and CoDeSys is an extension to the standard IEC-61131…
Hydrargyrum
  • 3,378
  • 4
  • 27
  • 41
0
votes
1 answer

DB_ANY as Plc data type

How can I cast a DB_ANY to a plc datatype in order to get symbolic access to the DB members? It's standard access DB's. In other words I want to indirectly access a DB of a specific type AND get symbolic access to the DB members.
krakers
  • 111
  • 10
0
votes
1 answer

Comparing 2 arrays of characters and finding a match on S7 1500 (PLC)

I am currently working on a small coding exercise on S7 1500 using ST(SCL) where 2 Arrays, A (being the bigger one in length) and B are compared with each other and checked for matching elements. However the array B consists of alphanumeric…
Arjun
  • 9
  • 1
  • 7
0
votes
2 answers

Lookup table for sorted non-sequential elements

I have an array of elements. The array is sorted by the ID of the elements, but the ID's are non-sequential e.g. there are gaps in the ID numbers. I use binary search today to find a specific ID. The ID is 3 bytes, which gives about 16 million…
krakers
  • 111
  • 10
0
votes
1 answer

How works "require" after "export default" in EC6?

Following a tutorial I found this chunk of code in a file: export default require ('knex') ({ client : 'mysql'; connection : { host : 'localhost', user : 'root', password: '', database : 'graph', charset :…
Ersualo
  • 1
  • 2
0
votes
2 answers

Interlock Objects with Integer

I have a bunch of objects, and each object has an unique ID. I need to interlock the objects so that only one of the objects are allowed to perform a certain operation at a time. I got an idea to define an integer that all of the objects have access…
krakers
  • 111
  • 10
0
votes
1 answer

Symbolic adressing of array elements

I have an array of objects, lets say MyArray[1..x] of Object. When programming I want to have a more "readable" way of addressing each object. Instead of saying MyArray[1] := ...etc. I would like to say MyReadableName :=... I've looked into…
krakers
  • 111
  • 10
0
votes
1 answer

Hierarchical State Machine in IEC 61131-3

I would like implement a HSM in 61131-3. Doing some reading I understand that HSM's are a sort of subset of pushdown automata? Most of the examples from other languages are using pointers and references, which I would like to avoid. Is it feasible…
krakers
  • 111
  • 10
0
votes
1 answer

Pointer and reference behavour during online change

could anyone please help me with more information about how pointers, references and interface references behave during an online change? What do I have do watch out for? I understand from other answers that pointers may be dangerous if these are…
krakers
  • 111
  • 10
0
votes
2 answers

How to perform file I/O in CODESYS (IEC 61131-3 )?

I am using an automation device (equipped with CODESYS) to calculate the output value of a function block. In order to make sure the function work as it should do we would like to compare this output value with the output result of another function…
aghd
  • 685
  • 2
  • 9
  • 20