Third Program – Making the Motor Spin


Making the Motor Spin Step by Step

This program will work with other motors if selected properly. This program will check the motor for faults, enable the motor, create a motion profile, and run the motor in a Smooth Jog.

View a run-through of this program




1. Select the Configure Axis block and the Position Hold block from the Motion menu and drag them into the Initialization portion of the Main Program block. It is best to choose the Initialization section for these blocks since they will only need to be executed one time on start up. All blocks within the Main Loop are called many times a second



2. These five circles show which options we will be setting for this program. We know from the First and Second application how to set the Slot to the Local InoDrive Module. Now click the Axis option on the Configure Axis block.


3. The Axis option will launch the Axes Dialog box from which an axes profile can be established. You must select the Create New button unless you have already configured your Axes profile.



4. The Axis you are now creating must be named. You must also either choose a motor from our library or input your own information. For the Demo Case used to create this manual, this is an Electrocraft RPX40-250V24-100-S, so simply selecting this and clicking create is sufficient. If you cannot find the applicable motor navigate to the Axes Configurator either through this button on the bottom left or from your Account Dashboard.



5. Next choose “Sectors” for units of motor movement measurement. We will choose 8 sectors per revolution of the motor.
The motor’s position will be Off Regen, in which case the motor phase circuits are shunted to the drivers and the rotor is free to turn with only the drive train’s mechanical inertia and rotor’s magnetic induced EMF providing any holding force.


6. Now we are going to work on the Main Loop portion of the program and introduce some new blocks:
First is the blue Call Function block from the Program category. Click on the red “Function” text and view the dialog box that opens. Create a new function called “CheckMotorFaults”, select it and close the dialog box. Now you see the text is replaced with your function. Later we will create a corresponding function which will be called from this call function block.
Second is the light purple Oneshot block from the Logic category.


7. We will duplicate this oneshot block and pair both with a variable. Toggle the “Once when high” to low for the second, so that we respond to both high and low values of the variable. Now lets add the Purple Motor Command block as well as the green Variable block from the Math category.


8. Click on the red “Slot” text on both of these Motor Cmd blocks and select Local, since we will only be addressing our target InoDrive. Then from the drop down select the “Run” command from the drop down for the block within the Oneshot block that is set to “High” so that a command is given to run when a positive signal is given and stop when it is changed to 0. Configuring the profile is in the next step


9. Configuring your motor command involves assigning the movement a motion profile. You may choose to have many profiles or just one. For our tutorial we only need one which we will call “SmoothJog”. As you see in this image, after the profile dialog box comes up you will click create new, and then check the box of any of the attributes you’d like to adjust. Here the speed has been reduced from 100% of rated speed to 50%. Then click create and select your new profile.


10. Drag and drop the Function block into the workspace, notice that since it is referenced from within the Main Loop with the Call Function block, it does not need to be attached to the Main Program block. Any blocks placed inside of the Function block will be executed when called from the Main Loop.


Please Note: You may choose to put functions in workspaces other than your default “Main Workspace”. Right click on Workspaces and open a new Workspace if you prefer to organize your program more. This may be just for a singular function, or for all of your functions. We will not utilize this within this small Project but it is helpful for sprawling programs’ organizational needs.


11. Check Motor Faults is a descriptive title for an important function. Blocks utilized are from the Math, Motion, and Logic categories.
First an If Else Then conditional block will be clicked into the Function block, select the Settings Icon to drag the mini Elseif onto the mini If. The Second block which will be the Get Motor Status Flag which should reference the Local slot, and get a faulted flag which returns true if there is a general module fault. Third place the Set Motor Operation block. This block will always be used in your motion programs as enable is required to be executed by your program logic before the motor connected to the selected Slot will be allowed to run. We will select Local motor drive in a Clear Faults operation.

The next portion of logic will be in the Else If position, Lets get the NOT block and place another Get Motor Status Flag block here as well.
The last block going into the Else If will be the Set Motor Operation block set to enable the local drive.


12. Observe all of the configured options.
You’ll be choosing the local Slot as the motor to be targeted for all blocks, as we are only working with one motor. Then choose corresponding options for the blocks as shown in red circles.
Now the function currently will operate as such: If the local slot has a faulted flag, it sets the local motor to clear the faults if possible. If the local motor is not enabled, it enables the motor. This function handles what to do if motor has faults, and it enables the motor, but doesn’t start the motor.


13. Let’s have this function report back to the main loop if it is ok to spin the motor, a clear yes or no to if our motor can operate.
Use the green Set Variable block to establish a variable that we can use later to set the motor’s status. Within this block lets have the block AND OR which works so that if both of the values within are True, then the Boolean type variable will be True. If either or these internal values are false, the variable will be false.
To now establish that variable, click the red word “variable”. This will launch the Variable Dialog Box. Click create new as this will be your first variable.


14. After clicking Create New button on the top left, this smaller dialog box gives us lots of options for the new variable.
Lets name it MotorOKToRun. Type – we will choose Boolean, and the initial value given will be false. Then select API accessibility level. Finally click the Create button.
You can double click the now listed variable in the Variables dialog box, or click the check box and then select button.

Since the API is useful to gather information, often Read/Write access is a good default to have. Perhaps there are specific circumstances which make only Read access or No access more appropriate for your custom application, please operate in your own best interest here.


15. Observe the full CheckMotorFaults function. This function checks the motor faults, enables the drive, and communicates via variable to the main loop if the program can continue.


16. The green variable block we placed earlier can now be selected, and “MotorOKToRun” will now be a listed variable that you may select.
Then configure both of the Motor Command blocks to both target the Local Slot. The first Motor Command block will send one Run comand to the motor when the motor when the variable is high, while the second block with the “Once when low” portion of the logic will Stop the motor.
To review, the Main Loop will Call the Function “CheckMotorFaults”, and then if “MotorOKToRun” is True, it will run the motor. If “MotorOKToRun” is False, then it will stop the motor and nothing will happen as there is a fault.


17. Observe the full program. This will make the motor spin when the application is loaded onto the InoDrive


18. Send the program to the InoDrive by clicking the Build and Upload button. If you would like to save this program for your reflection or to build off of, now is the time to do so.


19. You may now either exit the Programmer or continue on to build your own application. Thank you!