Motion control example for 3 motors.
Dependencies: X_NUCLEO_IHM03A1 mbed
Fork of IHM03A1_ExampleFor3Motors by
This application provides an example of usage of three X-NUCLEO-IHM03A1 High Power Stepper Motor Control Expansion Boards.
It shows how to use three stepper motors connected to the three expansion boards by:
- moving each motor independently;
- moving several motors synchronously;
- monitoring the status of the three motors;
- handling interrupts triggered by all motor drivers;
- getting and setting a motor driver parameter;
- etc.
For the hardware configuration of the expansion boards, please refer to the X_NUCLEO_IHM03A1 home web page.
Revision 2:c29a38e427f6, committed 2016-04-13
- Comitter:
- nucleosam
- Date:
- Wed Apr 13 09:08:26 2016 +0000
- Parent:
- 1:1d98c151c8eb
- Child:
- 3:dca1758ee34e
- Commit message:
- Comments updated with the correct name of functions. Added printf in the "myFlagIRQHandler" function.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 07 16:19:01 2016 +0000
+++ b/main.cpp Wed Apr 13 09:08:26 2016 +0000
@@ -97,7 +97,7 @@
POWERSTEP01_CONFIG_UVLOVAL_LOW, // UVLO Threshold via powerstep01_ConfigUvLoVal_t
POWERSTEP01_CONFIG_VCCVAL_15V, // VCC Val, enum powerstep01_ConfigVccVal_t
POWERSTEP01_CONFIG_TSW_048us, // Switching period, enum powerstep01_ConfigTsw_t
- POWERSTEP01_CONFIG_PRED_DISABLE, // Predictive current enabling , enum powerstep01_ConfigPredEn_t
+ POWERSTEP01_CONFIG_PRED_DISABLE // Predictive current enabling , enum powerstep01_ConfigPredEn_t
};
/* Motor Control Component. */
@@ -112,7 +112,7 @@
* @param None
* @retval None
* @note If needed, implement it, and then attach and enable it:
- * + motor->AttachFlagIRQ(&FlagIRQHandler);
+ * + motor->AttachFlagIRQ(&myFlagIRQHandler);
* + motor->EnableFlagIRQ();
* To disable it:
* + motor->DisbleFlagIRQ();
@@ -224,7 +224,8 @@
if ((statusRegister & POWERSTEP01_STATUS_UVLO_ADC)==0)
{
//ADC undervoltage lock-out
- printf(" ADC undervoltage lock-out.\r\n");
+ printf(" ADC undervoltage lock-out:\r\n");
+ printf(" Expected with default IHM03A1 HW configuration.\r\n");
}
/* Check thermal STATUS flags: if set, the thermal status is not normal */
if ((statusRegister & POWERSTEP01_STATUS_TH_STATUS)!=0)
@@ -271,7 +272,7 @@
* @param None
* @retval None
* @note If needed, implement it, and then attach and enable it:
- * + motor->AttachBusyIRQ(&FlagIRQHandler);
+ * + motor->AttachBusyIRQ(&myBusyIRQHandler);
* + motor->EnableBusyIRQ();
* To disable it:
* + motor->DisbleBusyIRQ();
@@ -289,6 +290,8 @@
* @brief This is an example of error handler.
* @param[in] error Number of the error
* @retval None
+ * @note If needed, implement it, and then attach it:
+ * + motor->AttachErrorHandler(&myErrorHandler);
*/
void myErrorHandler(uint16_t error)
{
