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

How to use SyncManager(...) ? #9

Open
jinyistudio534 opened this issue Apr 11, 2024 · 5 comments
Open

How to use SyncManager(...) ? #9

jinyistudio534 opened this issue Apr 11, 2024 · 5 comments

Comments

@jinyistudio534
Copy link

Hi,
Sorry, can you give me a sample program to teach me how to use SyncManager ?

@tecki
Copy link
Owner

tecki commented Apr 12, 2024

I guess that you actually want to know how to use a PacketDesc. That is declared with something like

myData = PacketDesc(SyncManager.IN, 12, "H")

meaning that at position 12 in the input sync manager, i.e. the one to get data from the slave to the master, there is an unsigned 16 bit integer ("H"), that one can read.

myBit = PacketDesc(SyncManager.OUT, 24, 5)

means at byte position 24, bit number 5 can be written to the slave.

@jinyistudio534
Copy link
Author

Hi,

  1. Is there no need to declare before using SyncManager.IN?
  2. Can you tell me what the functionality of SyncManager is and when can I use it?
    class ebpfcat.ethercat.SyncManager(value, names=None, *values, module=None, qualname=None, type=None, start=1,
    boundary=None)

@tecki
Copy link
Owner

tecki commented Apr 13, 2024

Well, this is an enum, with two possible values: IN and OUT. Unfortunately, sphinx always auto-generated this weird documentation, I still have to figure out how to stop it from doing so.

@jinyistudio534
Copy link
Author

jinyistudio534 commented Apr 18, 2024

I guess that you actually want to know how to use a PacketDesc. That is declared with something like

myData = PacketDesc(SyncManager.IN, 12, "H")

meaning that at position 12 in the input sync manager, i.e. the one to get data from the slave to the master, there is an unsigned 16 bit integer ("H"), that one can read.

myBit = PacketDesc(SyncManager.OUT, 24, 5)

means at byte position 24, bit number 5 can be written to the slave.

👉👉👉**Use PacketDesc() to read or write 32 bytes at a time. How to input format ?**

@tecki
Copy link
Owner

tecki commented Apr 18, 2024

I am not sure what you try to do. You could try to use "32s", that should work at least with the normal (not fast) ethercat. In Fast ethercat mode, this is not possible as EBPF does not allow to read or write 32 bytes at a time.

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