Noob in Codesys and IFM CR7506...Output stay active
CODESYS Forge
talk
(Thread)
Noob in Codesys and IFM CR7506...Output stay active
Last updated: 2024-10-22
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
Symbol Configuration
CODESYS Forge
talk
(Thread)
Symbol Configuration
Last updated: 2023-08-29
Loading a file
CODESYS Forge
talk
(Thread)
Loading a file
Last updated: 2016-03-14
PLCHander header files
CODESYS Forge
talk
(Thread)
PLCHander header files
Last updated: 2010-02-23
Library creation error
CODESYS Forge
talk
(Thread)
Library creation error
Last updated: 2017-11-06
Dynamic function call
CODESYS Forge
talk
(Thread)
Dynamic function call
Last updated: 2007-06-29
Numerical Keypad
CODESYS Forge
talk
(Thread)
Numerical Keypad
Last updated: 2013-05-23
Bug Please Fix!!!!
CODESYS Forge
talk
(Thread)
Bug Please Fix!!!!
Last updated: 2009-10-10
Button
CODESYS Forge
talk
(Thread)
Button
Last updated: 2011-06-11
void pointer
CODESYS Forge
talk
(Thread)
void pointer
Last updated: 2014-08-25
webvisu
CODESYS Forge
talk
(Thread)
webvisu
Last updated: 2012-06-13
Doubt in ADR
CODESYS Forge
talk
(Thread)
Doubt in ADR
Last updated: 2009-03-17
PLCHandler example request
CODESYS Forge
talk
(Thread)
PLCHandler example request
Last updated: 2009-04-13
Gateway protocol
CODESYS Forge
talk
(Thread)
Gateway protocol
Last updated: 2019-02-04
General Data Transmission
CODESYS Forge
talk
(Thread)
General Data Transmission
Last updated: 2012-08-05
Signal generator RMP_B
CODESYS Forge
talk
(Thread)
Signal generator RMP_B
Last updated: 2011-01-31
Frequency Measurement
CODESYS Forge
talk
(Thread)
Frequency Measurement
Last updated: 2018-07-10
private messages
CODESYS Forge
talk
(Thread)
private messages
Last updated: 2012-06-08
MODBUS TCP Slave
CODESYS Forge
talk
(Thread)
MODBUS TCP Slave
Last updated: 2017-10-31
Version 2.3.9.50 changes
CODESYS Forge
talk
(Thread)
Version 2.3.9.50 changes
Last updated: 2016-06-27
Printing Error
CODESYS Forge
talk
(Thread)
Printing Error
Last updated: 2014-11-04
Alarmtable, colorencoding
CODESYS Forge
talk
(Thread)
Alarmtable, colorencoding
Last updated: 2016-03-17
for beginner
CODESYS Forge
talk
(Thread)
for beginner
Last updated: 2006-03-24
cmdfile commands
CODESYS Forge
talk
(Thread)
cmdfile commands
Last updated: 2009-10-13
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
.