Simple program featuring a few API functions usage of the X_NUCLEO_IHM03A1 library.
Dependencies: X_NUCLEO_IHM03A1 mbed
Fork of HelloWorld_IHM03A1 by
This application provides a simple example of usage of the X-NUCLEO-IHM03A1 High Power Stepper Motor Control Expansion Board.
It shows how to use one stepper motor connected to the board by:
- moving the rotor a specific number of steps or to a specific position, with a given speed value, direction of rotation;
- monitoring the motor status;
- handling an interrupt triggered by the motor driver;
- getting and setting a motor driver parameter.
For the hardware configuration of the expansion board, please refer to the X_NUCLEO_IHM03A1 home web page.
More API usage is available in IHM03A1_ExampleFor1Motor and IHM03A1_ExampleFor3Motors programs.
Diff: main.cpp
- Revision:
- 5:f5ceb23e3590
- Parent:
- 2:f20ed233a489
diff -r 12c49a2d72e2 -r f5ceb23e3590 main.cpp
--- a/main.cpp Mon May 08 15:54:10 2017 +0000
+++ b/main.cpp Fri Jul 14 12:52:32 2017 +0000
@@ -260,21 +260,6 @@
/* Wait for 2 seconds */
wait_ms(2000);
-//----- Read inexistent register
- printf("--> Try to read an inexistent register.\r\n");
- /* Trying to read an inexistent register */
- /* triggers the flag interrupt and call the my_flag_irq_handler */
- motor->get_raw_parameter(0x1F);
-
-//----- Changing a motor setting
- printf("--> Set the reference voltage assigned to the torque regulation during acceleration to 500mV.\r\n");
- motor->set_raw_parameter(POWERSTEP01_TVAL_ACC, PowerStep01::t_val_ref_voltage_to_reg_val(500));
- //Alternatively, the register value can be written directly as shown below:
- //motor->set_raw_parameter(POWERSTEP01_TVAL_ACC, 63);
-
- //Print the new parameter value to the console
- printf("--> New TVAL_ACC register value is 0x%x .\r\n",motor->get_raw_parameter(POWERSTEP01_TVAL_ACC));
-
/* Infinite Loop. */
printf("--> Infinite Loop...\r\n");
while (true) {

X-NUCLEO-IHM03A1 High Power Stepper Motor Driver