No subject


Fri Jan 30 10:19:00 CET 2009


image.
I again attach the code of my little example.

> THis looks strange. Could you please post the output of 'ethercat pdos
> -p<your slave>' after a power cycle?

root at SWES-Linux:/home/daniel/EtherCAT/ethercat-devel-r1680/tool# =
./ethercat
pdos -p 1
SM0: PhysAddr 0x1000, DefaultSize    0, ControlRegister 0x64, Enable 9
  RxPDO 0x1680 "Ch1 CycleCount"
    PDO entry 0x7800:01, 16 bit, "Ch1 CycleCount"
  RxPDO 0x1600 "Ch1 Sample"
    PDO entry 0x7000:01, 16 bit, "Ch1 Value"
SM1: PhysAddr 0x1400, DefaultSize    0, ControlRegister 0x64, Enable 9
  RxPDO 0x1780 "Ch2 CycleCount"
    PDO entry 0x7800:02, 16 bit, "Ch2 CycleCount"
  RxPDO 0x1700 "Ch2 Sample"
    PDO entry 0x7000:02, 16 bit, "Ch2 Value"
SM2: PhysAddr 0x0998, DefaultSize    0, ControlRegister 0x00, Enable 4
  TxPDO 0x1a82 "StartTimeNextOutput"
    PDO entry 0x1d09:98, 32 bit, "StartTimeNextOutput"

Thanks for your help!

------_=_NextPart_001_01C9BF3E.6852B8C0
Content-Type: application/octet-stream;
	name="main.c"
Content-Transfer-Encoding: base64
Content-Description: main.c
Content-Disposition: attachment;
	filename="main.c"

I2luY2x1ZGUgPGVycm5vLmg+CiNpbmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+
CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHN5cy9yZXNvdXJjZS5oPgojaW5jbHVkZSA8
c3lzL3RpbWUuaD4KI2luY2x1ZGUgPHN5cy90eXBlcy5oPgojaW5jbHVkZSA8dW5pc3RkLmg+Cgov
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKi8KCiNpbmNsdWRlICJlY3J0LmgiCgovKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKio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ioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKi8K

------_=_NextPart_001_01C9BF3E.6852B8C0--


More information about the etherlab-dev mailing list