Questions tagged [plc]

PLC (Programmable logic controller) or programmable controller is a digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, amusement rides, or light fixtures.

1091 questions
3
votes
2 answers

How can I automatically add padding to bytes in a struct to fix register alignment in C?

This might sound like a weird question at first and I understand why. My problem is a little hard to explain but hopefully I can explain it well. EDIT: Padding may already be done in the CPU, but this padding is lost when being saved to the HMI…
3
votes
3 answers

Converting real data type from Siemens PLC (S7-1200) to be displayed in Visual C# Windows Form

I am trying to read a real value from a Siemens PLC (S7-1200) and display it in Windows Form. I am using the S7.NET library to communicate with the PLC and a TIA Portal V15 to program/Monitor the PLC. I am able to read the particular data block…
Jai Jai
  • 31
  • 1
  • 4
3
votes
1 answer

TwinCat How To Initialize Functionblock with Reference to Global Variable

Hello StackOverflow Community, i have another question regarding the TwinCat/Beckhoff/Codesys Programming Language, maybe someone is able to help me with this problem. Here is the Problem: I want to initalize a functionblock with a reference to some…
manuel2705
  • 45
  • 4
3
votes
1 answer

Writing control code on WAGO PFC200 PLC in C/C++ languages?

I have a WAGO PFC200 750-8206 and was wondering if I can write my control logic code in C/C++. I know that WAGO uses codesys runtime and codesys only supports IEC languages, but WAGO claims that their PLCs support C/C++ programs. What I am not sure…
3
votes
1 answer

SCL code: tag FUNCTION not defined on TIA

I want to create a new SCL function with TIA 15.1. I chose Program blocks => Add new block => Function. When I write the keyword FUNCTION in my file I get the following error: tag FUNCTION not defined. This is the same for others keywords like VAR…
Kantine
  • 47
  • 1
  • 8
3
votes
1 answer

PLC not connecting to KEP Server (OPC)

We can't get our PLC to reliably connect with KEPServerEX (OPC). I was wondering if anyone else here at SOF has experience working with PLC and OPC. If so do they have any tips on making a reliable connection with our OPC Server. We currently use…
Rob_IGS
  • 575
  • 3
  • 8
  • 17
3
votes
1 answer

Timed out when reading tag through pycomm

I am having a problem with Pycomm. i have two files: for reading tag in a while loop is to write value in tag when reading tags, it works fine and print value in console. The problem arises when i try to write value in tag while the first file is…
Narpat Singh
  • 126
  • 8
3
votes
1 answer

How to get the length of BOOL[] in SCL with RSLogix 5000

Goal I am programming an Allen-Bradley / Rockwell CompactLogix PLC in SCL. I would like to determine the size of Arrays at runtime. It would be possible to enter the Array lengths as constants into the code before compiling. However, the reusability…
KasparJohannes
  • 520
  • 2
  • 7
  • 26
3
votes
2 answers

TwinCAT 3: Write to File

I want to export some data from my PLC by writing it into a text-file and saving it to an USB-Stick. I managed to create the text file, but I can't write anything. I use functions from the TwinCAT standard-libraries in the following code: PROGRAM…
l.voe
  • 83
  • 2
  • 11
3
votes
2 answers

Exporting Ladder Logic in Tia 14

TL;DR: What is the best way to Export Ladder Logic in Tia 14? Recently my company has started using Tia Portal v14. The update was due and we have begun to do some work with the S7 1500 series of CPUs. It has come to the attention of those in my…
JustinCoplin
  • 169
  • 3
  • 16
3
votes
1 answer

How can I add a custom programing language to NotepadQQ?

In NotepadQQ, I would like to add G-code and PLC (FBD, LD, ST, IL and SFC) programing language definitions/syntax code highlighting. Is this possible for a user to do this? How is it done? I found a post about how to add a language…
3
votes
1 answer

How can I get current time from PLC (Beckhoff)

I am trying to get the current time from the PLC (Beckhoff-cx5130). I have tried "GETSYSTEMTIME", but I am not getting any output. I also tried "NT_GetTime" "TIMESTRUCT" and "T_FILETIME" but showing some compiling error (Could be a library…
ali nawaz
  • 93
  • 1
  • 7
3
votes
6 answers

Is it required to use an OPC Server to Communicate with Controllogix?

I'm wondering if for simply communicating with a PLC, like reading and writing tags, do I need all of the other heavy lifting that comes with an OPC-UA server? I've tried writing a simple server in Python that talks to the PLC, but I get denied…
jameson1128
  • 135
  • 2
  • 13
3
votes
2 answers

Instantiating of numerous function block in CODESYS (IEC61131)

I have made a function block using CODESYS to perform energy metering. The inputs of the function block is current and voltage and the output is energy. Now, we need to have 1000 instances of this function block to run the code for 1000 meter we…
aghd
  • 685
  • 2
  • 9
  • 20
3
votes
2 answers

Send an array from C# to TwinCat 3 via ADS.Net

I want to make an automated graphical fountain using TwinCat 3 to control the valves and Visual Studio C# for processing the image that want to show on the fountain. The final form of the image processing program is a binary array image (attached)…
Calvin Joseph
  • 33
  • 1
  • 4