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:
10:8f031470ca9f
Parent:
9:dc704c11181d
Child:
11:3e303a25770d
--- a/main.cpp	Fri Nov 27 10:02:40 2015 +0000
+++ b/main.cpp	Fri Nov 27 11:26:14 2015 +0000
@@ -51,8 +51,8 @@
 
 /* Definitions ---------------------------------------------------------------*/
 
-/* Number of steps corresponding to one round angle of the motor. */
-#define MOTOR_STEPS 400
+/* Number of steps to move. */
+#define STEPS 3200
 
 
 /* Variables -----------------------------------------------------------------*/
@@ -82,10 +82,10 @@
     /*----- Moving. -----*/
 
     /* Printing to the console. */
-    printf("--> Moving forward %d steps.\r\n", MOTOR_STEPS);
+    printf("--> Moving forward %d steps.\r\n", STEPS);
 
     /* Moving N steps in the forward direction. */
-    motor->Move(StepperMotor::FWD, MOTOR_STEPS);
+    motor->Move(StepperMotor::FWD, STEPS);
 
     /* Waiting while the motor is active. */
     motor->WaitWhileActive();
@@ -103,10 +103,10 @@
     /*----- Moving. -----*/
     
     /* Printing to the console. */
-    printf("--> Moving backward %d steps.\r\n", MOTOR_STEPS >> 1);
+    printf("--> Moving backward %d steps.\r\n", STEPS >> 1);
 
     /* Moving N steps in the backward direction. */
-    motor->Move(StepperMotor::BWD, MOTOR_STEPS >> 1);
+    motor->Move(StepperMotor::BWD, STEPS >> 1);
     
     /* Waiting while the motor is active. */
     motor->WaitWhileActive();
@@ -128,10 +128,10 @@
     /*----- Going to a specified position. -----*/
 
     /* Printing to the console. */
-    printf("--> Going to position %d.\r\n", MOTOR_STEPS >> 1);
+    printf("--> Going to position %d.\r\n", STEPS >> 1);
     
     /* Requesting to go to a specified position. */
-    motor->GoTo(MOTOR_STEPS >> 1);
+    motor->GoTo(STEPS >> 1);
     
     /* Waiting while the motor is active. */
     motor->WaitWhileActive();
@@ -247,13 +247,13 @@
     while (1)
     {
         /* Requesting to go to a specified position. */
-        motor->GoTo(MOTOR_STEPS >> 1);
+        motor->GoTo(STEPS >> 1);
 
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();
 
         /* Requesting to go to a specified position. */
-        motor->GoTo(- (MOTOR_STEPS >> 1));
+        motor->GoTo(- (STEPS >> 1));
 
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();