From 41cc152a67c44bf8d5f799bfa260f6b9c04c689e Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Tue, 14 Feb 2006 14:40:47 +0000 Subject: [PATCH] =?UTF-8?q?EL5101-Inkrementalgeberklemme=20hinzugef=C3=BCg?= =?UTF-8?q?t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/EtherCAT_si.h | 31 +++++++++++++++++++++++-------- master/types.c | 15 ++++++++++++++- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/include/EtherCAT_si.h b/include/EtherCAT_si.h index 1390a12b..582bfb80 100644 --- a/include/EtherCAT_si.h +++ b/include/EtherCAT_si.h @@ -17,12 +17,6 @@ /*****************************************************************************/ -#define EC_READ_EL31XX(SLAVE, CHANNEL) \ - ((short int) ((EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] << 8) | \ - EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1])) - -/*****************************************************************************/ - #define EC_WRITE_EL20XX(SLAVE, CHANNEL, VALUE) \ do { \ if (VALUE) EC_PROC_DATA(SLAVE)[0] |= (1 << (CHANNEL)); \ @@ -31,6 +25,12 @@ /*****************************************************************************/ +#define EC_READ_EL31XX(SLAVE, CHANNEL) \ + ((short int) ((EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 2] << 8) | \ + EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1])) + +/*****************************************************************************/ + #define EC_WRITE_EL41XX(SLAVE, CHANNEL, VALUE) \ do { \ EC_PROC_DATA(SLAVE)[(CHANNEL) * 3 + 1] = ((VALUE) & 0xFF00) >> 8; \ @@ -39,15 +39,30 @@ /*****************************************************************************/ -#define EC_READ_EL5001(SLAVE) \ +#define EC_CONF_EL5001_BAUD (0x4067) + +#define EC_READ_EL5001_STATE(SLAVE) \ + ((unsigned char) EC_PROC_DATA(SLAVE)[0]) + +#define EC_READ_EL5001_VALUE(SLAVE) \ ((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ (EC_PROC_DATA(SLAVE)[2] << 8) | \ (EC_PROC_DATA(SLAVE)[3] << 16) | \ (EC_PROC_DATA(SLAVE)[4] << 24))) -#define EC_READ_EL5001_STATE(SLAVE) \ +/*****************************************************************************/ + +#define EC_READ_EL5101_STATE(SLAVE) \ ((unsigned char) EC_PROC_DATA(SLAVE)[0]) +#define EC_READ_EL5101_VALUE(SLAVE) \ + ((unsigned int) (EC_PROC_DATA(SLAVE)[1] | \ + (EC_PROC_DATA(SLAVE)[2] << 8))) + +#define EC_READ_EL5101_LATCH(SLAVE) \ + ((unsigned int) (EC_PROC_DATA(SLAVE)[3] | \ + (EC_PROC_DATA(SLAVE)[4] << 8))) + /*****************************************************************************/ /* Emacs-Konfiguration diff --git a/master/types.c b/master/types.c index 06e340ef..baf68f71 100644 --- a/master/types.c +++ b/master/types.c @@ -40,6 +40,9 @@ unsigned char sm2_41xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; unsigned char sm2_5001[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; unsigned char sm3_5001[] = {0x00, 0x11, 0x05, 0x00, 0x20, 0x00, 0x01, 0x00}; +unsigned char sm2_5101[] = {0x00, 0x10, 0x03, 0x00, 0x24, 0x00, 0x01, 0x00}; +unsigned char sm3_5101[] = {0x00, 0x11, 0x05, 0x00, 0x20, 0x00, 0x01, 0x00}; + /* Konfigurationen der Memory-Management-Units @@ -69,6 +72,9 @@ unsigned char fmmu0_41xx[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, unsigned char fmmu0_5001[] = {0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x07, 0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; +unsigned char fmmu0_5101[] = {0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x07, + 0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; + /*****************************************************************************/ /* Klemmen-Objekte */ @@ -127,6 +133,12 @@ ec_slave_type_t Beckhoff_EL5001 = EC_MAILBOX_SLAVE, sm0_multi, sm1_multi, sm2_5001, sm3_5001, fmmu0_5001, 5 }; +ec_slave_type_t Beckhoff_EL5101 = +{ + "Beckhoff", "EL5101", "Incremental Encoder Interface", + EC_MAILBOX_SLAVE, sm0_multi, sm1_multi, sm2_5101, sm3_5101, fmmu0_5101, 5 +}; + /*****************************************************************************/ /** @@ -147,7 +159,8 @@ ec_slave_ident_t slave_idents[] = {0x00000002, 0x0C5A3052, &Beckhoff_EL3162}, {0x00000002, 0x10063052, &Beckhoff_EL4102}, {0x00000002, 0x10243052, &Beckhoff_EL4132}, - {0x00000002, 0x13893052, &Beckhoff_EL5001} + {0x00000002, 0x13893052, &Beckhoff_EL5001}, + {0x00000002, 0x13ED3052, &Beckhoff_EL5101} }; unsigned int slave_ident_count = sizeof(slave_idents) -- GitLab