Danielle Kruijver / Mbed 2 deprecated Daan_Test1_maxon

Dependencies:   mbed mbed-rtos

Revision:
0:785972ab5892
Child:
1:822c609fb2ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Daan_Test1_maxon.h	Thu Apr 04 10:08:08 2019 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#ifndef EPOSS
+#define EPOSS
+
+// EPOS commands that you need to home, you can find those in chapter 8 from the application node. 
+const char Shutdown_Data[8] = {0x2B,0x40,0x60,0x00,0x06,0x00,0x00,0x00};
+    
+const char Switch_On_And_Enable_Data[8] = {0x2B,0x40,0x60,0x00,0x0F,0x00,0x00,0x00};
+
+const char Homing_Mode_Data[8] = {0x2F,0x60,0x60,0x00,0x06,0x00,0x00,0x00};     //aan de 0x6060-00 geef je aan dat je nu gaat homen wat de waarde 06 heeft in de data bytes
+    
+const char Homing_Method_Data_positive[8] = {0x2F,0x98,0x60,0x00,0xFD,0x00,0x00,0x00};  //bij de index 0x6098-00 geef je aan welke homing method je gaat gebruiken: 0xFD = -3 = current treshold positive speed
+
+const char Homing_Method_Data_negative[8] = {0x2F,0x98,0x60,0x00,0xFC,0x00,0x00,0x00};  //bij de index 0x6098-00 geef je aan welke homing method je gaat gebruiken: 0xFC = -4 = current treshold negative speed
+    
+const char Start_Homing_Data[8] = {0x2B,0x40,0x60,0x00,0x1F,0x00,0x00,0x00}; //om te beginnen met homen geef je het controlword de waarde 0x001F om het homen te starten 
+
+const char StatusWord_Data[4] = {0x40,0x41,0x60,0x00};
+    
+/** Sends a CAN Message to the controller
+Returns 1 for succes. May be slow. a faster send message is build into Goto_Pos
+@param COB_ID
+@param Message length
+@param Data string
+*/
+CANMessage create_CAN_msg(int COB_ID, int LENGTH, char * DATA);
+    
+// The EPOS class
+class EPOS{
+    
+    public:
+    
+    int NODE_ID;   // the CAN adress of this controller
+
+    /** puts the EPOS in shutdown state */
+    CANMessage Shutdown();
+    
+    /** puts the EPOS in Switchon state */
+    CANMessage SwitchOnAndEnable();
+     
+    /** Requests a statusword from the EPOS */
+    CANMessage StatusWord();
+    
+    /** puts the EPOS in homing mode */
+    CANMessage Homing_Mode();
+    
+    /** sets the homing method to current mode positive speed */
+    CANMessage Homing_Method_positive();
+    
+    /** sets the homing method to current mode positive speed */
+    CANMessage Homing_Method_negative();
+    
+    /** puts the EPOS in start homing state */
+    CANMessage StartHoming();
+    
+    /** Sets the EPOS home method to current pos */
+    CANMessage Homing_Method_current_pos();
+
+    
+    //public:
+
+    /** Homes the EPOS with Current mode */
+    void Homing();
+};
+
+#endif
\ No newline at end of file