Dear Mr. Alves,

My project, making the OSCAT Library accessible to OpenPLC is nearly finished. I already posted several hundreds of functions and function block.
But it is not completely done!
There are still some FB´ s remaining which I´m not able to convert. Therefor I request your help:

  • Some FB´s are not convertible due to the “Arrays od Arrays” bug. I updated the Editor to V 20.09.2019, but the bug is still existing. Have you heard anything from the Beremiz team?
  • Three chapters (String functions, buffer management, list processing) causing me problems because of lacking functionality of the Editor (that´s what I believe). PCWorx and Codesys going different ways:
    1. The PCWorx code refers to some FB´s from their own firmware (GET_CHAR, BUF_TO_..., MEMSET). Unfortunately not documented.
    2. Codesys uses pointers in these cases. I couldn´t find any pointer functionality in OpenPLC editor.

Do you have any idea to help me finishing the project completely?

If there is a chance to complete the library or even if not, I suggest that you might delete all my posts in the "custom function" topic. I will send you the whole project as a bundle of two Libs via Mail. Afterwards you can release them in one single post probably added with some explaining words from you.
My 20 or more posts are looking a bit confusing to me and downloading the Lib seems not to be very user friendly.

By the way, copy / paste of data types is definitely not working.

Quote 0 0
lc625, I really appreciate all the work you have put into this. It has leveraged OpenPLC capabilities a million times. Really, thank you! I'm low on free time to dedicate to OpenPLC right now, so I don't know when I'll be able to fix these bugs. I put them at the beremiz project to see if someone in there is willing to help and fix it. If they fix it there, I'll port the fix over to OpenPLC Editor quickly.

About the pointers functions, as far as I know there aren't any pointers instructions on the IEC standard. That's why each vendor has a different approach to this. In this case, we might need to declare C code on the function block (like I did with the T_PLC_MS block) and access the variables directly in C. Please post these Function Blocks here (both PCWorkx and Codesys) and I'll take a look at them.

On the library you ported so far, I'm planning to add the whole thing to the editor since a lot of users will benefit from it. You can keep the posts here for reference, since a lot of them have attached .pdfs explaining the functionality of the blocks.
Quote 0 0

Hi Thiago,

I tried to find a Function block to show as much of the problems as possible. That wasn´t my best idea. I choose “TIMER_EVENT_DECODE” which seems to be the FB with the most dependencies in the whole OSCAT Library. But however, I created two projects, one with the PCWORX Code and one with the Codesys code. I started with PCWORX. This project is a complete conversion form PCWORX (of course not tested). You will easily find the missing FB´s and data type problems. The Codesys project contains the Codesys code only in the main FB (TIMER_EVENT_DECODE). All the depending FB´s have PCWORX code. I didn´t want to change them all, because a lot of them are functions in Codesys and function blocks in PCWORX.

I read, that pointers are now described in the IEC 61131-3 3rd edition but I can´t proof it. Surprisingly I don´t own a complete edition of the IEC.

Please let me know if I can assist you in any way.
Quote 0 0
lc625 wrote:

I read, that pointers are now described in the IEC 61131-3 3rd edition but I can´t proof it. Surprisingly I don´t own a complete edition of the IEC.

Yes, they are, see for example:

I think they need to be added to matiec ( first.
Quote 0 0
Actually matiec knows about references - you just have to activate them:

-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!)
Quote 0 0
Hey Prinn,
thank you for the interesting information. Please keep in mind, that I'm only an engaged user and my programming skills are not very developed. 
Please let me know, where i have to place those lines of code,
Thanks in advance
Quote 0 0
first thank you @all for your great work!

when using T_PLC_MS and CLK_PRG i get the following error

Compiling main program...
/usr/bin/ld: Res0.o: in function `T_PLC_MS(unsigned char, unsigned char*, unsigned char)':
Res0.c🙁.text+0xa554): undefined reference to `__tick'
collect2: error: ld returned 1 exit status
Error compiling C files
Compilation finished with errors!

is there any suggestion for this?

Quote 0 0
Try updating your OpenPLC runtime. There is a chance you’re running an old version that doesn’t support the __tick counter.
Quote 0 0