[etherlab-users] Use EtherCAT in Etherlab
fp at igh-essen.com
Fri Apr 24 09:29:18 CEST 2009
On Thu, Apr 23, 2009 at 09:59:22PM +0200, Andy Rohr wrote:
> I managed to run a minimal Etherlab System based on the bundle 1.6. I made
> a "handcoded C application" using the C-API based on the given skeleton.
> Now I would like to make use of the EtherCAT-Master and get some data from
> EtherCAT slaves. The app_main.c has a function TaskStep where the cyclic
> task is implemented. I this the point where I should use the
> EtherCAT-master (doing things like in function "run" of the rtai_sample.c)?
> How are EtherCAT-master and the realtime-task brought together without
> using Simulink?
you could write a set of EtherCAT funkctions, for example
- ethercat_init(), which requests the master, does the bus configuration
and master activation. Call this in TaskInit().
- ethercat_read(), which calls ecrt_master_receive() and
ecrt_domain_process() and reads the EtherCAT inputs into the signal
- ethercat_write(), which writes process data from the signal tree into
EtherCAT process image and then calls ecrt_domain_queue() and
Call there two in TaskStep(), and do your calculations in between.
In TaskExit(), you could call a function like ethercat_cleanup(), which
releases the master again.
I did it this way in a recent project and it works great.
More information about the Etherlab-users