wchin - 24 hours ago

We are creating helper function blocks for our VFD(EtherNetIP). How should I set it up so that I can pass the device into and out of the Function Block so that ideally I can access the IO of the device by devicename.channelname.
So something like for example we have a VFD with a start bit that is in the ControlWord channel and a SetVelocity that is a channel. And we want to create a Function Block called StartVFD. So I declare something like:
FUNCTION_BLOCK StartVFD
VAR_IN_OUT
device: ioDrvEthernetIP.RemoteAdapter;
END_VAR
VAR_INPUT
velocity : REAL;

So in the code it would look something like
device.SetVelocity := velocity;
device.ControlWord.6 := True;

We have a pretty basic eds file for our VFD and can update it if necessary.

Thanks in advance.