Try removing "POINTER TO" in the declaration of _rooms. It does seem intuitive to need the Pointer To, but the language takes care of the managing the pointer for you. The pointer is implied.
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using Wago PFC200 for my home automation. I got base function block:
and two the interface:
and
My room's instances looks like this:
In my PLC_PRG I've all instances of my rooms:
Under the PLC_PRG I've some methods to e.g.: automate blinds:
But I got following compilation errors for each room in the _rooms array: C0032: Cannot convert type 'POINTER TO Garage' to type 'POINTER TO IBlinds'
My function block implements IBlinds. Is there a way to cast function block?
Last edit: dawidr 2021-04-26
Hey,
I think you are looking for QUERYINTERFACE https://help.codesys.com/webapp/_cds_operator_queryinterface;product=codesys;version=3.5.16.0
Dont forget to add EXTENDS __System.IQueryInterface to your interfaces
Best regards,
Marcel
Try removing "POINTER TO" in the declaration of _rooms. It does seem intuitive to need the Pointer To, but the language takes care of the managing the pointer for you. The pointer is implied.
@GaryPratt I learned that yesterday evening by reading the CodeSys documentation where it is stated that:
CODESYS always treats variables declared with the type of an interface as references
Last edit: dawidr 2021-04-27