Example code for communicating to MDrive family of products using LabVIEW. It does not support some more advanced functions such as Party Mode or Checksum Mode, but it should give you a head start into your application.
Profile Position Mode – demonstrates the different move types supported for position control executed via Service Data Objects (SDOs).
SEM CANopen products support relative and absolute moves to position. Using either relative or absolute moves, the user can also select (by the control word data) if the target position should be reached before another target position is allowed (finish first) or if the SEM product should execute a newly received target position even if still in motion (immediate).
The following application will move the motor to a variety of positions based upon a binary input to I/O 1-4. One of the things this application shows is one of the new Microstep Resolution settings that give the ability to set motion to occur in 0.001˚ increments. The program does a calculation after each move to show motor position in degrees.
To run program, enter EX 1 into the terminal. You can index the motor by moving the switches to the center (OFF) position to represent a 4-bit binary number where switch 4 is the most significant bit.
The terminal will display the decimal equivalent, as well as the axis position in degrees.
This program illustrates the following functions:
The ability to input BCD to the I/O group and control processes based on the value of the inputs.
The ability to manipulate numeric position data to display it in familiar units of measure.
The following program addresses the lower output bank as a group using the OL variable. A subroutine sets the Output group from a Register value, which is incremented each time the subroutine runs and then moves the motor based upon a multiple of the output group state. When the register reaches a count of 15, a subroutine will run to reset it to zero, restarting the process.
The 4-bit binary number will display on the LED bank as the device counts up.
Enter “EX 1” into the terminal to run the program. The program will automatically begin to count up in binary, while the motor will move a distance that is a multiple of that count.
This illustrates the following functions:
The ability to output BCD via the I/O group.
The ability to use and manipulate numeric data and perform operations based upon that data.