CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

using ETCSlave as an FB's inout parameter
https://forum.codesys.com/viewtopic.php?f=11&t=9837
Page 1 of 1

Author:  alejho [ Fri Jun 28, 2019 11:32 am ]
Post subject:  using ETCSlave as an FB's inout parameter

Hi all,
I imported the ESI file of my device (it's an inverter) in my project.
Automatically an ETCSlave instance was generated by the system.

To manage this inverter I would like to create an FB that accept as inout the whole ETCSlave but, internally in my FB, I don't know how to handle the in/out of my ETCSlave.

I tried with the pointers to input/output data (".InputData" and ".OutputData") but it seems that I just have read access in this way (may be I'm wrong!)

There is any way to do this?
Thank you in advance for any kind of help!

Author:  rickj [ Fri Jul 05, 2019 7:36 pm ]
Post subject:  Re: using ETCSlave as an FB's inout parameter

Define an input parameter (eg Slave) of type ETCSlave. he inside the FB you an access the ETCSlave instance using Slave.Parameter, Slave.Method(...), etc.

Author:  alejho [ Wed Jul 10, 2019 11:30 am ]
Post subject:  Re: using ETCSlave as an FB's inout parameter

Thank you for your answer...of course it's what I tried to do!
The point is that if the slave has (suppose) a given ethercat i/o mapping:

%QW0
%QW1
...
...
%IW0
%IW1

It seems there's no way to access the i/o data of the ETCSlave passed as in/out parameter at the FB from inside the FB itself.

It's not difficult to find a workaround for this...but I would like to create an FB that hide all the implementation details to the programmers that will use it in the future!
Thank you again!
Ciao!

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/