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…
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 /…
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…
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:…
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…
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…
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.
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…
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…
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 :…
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…
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…
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…
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…
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…