150 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
82
views
How to use the new generics feature in TwinCAT 3 structured text
I have the following function block:
FUNCTION_BLOCK FB_GenericsTest
VAR_GENERIC CONSTANT
SIZE: INT := 1;
END_VAR
Which has this FB_Init method:
METHOD FB_Init: BOOL
VAR_INPUT
bInitRetains: ...
1
vote
2
answers
115
views
Use of Function Blocks inside structures
I'm working on a Twincat project where I need to use 1 PLC to manage a set of stepper controllers driven by simple digital outputs.
I've got a function block for driving the stepper when commanded ...
1
vote
1
answer
376
views
Assigning int to enum, what happens if the int value is not a valid enum value
I use TwinCAT and structured text to develop my application.
What will happen when I assign a UINT (e.g. obtained from the modbus register) to an Enum variable where the UINT value is not a valid Enum ...
1
vote
2
answers
227
views
Using a program vs Function block with cycle times in Codesys
My main language is embedded C/C++, but I have a little background in structured text and worked with Codesys a while back in school. I am still figuring out what is possible and best practice in the ...
0
votes
2
answers
92
views
Twincat Confusion with PT Function Block
Trying to create an incredibly simple program for a CX9020 where pushing a button triggers an LED to light up for 250ms and then turn off. Code is:
PROGRAM MAIN
VAR
tonPulseTimer : TP;
END_VAR
IF ...
0
votes
0
answers
64
views
How can I implement automated unit testing for Structured Text in OpenPCS for CI/CD integration?
I'm currently working on a project where we write PLC code/logic using Structured Text in OpenPCS (IEC 61131-3 compliant). We're trying to enhance our development process through support of automated ...
0
votes
3
answers
186
views
Can the "FindAndReplace" function operate on an inplace string?
Referring to the Beckhoff documentation, can the FindAndReplace operate on an inplace string? Or in other words, can pSrcString and pDstString refer to the same string variable?
0
votes
0
answers
92
views
Panasonic FPWINPro Structured Text For Modbus
I've got a FP-X C60R Panasonic PLC with a AFPX-COM5 module.
I have code that increments by 1 every second and it is working.
I'm trying to figure out how to send counter value to a modbus holding ...
-1
votes
1
answer
95
views
DELTA PLC AS228T is Compatible with CODESYS
I am using DELTA PLC AS228T. I wanted to write a program in Structured text.
CODESYS support my PLC ? Documentation is not clear.
2
votes
3
answers
225
views
"File.Flush()" alternative in TwinCAT3
I was wondering if there is there a way to flush the data that is to be written to a file other than closing the file in TwinCAT3?
Usually there is a .Flush() method that would move all the data from ...
1
vote
1
answer
294
views
Handling Errors on TwinCAT for Analog Input Cards [closed]
I am wondering what best practices should be used when using analog input cards such as those for thermocouples with TwinCAT. Specifically I am interested in:
Correct way of declaring variables for ...
0
votes
1
answer
120
views
Prevent the XY Chart from drawing a line from the most recent value to the origin in CODESYS visualization?
I am using CODESYS to plot an array of voltage values in an XY chart in the visualization. The voltage values are updated every second, but I am encountering an issue where the XY chart connects the ...
2
votes
1
answer
741
views
Beckhoff Twincat3 Structured text Dynamic Array size calculation
I am writing a program that loops through an array to check Boolean alarm variable statuses.
I want to dynamically generate the for-loop count integer to end the loop.
I have looked through Benchoff's ...
0
votes
0
answers
55
views
Copying 8 bytes of data from union to pointer in Structured text
I am new to structured text and barely getting started . I need to copy 8 bytes of data I receive over a CAN to another variable in structure in Structured text . Here is my code
TYPE msg :
UNION
...
1
vote
1
answer
245
views
How do I create and describe M-Functions in TwinCAT 2 NC I PLC Control ST?
I decribed M-function in System Manager, but how can I proggram logic for it in ST?
I know how to build\clear interpolation group, link axis, load nc program.
For example, my nc file should be like ...