This is an example application demonstrating building an EtherCAT system using Esmacat

Dependencies:   EsmacatShield X_NUCLEO_IHM01A1

Basic Information of Esmacat

Information about Esmacat and EASE is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Homepage

Information about the hardware needs and setup is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Hardware-Setup

Information about the structure of the system and it's software is provided in the link below. https://os.mbed.com/users/esmacat/code/EASE_Example/wiki/Software

About this example

This is an example application to demonstrate the ease with which a system, which communicates over EtherCAT, can be build. It measures the RPM of a motor using a proximity sensor.

Following lists the hardware required

  • 2 x Mbed boards with Arduino UNO form factor (NUCLEO-F103RB)
  • 2 x EASE boards
  • 1 x proximity sensor shield (X_NUCLEO_6180XA1)
  • 1 x Motor shield (X-NUCLEO-IHM01A1)
  • 1 x stepper motor
  • 1 x Ethernet POE injector with a 24VDC power supply
  • 2 x Ethernet cables
  • Keyboard, mouse, and monitor
  • PC with Linux/Windows OS installed
  • DC power supply for motor

https://os.mbed.com/media/uploads/pratima_hb/system_pic1.jpg

Click here to know more about this Example

Revision:
27:e09aa231c16d
Parent:
26:b0203c2265e5
Child:
29:a80a213c3c94
--- a/main.cpp	Thu Apr 07 16:33:42 2016 +0000
+++ b/main.cpp	Fri Apr 08 12:48:30 2016 +0000
@@ -175,21 +175,36 @@
     /*----- Changing the motor setting. -----*/
 
     /* Printing to the console. */
+    printf("--> Setting Torque Regulation Current to 500[mA].\r\n");
+
+    /* Increasing the torque regulation current to 500[mA]. */
+    motor->SetParameter(L6474_TVAL, 500);
+
+    /* Printing to the console. */
     printf("--> Doubling the microsteps.\r\n");
 
     /* Doubling the microsteps. */
     if (!motor->SetStepMode((StepperMotor::step_mode_t) STEP_MODE_1_16))
         printf("    Step Mode not allowed.\r\n");
 
-    /* Printing to the console. */
-    printf("--> Setting Torque Regulation Current to 500[mA].\r\n");
-
-    /* Increasing the torque regulation current to 500[mA]. */
-    motor->SetParameter(L6474_TVAL, 500);
-
     /* Waiting. */
     wait_ms(DELAY_1);
 
+    /* Printing to the console. */
+    printf("--> Setting Home.\r\n");
+
+    /* Setting the current position to be the home position. */
+    motor->SetHome();
+
+    /* Getting current position. */
+    position = motor->GetPosition();
+    
+    /* Printing to the console. */
+    printf("    Position: %d.\r\n", position);
+    
+    /* Waiting. */
+    wait_ms(DELAY_2);
+
 
     /*----- Moving. -----*/
     
@@ -207,10 +222,6 @@
     
     /* Printing to the console. */
     printf("    Position: %d.\r\n", position);
-    printf("--> Setting Home.\r\n");
-
-    /* Setting the current position to be the home position. */
-    motor->SetHome();
 
     /* Waiting. */
     wait_ms(DELAY_1);