Post by ph0010421 on How to transfer data from DINT to Union(16 Bools) which I need to use in Few FBs
CODESYS Forge
talk
(Post)
In the Struct, change the 'BOOL' to 'BIT'
Last updated: 2023-12-14
Open dialog from ST , how to set parameters (vars) to dialog
CODESYS Forge
talk
(Thread)
Open dialog from ST , how to set parameters (vars) to dialog
Last updated: 2024-06-05
Which Lib to use, connect to a socket with URL instead of IP address
CODESYS Forge
talk
(Thread)
Which Lib to use, connect to a socket with URL instead of IP address
Last updated: 2024-06-17
is it possible to connect to a newer runtime from HMI runtime 3.5.16
CODESYS Forge
talk
(Thread)
is it possible to connect to a newer runtime from HMI runtime 3.5.16
Last updated: 2024-07-02
The Ultimate Guide to Taxi Services in the UK: From Airports to City Travels
CODESYS Forge
talk
(Thread)
The Ultimate Guide to Taxi Services in the UK: From Airports to City Travels
Last updated: 2024-08-08
Navigating the UK with Ease: Your Guide to Taxi Services from Major Cities to Key Destinations
CODESYS Forge
talk
(Thread)
Navigating the UK with Ease: Your Guide to Taxi Services from Major Cities to Key Destinations
Last updated: 2024-08-08
how to extract the name of an FB to a variable
CODESYS Forge
talk
(Thread)
how to extract the name of an FB to a variable
Last updated: 2024-10-01
Post by jackbrady on Function Blocks and arrays of function blocks
CODESYS Forge
talk
(Post)
Hello, I am new to Codesys and PLC programming in general (please go easy ha!) I'm not looking for code to be written for me just some help and pointing in the right direction. I am writing some code to send commands to a relay based on input values (to put it simply). Quite basic stuff. I have wrote a function block that takes a global variable (Open_command:BOOL) and outputs to another global variable (Opened : BOOL). The function block is simulating a device so I'll eventually get the globals from that. I now need to create multiple versions of this function block/ device (lets say 100) but I need each iteration of that function block to reference it's own relevant global variable. I think that the best way of doing this would be to use arrays, although I could be wrong. I am aware that for up to 100 instances I could very well manually assign everything but that seems rather time consuming and I want a fancier way of doing it. Here is a very basic example of what I am looking to do, please note I have not written this in proper code it's just to show what I mean. Global Variables V[0-100] int Open_command [0-100] Bool Opened [0-100] Bool Function Block var input x : BOOL Var output y : BOOL if x then y = TRUE ELSE y = FALSE The input to my function block will be Open_command, output will be Opened Example code. If V[x] > 10 then Open_command [x] = TRUE ELSE Open_command [x] = FALSE (So when V1 goes above 10 I need Open_command1 = TRUE therefore initiating FB1 output. V2 > 10, open_command2 = True > FB2 output V3 > 10, open_command3 = True > FB3 output ... ... ) What I can't seem to figure out is how to tie all this together, I have read through the codesys documentation and if anything it has confused me more! ha. Apologies for the poorly written post but hopefully you understand what I am trying to get at. Thanks, Jack
Last updated: 2024-02-14
Import RsLogix 5000 project to Codesys
CODESYS Forge
talk
(Thread)
Import RsLogix 5000 project to Codesys
Last updated: 2023-09-07
IMAGE DISPLAY ACCORDING TO INPUT VARIABLE
CODESYS Forge
talk
(Thread)
IMAGE DISPLAY ACCORDING TO INPUT VARIABLE
Last updated: 2023-09-12
Retain memory change to ZERO
CODESYS Forge
talk
(Thread)
Retain memory change to ZERO
Last updated: 2023-09-19
Fail to download missing libraries
CODESYS Forge
talk
(Thread)
Fail to download missing libraries
Last updated: 2021-11-12
Moved To: Control double acting valve
CODESYS Forge
talk
(Thread)
Moved To: Control double acting valve
Last updated: 2016-10-18
How to configure OPC-UA server
CODESYS Forge
talk
(Thread)
How to configure OPC-UA server
Last updated: 2018-12-03
SoftMotion interface to analog axes
CODESYS Forge
talk
(Thread)
SoftMotion interface to analog axes
Last updated: 2016-12-08
Lock usb port to a device
CODESYS Forge
talk
(Thread)
Lock usb port to a device
Last updated: 2017-06-07
Device descriptor: how to create...
CODESYS Forge
talk
(Thread)
Device descriptor: how to create...
Last updated: 2018-09-12
RFC2217 Serial to Ethernet devices
CODESYS Forge
talk
(Thread)
RFC2217 Serial to Ethernet devices
Last updated: 2017-08-03
Login-to-PLC problems
CODESYS Forge
talk
(Thread)
Login-to-PLC problems
Last updated: 2016-09-21
Bit access to DWORD Variable
CODESYS Forge
talk
(Thread)
Bit access to DWORD Variable
Last updated: 2019-12-18
Raspberry Pi to Codesys 2.3
CODESYS Forge
talk
(Thread)
Raspberry Pi to Codesys 2.3
Last updated: 2014-01-29
modbus from serial to tcp
CODESYS Forge
talk
(Thread)
modbus from serial to tcp
Last updated: 2017-06-05
Logging to a SoftPLC remotely?
CODESYS Forge
talk
(Thread)
Logging to a SoftPLC remotely?
Last updated: 2020-10-02
LoadFile - delete button goes to exception
CODESYS Forge
talk
(Thread)
LoadFile - delete button goes to exception
Last updated: 2018-11-23
Unable to import device description error
CODESYS Forge
talk
(Thread)
Unable to import device description error
Last updated: 2021-07-29
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.