EL5101-Inkrementalgeberklemme hinzugef?gt.
authorFlorian Pose <fp@igh-essen.com>
Tue, 14 Feb 2006 14:40:47 +0000
changeset 67 56964b20c15d
parent 66 cab9cc6a2721
child 68 a452700db994
EL5101-Inkrementalgeberklemme hinzugef?gt.
include/EtherCAT_si.h
master/types.c
--- a/include/EtherCAT_si.h	Mon Feb 13 14:11:33 2006 +0000
+++ b/include/EtherCAT_si.h	Tue Feb 14 14:40:47 2006 +0000
@@ -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
--- a/master/types.c	Mon Feb 13 14:11:33 2006 +0000
+++ b/master/types.c	Tue Feb 14 14:40:47 2006 +0000
@@ -40,6 +40,9 @@
 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_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_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 @@
     {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)