8/25/2015 12:24 PM | |
Joined: 1/17/2007 Last visit: 5/8/2024 Posts: 1542 Rating: (532) |
There is no provision for an include file or any INCLUDE pre-processor directives. The closest you will get is to define some user constants in the PLC tags. You can do this online by selecting the PLC tags editior and then selecting the user constants tab and entering your constants. Once entered, these will have global scope and will be available to any code blocks in the system. You can also define them in an excel file and then import them using the import facility in the PLC tag editor. See the attached excel file for and example of the file format. AttachmentPLCTags.xlsx (118 Downloads) |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
This contribution was helpful to2 thankful Users |
8/25/2015 4:37 PM | |
Posts: 61 Rating: (11) |
Thanks smiffy, that did it, and excel can make sense of our C header files too so that's a bonus. Brian |
8/26/2015 6:06 PM | |
Joined: 1/17/2007 Last visit: 5/8/2024 Posts: 1542 Rating: (532) |
Here are my thoughts on how to handle C macros.
Simple single constant macros like this should be replaced by user constants. The only caveat is that a constant definition default value cannot contain arithmatic. For example in C you could have:-
Tables are a little harder to manage. You would have to define them as an array of structures and set the default values accordingly. The good news is you can refer to constants within the default values for structure members. The attched file shows you how to implement tables as you are asking. Note I took a guess as to the names / types for your table members. However you have specify the size (array size) as you cannot leave it to the compiler to work it out for you. For some some odd reason the exported code file (attached) only has the initialisers for the first of the array structure elements (index 0) even though I had default data (initialisers) for all elements. (sarcasm) Must be one of those rare Siemens software bugs (/sarcasm). Anyway you get the drift.
I have no idea how you would get it to do this or if it is indeed possible. Not sure that you would even want to :-)
Well the only way to replicate this would be to have an FC passing in x and having a return value so:- Attachmentgrimsahw.txt (67 Downloads) |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
This contribution was helpful to3 thankful Users |
Follow us on