Questions tagged [structured-text]

Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs).

From Wikipedia: Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal, on which it is based. All of the languages share IEC61131 Common Elements.

126 questions
1
vote
2 answers

Defining a falling edge detection in Codesys

For one of my programs I need a normally closed, timed-closing (NCTC) relay in Ladder Diagram. I do not know of a standard method to implement such, so I'm trying to construct one myself. My current approach needs a falling-edge detection. The code…
Mast
  • 1,788
  • 4
  • 29
  • 46
1
vote
1 answer

Cx programmer-Structured text, Array assignement

i'm learning structured text, to program with Cx-programmer, an Omron software. i' ve looked around but i can't find a way to assign multiple element to an array, i've tried this soluion, but it doesn't work, this is Arrays declaration(internals…
1
vote
2 answers

PLC Object Oriented Programming - Using methods

I'm writing a program for a Schneider PLC using structured text, and I'm trying to do it using object oriented programming. Being a newbie in PLC programming, I wrote a simple test program such a this: okFlag:=myObject.aMethod(); IF okFlag THEN …
Marconi
  • 11
  • 1
  • 5
1
vote
1 answer

Using Arrays in structured text

I am using B&R Automation Studio on a simulation PLC. I am just playing around with some programs and have come across a problem. I have a list of alarms for my system. If anyone of these alarms go off, I want there to be an alarm flag. This is…
Tony Hibbert
  • 91
  • 2
  • 2
  • 10
1
vote
2 answers

What's the differences between a UINT and a WORD with Profinet

I'm developing a project on a Siemens PLC and i'm wondering if I should use a Word or a UINT to store a 16-bit value. Is there any differences between the two?
jfpatenaude
  • 86
  • 1
  • 8
1
vote
1 answer

Shift operation returning weird error

I'm programming a plc by ABB in the codesys environment, and I can't figure out why I'm getting this error: Error 4024: ... Expecting ELSIF, ELSE or END_IF before 'SHL' The code returning this error is something like: IF flag THEN iState :=…
clabacchio
  • 1,047
  • 1
  • 17
  • 28
1
vote
1 answer

How do I program an Interpolated Position Mode sequence in IEC-61131 Structured Text using the Maxon EPOS Libraries?

The Maxon EPOS libraries define some Function Blocks that seemingly handle Interpolated Position Mode, however there are no samples, as far as I can determine, that specify how to use them. Here is what I have so far but at the moment it just skips…
Brendan
  • 18,771
  • 17
  • 83
  • 114
0
votes
1 answer

Passing an instance of a FB into the initialization of a different instance from a different function block

I am new to twincat3 and especially using it with oop. I am trying to pass an instance of FB_EventLogger to the FB_init of an instance of O2_Sensor. Forexample: Main Var EventLogger : FB_EventLogger (I_PersistantEventStrotagr := CSV); O2_sensor :…
0
votes
0 answers

sACN communication from ETC ION to Beckhoff PLC controller - readout values are weird

I am trying to read out sACN values ​​from an ETC ION Light desk using the Beckhoff PLC. I have successfully connected to universe 12 and can read out values ​​in the individual byte spaces. But all bytes that are connected to a lamp or similar are…
0
votes
2 answers

Iterating through variable list

I'm writing an App on CODESYS that has a set of alarms in a variable list whose state I'd like to check in a program. Right now I'm just referencing those variables individually in the program, but I was wondering if there's a way to iterate through…
0
votes
1 answer

DocStrings in Structured Text?

I am currently using Wago’s e!cockpit environment to write my plc project in ST. I know that for Python, C++ there are programs for docstring for easier and cleaner documentation. I wondered if there is such a thing for structured text? Or even in…
0
votes
1 answer

How do I automate/optimize D/Y connection selection based on selected input voltage and motor plate voltage values?

I have a test setup with six (6) selectable load motors and four (4) possible input voltage options. The motors are divided into three (3) motor sets, each containing two (2) motors (i.e. 1M1 1M2, 2M1 2M2 and 3M1 3M2 where the first number is the…
0
votes
1 answer

Does for loop in PLC causes delay in cycle time

I am using Beckhoff PLC(Structured Text language) for a while and trying not to use for loops in all algorithm to make sure everything works in real time and won't get stuck in any loop. Time is so important for algorithms that I am working on. Any…
Freq
  • 83
  • 2
  • 7
0
votes
2 answers

How to throw an exception in TwinCAT

When using object-oriented programming aspects with Beckhoff TwinCAT 3 I recently tried to implement some Assert-like function which should throw an exception in case a guard clause evaluates to false. Something like this: FUNCTION GuardI VAR_INPUT …
florians
  • 91
  • 1
  • 4
0
votes
1 answer

Converting an integer to binary

I am using Connected Components Workbench V12 with a Micro850 PLC I am trying to take an input from a barcode scanner and convert the scanned integer input to a 8-bit binary number to use each bit as a boolean to trigger outputs on the PLC. I am…
1 2 3
8 9