Yes, I cut and pasted it just as you have it and it didn't compile.
Put it all into one SCL source block.
Set block numbers to be selected automatically (Opions.. Customize..).
Delete all blocks in the Blocks folder.
edit: Important: When deleting the blocks in the Blocks folder, be sure to select to delete Symbols as well !
If it does not compile then, I'll be damned.
I saw you removed the dbControl variables and put them in the fbControl itself. That part I could get to compile but there is a problem with this approach. How do I change the static variables?
You mean you want make small modifications to each instance ?
It will be the same if you define everything as an UDT and pass it to an FC, as using FBs + IDBs.
The declaration of the core FB or UDT will decide the contents of the derived data, and you cannot break that dependency.
One approach is to split into a dependant part and freely definable part.
Another approach is to simply initialise the variables in code. That's what I do. In my code 95% if the variables just use the initial values. So it is a small task to go in an set the few variables that are 'special'.
At first I was thinking of having a db that my 'methods' could access. These 'methods' would be functions. However, I couldn't find a way of passing a DB to a function. How lame. I can pass a structure to a function in C. Then I tried the FB approach where the DB is 'passed' to the FB by putting the .DB after the FB.
Honesly FBs are a pain an I wouldn't use them if I could pass a DB number a FC. I haven't see how one does that.
There are several ways.
The most obvious is to declare the structure in a UDT.
Then make a shared DB with variables dfined by the same UDT.
In the FC you make one input-output "pin" which is also defined by the UDT.
What happens with that approach is that a pointer is passed to the FC. Only, it is transparant to you, and you just use the variables as defined in the UDT.
Actually, it is the same that happens with an FB+IDB. Only with an FC+UDT+Shared DB you can fiddle even more with the structure of the data.