EtherCAT - how to read digital inputs value

More
19 Jun 2018 10:10 #112571 by jmiceli
Hi all,

Disclaimer: I'm a beginner in the CN/EtherCAT/LinuxCNC world.

As an introduction, I get a Beckoff "module" with digitals inputs/outpus which I'd like to control.
This "module" has the following components:
  • EK1100 (coupler) - supported by LCEC HAL component
  • EL1252 (2x digital inputs) - supported by LCEC HAL component
  • EL2252 (2x digital outputs) - NOT supported by LCEC HAL component. I will have to write some code later
As EL2252 is not supported yet. I first focus on be able to read the digital inputs.

Using halrun, I loaded LCEC components, created a thread. What I saw:
  • All PINs DIR is OUT
  • The slaves states are PRE-OP
  • The lece.0.1.din-x PINs value never change

How can I change slaves states ?
How can I read the inputs ?

Thanks for your help
J-P

HAL commands:
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt threads name1=test-thread period1=1000000
addf lcec.0.read read-thread
start

The xml file:
<masters>
    <master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
        <slave idx="0" type="EK1100"/>
        <slave idx="1" type="EL1252"/>
    </master>
</masters>

Please Log in or Create an account to join the conversation.

More
20 Jun 2018 10:18 #112613 by ReneCNC
Hello jmicell,


Maybe I had the same problem, but it works now.

Do you have the right slave idx in the .xml?
What does ethercat slaves show when you type it in terminal?

regards Rene

Please Log in or Create an account to join the conversation.

More
21 Jun 2018 06:47 #112701 by jmiceli
Hi Rene,

Thanks for your help.

I found a way to make it work: I used lcec.read-all and lcec.write-all (instead of lcec.0.read alone). This way, the slaves goes in OP state and I was able to read the inputs from el1252.

regards
J-P

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum