Machine Automation Forum
A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-25 11:53 PM
I have trouble getting my code working in Machine Expert V2.1. My code works in Codesys but not in Machine Expert and I'm getting the weird compiler error C0037 that 'prt' is not an input to my method but it clearly is!
The code translates with no errors but when I try to generate the code the compiler error appears.
I attached a compact example project.
Is this a bug in Machine Expert?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-26 04:16 AM . Last Modified: 2023-04-26 04:17 AM
I found the problem by myself.
If you write into a interface method declaration the compiler attributes
{attribute 'call_after_global_init_slot' := '10001'}
{attribute 'call_after_online_change_slot' := '10001'}
You will get the described weird compiler error.
Just comment out the attributes in the interface implementation:
And remove the comments in the FB which implements the interface
Fixed.
I highly believe this isn't the intended behavior since its working in Codesys without those comments.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-26 01:07 AM . Last Modified: 2023-04-26 01:09 AM
I investigated the error a bit further. The problem is that I want to store a pointer of each function block which implements the interface 'ConfigServiceInt' into a struct 'RegistryData'.
Something like:
pObject : ConfigServiceInt := ADR(Function_Block_Which_Implements_The_Interface);
The function block which implements the interface will have a register method which passes the pointer of the function block to the struct.
Later in the code I want to iterate through the array and call methods through the interface. Something like:
RegistryData[i].pObject.Some_Interface_Method();
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-04-26 04:16 AM . Last Modified: 2023-04-26 04:17 AM
I found the problem by myself.
If you write into a interface method declaration the compiler attributes
{attribute 'call_after_global_init_slot' := '10001'}
{attribute 'call_after_online_change_slot' := '10001'}
You will get the described weird compiler error.
Just comment out the attributes in the interface implementation:
And remove the comments in the FB which implements the interface
Fixed.
I highly believe this isn't the intended behavior since its working in Codesys without those comments.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.