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.
Diff: main.cpp
- Revision:
- 2:c29a38e427f6
- Parent:
- 1:1d98c151c8eb
- Child:
- 5:05b73855a2e1
--- 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) {