Skip to content

How to read or write custom ethercat slave ? #7

@jinyistudio534

Description

@jinyistudio534

EasyCAT HAT is a ethercat slave for raspberry pi.
this slave is here EasyCAT and its ESI/XML
this slave can share 32 bytes for output(from slave, master read only) , 32byte for input(from master,slave read only).

I have try to define a slave into terminals.py :

class EASYCAT3232(EBPFTerminal):
compatibility = {(0x0000079A, 0x00DEFEDE)}
byte0 = ProcessDesc(0x0005, 1, 'B')
byte1 = ProcessDesc(0x0005, 2, 'B')
byte2 = ProcessDesc(0x0005, 3, 'B')
byte3 = ProcessDesc(0x0005, 4, 'B')
byte4 = ProcessDesc(0x0005, 5, 'B')
byte5 = ProcessDesc(0x0005, 6, 'B')
byte6 = ProcessDesc(0x0005, 7, 'B')
byte7 = ProcessDesc(0x0005, 8, 'B')
byte8 = ProcessDesc(0x0005, 9, 'B')
byte9 = ProcessDesc(0x0005, 10, 'B')
byte10 = ProcessDesc(0x0005, 11, 'B')
byte11 = ProcessDesc(0x0005, 12, 'B')
byte12 = ProcessDesc(0x0005, 13, 'B')
byte13 = ProcessDesc(0x0005, 14, 'B')
byte14 = ProcessDesc(0x0005, 15, 'B')
byte15 = ProcessDesc(0x0005, 16, 'B')
byte16 = ProcessDesc(0x0005, 17, 'B')
byte17 = ProcessDesc(0x0005, 18, 'B')
byte18 = ProcessDesc(0x0005, 19, 'B')
byte19 = ProcessDesc(0x0005, 20, 'B')
byte20 = ProcessDesc(0x0005, 21, 'B')
byte21 = ProcessDesc(0x0005, 22, 'B')
byte22 = ProcessDesc(0x0005, 23, 'B')
byte23 = ProcessDesc(0x0005, 24, 'B')
byte24 = ProcessDesc(0x0005, 25, 'B')
byte25 = ProcessDesc(0x0005, 26, 'B')
byte26 = ProcessDesc(0x0005, 27, 'B')
byte27 = ProcessDesc(0x0005, 28, 'B')
byte28 = ProcessDesc(0x0005, 29, 'B')
byte29 = ProcessDesc(0x0005, 30, 'B')
byte30 = ProcessDesc(0x0005, 31, 'B')
byte31 = ProcessDesc(0x0005, 32, 'B')

Refer to your devices.py, I don't know what kind of device it should be.
As following code. Please tell me how to modify the following program to read the value of byte0 and write the value to byte1? 😵 DigitalOutput -> ???

easycat = EASYCAT3232(master)
await easycat.initialize(-5,21)
do1 = DigitalOutput(out1.channel1) # use channel 1 of terminal "out"
do2 = DigitalOutput(out2.channel3) # use channel 1 of terminal "out"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions