Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asyncronous Event Based Data Access. #70

Open
Bit2Bi opened this issue Jul 4, 2022 · 1 comment
Open

Asyncronous Event Based Data Access. #70

Bit2Bi opened this issue Jul 4, 2022 · 1 comment

Comments

@Bit2Bi
Copy link

Bit2Bi commented Jul 4, 2022

Hello,
I am wondering if there is a suitable method to read data from slave on an event based pattern. In case of the native SOEM code what memory address or variable should be listened to?
Actually, I am reading the data from slave in a continous loop like:
`
do {
for (i = 0; i < oloop; i++) outData += *(ec_slave[0].outputs + i );

for (i = 0; i < iloop; i++) inData += *(ec_slave[0].inputs + i );
} while(true);
`
Helpful hints are much appreciated.

@Apollo3zehn
Copy link
Owner

If you want to know if a slave variable has changed, there is no built-in method to monitor changes. Data from all the slaves is collected in a single round-trip EtherCAT frame and simply copied to the IOMap array to which the .inputs and .outputs variables are pointing to.

If know which variable you want to monitor you could compare the IOMap (or that part which holds the data of your variable to monitor) to the old IOMap right after the UpdateIO method is called (in case of EtherCAT.NET it would be here: https://github.com/Apollo3zehn/EtherCAT.NET/blob/master/sample/SampleMaster/Program.cs#L120)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants