You are on page 1of 26

Motion Control Library for LabVIEW

VI Examples

Software Manual
Revision 1.0

www.ingeniamc.com

Motion Control Library for LabVIEW


Copyright and trademarks
Copyright 2011 INGENIA-CAT, S.L.

Disclaimers and limitations of liability


Except in cases specifically indicated in other agreements and INGENIA-CAT, this product and its documentation are provided as is, with no warranties or conditions of any type, whether express or implied, including, but not limited to the implied warranties or conditions of merchantability, fitness for a particular purpose or noninfringement. INGENIA-CAT rejects all liability for errors or omissions in the information or the product or in other documents mentioned in this document. INGENIA-CAT shall in no event be liable for any incidental, accidental, indirect or consequential damages (including but not limited to those resulting from: (1) dependency of equipment presented, (2) costs or substituting goods, (3) impossibility of use, loss of profit or data, (4) delays or interruptions to business operations (5) and any other theoretical liability that may arise as a consequence of the use or performance of information, irrespective of whether INGENIA-CAT has been notified that said damage may occur. Some countries do not allow the limitation or exclusion of liability for accidental or consequential damages, meaning that the limits or exclusions stated above may not be valid in some cases. This document may contain technical or other types of inaccuracies. This information changes periodically.

Contents
Introduction ........................................................................................................... 3 Opening example VIs .......................................................................................... 5 Running example VIs .......................................................................................... 7 Examples ................................................................................................................. 8 4.1 Basic Examples .............................................................................................. 8 4.1.1 Led value ................................................................................................. 9 4.1.2 Value on DAC ....................................................................................... 11 4.1.3 Torque .................................................................................................... 12 4.1.4 Velocity .................................................................................................. 14 4.1.5 Positioning ............................................................................................ 15 4.1.6 Homing .................................................................................................. 16 4.2 Advanced examples ................................................................................... 17 4.2.1 Digital outputs reacting to ADC value ............................................. 18 4.2.2 Copy switches value to LEDs ............................................................. 20 4.2.3 Control velocity motor by switch ...................................................... 22 4.2.4 Oscillate at different velocities ........................................................... 23

Icons
Icons that the reader may encounter in this manual are shown below, together with their meanings.

Additional information Provides the user with tips, tricks and other useful data.

Warning Provides the user with important information. Ignoring this warning may cause the device not to work properly.

Critical warning Provides the user with critical information. Ignoring this critical warning may cause damage to the device.

Introduction
Ingenia Servo Drives can work with several command reference sources for targeting motor positions/velocities or torques. Typical command sources are 10V analog inputs, Step&Direction digital inputs or network commands (through CAN or RS232 interface). When Ingenia Servo Drives take the references from external input commands they work as slaves. One possible master controller for Ingenia Servo Drives working as slaves is a PC platform running LabVIEW software. LabVIEW (short for Laboratory Virtual Instrumentation Engineering Workbench) is a system design platform and development environment for a visual programming language from National Instruments. LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate physical instruments, such as oscilloscopes and multimeters.

For this kind of working scenarios Ingenia has developed Ingenia Motion Control Library for LabVIEW. Ingenia Library allows performing LabVIEW motor control through a series of VIs that give the user an easy way to configure and use some of the features of the Ingenia Servo Drives. This will significantly improve the development time for an application and will allow the user to rapidly start performing some movements. Ingenia Motion Control Library for LabVIEW uses the CANopen standards CiA301 and CiA402, working as a network command source. It also includes a complete documentation for each VI and some examples to help users with the start-up. In this guide, user will find information about the examples provided with the Ingenia Motion Control Library for LabVIEW. Each example is fully documented and should be used as a quick startup to learn how to use the different VIs included in the library to achieve LabVIEW motor control. User will find examples classified depending on their complexity as Basic Examples and Advances Examples.
Chapter 1: Introduction 3

Additional information The tested NI platforms with Ingenia Motion Control Library for LabVIEW have been NI PCI-8531, NI PXI-8531 and NI 9881.

Chapter 1: Introduction

Opening VI examples
The VI examples presented in this guide can be opened through LabVIEW (after installing the Ingenia Motion Control Library for LabVIEW) by going to Help->Find Examples, searching for the keyword Ingenia and double clicking on them.

Figure 1: LabVIEW find examples

Chapter 2: Opening VI examples

Figure 2: Search for the keyword Ingenia


Additional information Further information on the Ingenia Motion Control Library for LabVIEW can be found in its help file and through LabVIEW context help.

Chapter 2: Opening VI examples

Running VI examples
Any VI example can be run once its opened, via the LabVIEW run button .

Each VI front panel has some common controls and indicators that are described next: Start test: starts the execution of the example. Test finished: indicates when a test has ended. Stop VI: stops the execution of the VI (its only enabled when the test its not being executed).

Figure 3: Example VI front panel

Chapter 3: Running VI examples

Examples
This chapter explains the example VIs that show how the Ingenia Motor Control Library for LabVIEW has to be used to to interact with Ingenia CANopen Servo Drives via LabVIEW. There are two kinds of examples, the basic examples, and the advanced examples.

4.1 Basic Examples


The basic examples can be grouped into: Example Led value Value on DAC Torque Velocity Positioning Homing File LedValue.vi ValueOnDAC.vi Torque.vi Velocity.vi Positioning.vi Homming.vi

Chapter 4: Basic examples

4.1.1 Led value


Description
This VI shows an example of how to set different values to digital outputs of Ingenia CANopen Servo Drives. Some LEDs could be connected to the output pins of the device in order to appreciate this sequence visually.

Front panel
This VI front panel, apart from the common controls and indicators that have been explained at section 3, has some LEDs that show the assigned values of the drive digital outputs.

Figure 4: Led value front panel

Block diagram

Figure 5: Led value block diagram

Results
This example will reproduce two sequences of LEDs as the one shown in Figure 6.

Chapter 4: Basic examples

Figure 6: LED sequence

Additional notes
Before running this VI, the LEDs circuitery should be properly connected to the CANopen controller at the GPO connectors. This VI assumes that LED1 is connected to GPO1, LED2 is connected to GPO2 and so on.

Chapter 4: Basic examples

10

4.1.2 Value on DAC


Description
This VI shows an example of how to set the value of the drive analog output.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 7: Value on DAC front panel

Block diagram

Figure 8: Value on DAC block diagram

Results
After the execution of this example, a voltage of half of output voltage range should be present in the analog output pin.

Chapter 4: Basic examples

11

4.1.3 Torque
Description
This VI shows an example of how to set a motor to produce a constant torque during 10 seconds.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 9: Torque front panel

Block diagram

Figure 10: Torque block diagram

Results
After starting this example, the motor will produce a constant torque during 10 seconds and then, the motor will be disabled.

Additional notes
Before running this VI, the motor should be connected correctly.

Chapter 4: Basic examples

12

Critical warning In this mode the torque is constant, so ensure that the motor have load otherwise velocity will increase suddently.

Chapter 4: Basic examples

13

4.1.4 Velocity
Description
This VI shows an example of how to move a motor during 10 seconds at a constant velocity.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 11: Velocity front panel

Block diagram

Figure 12: Velocity block diagram

Results
After starting this example, the motor will move at a constant velocity during 10 seconds and then, the motor will be disabled.

Additional notes
Before running this VI, the motor should be connected correctly.

Chapter 4: Basic examples

14

4.1.5 Positioning
Description
This VI shows an example of how to perform an incremental position movement in a generic motor after configuring the trajectory generator.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 13: Positioning front panel

Block diagram

Figure 14: Positioning block diagram

Results
After starting this example, the trajectory generator will be configured and the motor will perform a position increment of 20000 counts.

Additional notes
Before running this example, the motor should be connected correctly.

Chapter 4: Basic examples

15

4.1.6 Homing
Description
This VI shows an example where a connexion to a CAN net and device is made, and the homing process is configured and executed.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 15: Homing front panel

Block diagram

Figure 16: Homing block diagram

Results
After starting this example, the homing process will be configured and executed.

Additional notes
Some homing methods, as the one used in this example, require to use a limit switch. Limit switches, can be assigned to any drive general purpose input, in this case, the GPI2 is used as the positive limit switch. Before running this macro, switch circuitery should be properly connected to the controller at the GPI2 connector.
Chapter 4: Basic examples 16

4.2 Advanced examples


The advanced examples are: Example Digital outputs reacting to ADC value Copy switches value to LEDs Control velocity motor by switch Oscillate different velocities File DigitalOutputsReactingToADCValue.vi CopySwitchesValueToLEDs.vi ControlVelocityMotorBySwitch.vi OscillateDifferentVelocities.vi

Chapter 4: Advanced examples

17

4.2.1 Digital outputs reacting to ADC value


Description
This VI shows an example of how to activate digital outputs (with some leds connected to them) depending on the value of the analog input 1 (AN_IN1).

Front panel
This VI front panel, apart from the common controls and indicators that have been explained at section 3, displays the analog input 1 readed value and has some LEDs that show the assigned values of the drive digital outputs.

Figure 17: Digital outputs reacting to ADC value front panel

Block diagram

Figure 18: Digital outputs reacting to ADC value block diagram

Results
The LEDs will blink if the value of the analog input 1 is higher than half of input voltage range. Figure 19, shows the result with two different potentiometer positions.

Chapter 4: Advanced examples

18

Figure 19: Activate sequence

Additional notes
Before running this VI, the LEDs circuitery should be properly connected to the controller at the GPO connector. This example assumes that LED1 is connected to GPO1, LED2 is connected to GPO2 and so on. The analog signal coming from the potentiometer must be connected to AN_IN1 pin.

Chapter 4: Advanced examples

19

4.2.2 Copy switches value to LEDs


Description
This VI shows an example of how to activate digital outputs (with some LEDs connected to them) depending on the value of the digital inputs (with switches connected to them).

Front panel
This VI front panel, apart from the common controls and indicators that have been explained at section 3, has some LEDs that show the assigned values of the drive digital outputs (in this case, the digital inputs readed values).

Figure 20: Copy switches value to LEDs front panel

Block diagram

Figure 21: Copy switches value to LEDs block diagram

Results
Once this example is executed the digital output pins will replicate the content of the digital input pins as shown in See Figure 22.

Chapter 4: Advanced examples

20

Figure 22: Switch value on Leds.

Additional notes
Before running this VI, the switches and LEDs circuitery should be properly connected to the controller digital inputs and outputs. This example assumes that LED1 is connected to GPO1, LED2 is connected to GPO2 and so on.

Chapter 4: Advanced examples

21

4.2.3 Control velocity motor by switch


Description
This VI shows an example of how to control the velocity of a motor using digital inputs (with switches connected to them).

Front panel
This VI front panel, apart from the common controls and indicators that have been explained at section 3, has some LEDs that show the readed values of the drive digital inputs.

Figure 23: Control velocity motor by switch front panel

Block diagram

Figure 24: Control velocity motor by switch block diagram

Results
After starting the execution of this example, the motor velocity will change depending on the position of the switches. Each one of GPI1, GPI2 and GPI3 adds 15000 to the target veloctiy, GPI4 its used to indicate the direction of the movement. This velocity will be maintained during 10 seconds and then, the motor will be disabled.

Additional notes
Before running this example, the switches circuitery as well as the motor should be properly connected to the controller.

Chapter 4: Advanced examples

22

4.2.4 Oscillate at different velocities


Description
This VI shows an example where a connexion to a CAN net and device is made, the homing process is configured and executed and a series of movements at different velocities are done. When the test has ended, a led of the front panel is activated.

Front panel
This VI front panel only has the common controls and indicators that have been explained at section 3.

Figure 25: Oscillate at different velocities front panel

Block diagram

Figure 26: Oscillate at different velocities block diagram

Results
After starting the execution of this example, the homing process will be done and the motor will perform a serie of oscillating movements at different velocities.

Additional notes
Before running this example, the motor should be properly connected to the controller. Some homing methods, as the one used in this example, require to use a limit switch.

Chapter 4: Advanced examples

23

Limit switches, can be assigned to any drive general purpose input, in this case, the GPI1 is used as the positive limit switch.

Chapter 4: Advanced examples

24