This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Regarding C program in KEIL (MDK-5). how can I write c code to initialize the stepper motor?

I am trying to connect a motor with MCU (stm32) and I need to write the code (C program in C). As of my understanding, I need to initialize the motor ID (if I have 2 or more motors, each motor should have the unique id so that when i write program I can use controls to the specific motor)..

I have referred few examples to initialize the motors in c programming... one of the example is below...


        const uint16_t Motor_id1 = 0x600 + 0x01;
        const uint16_t motor_id2 = 0x600 + 0x02;

here the two above lines for corresponding motor, which means 2 motor has connected

motor1 can be identified by this value 0x600 + 0x01
motor2 can be identified by this value 0x600 + 0x02

I particularly want to know how this values are assigned for each motors... suppose if i want to connect 3rd and 4th motors can I write


        const uint16_t Motor_id1 = 0x600 + 0x03; //for 3rd motors
        const uint16_t motor_id2 = 0x600 + 0x04; //for 4th motors

is it possible ??? will it work ??

I beleive, if some one can give some basic idea to initialize the motor and how the values are written in c program will be better for me to understand. Please give your suggestion and comments.. those who have experienced in controlling motors using c program through mcu board, they must know these concept. Please help...