I had a private conversation with user lc625 (Carsten) about this topic a few months ago. I managed to create a beta version of the editor that had some form of pointer implemented. Unfortunately I don't have any free time available to work further on the development of this feature for now. I believe it is not hard to finish, might just require some debugging and working on little details. I'll leave some parts of the conversation here so that anyone that is interested can continue the work where I left off.
Hey Carsten, how are you doing?
So, I'm working on incorporating your great work with the OSCAT library on the next version of the OpenPLC Editor and runtime. I've completed integrating OSCAT Building 1.0 and it works great! Thanks =)
Now, the problem that I'm facing is that, while I try to incorporate OSCAT Mathematics, there are several blocks in that library that are already defined in OSCAT Building. What should I do about those? Should I remove the redundant blocks from one of the libraries? Is the implementation different between OSCAT Building and OSCAT Mathematics?
PS: Also, I'm also working on adding some new features to the core compiler (matiec) that will allow you to continue your work on the libraries. Things that are on the works:
- display full token location on error messages
- use a relaxed datatype equivalence model
- allow use of references (REF_TO, REF, ^, NULL) as well as REF_TO in ARRAYs and STRUCTs
- allow use of nested comments
- allow use of forward references
nice to get a message from you! I’m fine and hope it’s the same with you.
The second thing is the missing functionality of using pointers. Obviously there is a solution already:
"Carsten, please note that the underlying matiec compiler already supports pointers, following the syntax defined in IEC 61131-3 edition 3.
I implemented this quite some time ago upon request by a company using matiec but not Beremiz. You need to add a command line option to have the compiler accept this syntax.
Running ./iec2c will list all available options. Let me see now...
-r : allow use of references (REF_TO, REF, ^, NULL) (an IEC 61131-3 v3 feature)
-R : allow use of REF_TO ANY datatypes (a non-standard extension!) as well as REF_TO in ARRAYs and STRUCTs (a non-standard extension!)
Does this help?
Thiago, if there is a way to help you with the implementation, please let me know. If there are things to do with my basic skills, I will do my best.
Hope to hear you soon
great job, really impressive. If all the blocks are implemented, i fear you have to write a new manual for your project :-) To be honest, I think it will be one of the most powerful PLC software available.
Let's take a brief look towards the pointer functionality:
I tried to convert one block which uses a pointer. I just choose one randomly. The pictures are showing you the original CODESYS code and the OpenPLC trial. I expected to find any datatypes or possibilities to create own datatypes related to pointers. Unfortunately I couldn't find any. The "ADR" function should be a standard one but is obviously not known.
Looking at iec2c there is obviously the possibility of using pointers. I suppose the syntax is not "pointer to" but "rev to". The desired option might be -r; -R.
At this point I come to an end. For me it's like trying to fly to the moon without having invented the wheel.
Of course this is not an A theme. It's more a wish to complete the library. Do you have an idea without investing too much time?
Thanks. MatIEC (OpenPLC's internal compiler) supports similar instructions. POINTER TO BYTE should be translated as REF_TO BYTE. The ADR() function should be translated as REF(). I still need to implement the menu on the editor where you will be able to pick REF_TO types. However, if you declare the variables manually it might work on the compiler (like, create the VAR section by hand in the code)
I found a few minutes this evening. I'm not sure if the REF and REF_TO thing works until now. To show you at first the original code:
Next the code in OpenPLC
At last the error message
If I can try something else, let me know