Sei sulla pagina 1di 14

APPLICATION NOTE 042.IM23x-MA.

105
12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Problem:

In some applications, the host sends a speed reference to the drive, and the
motor moves with the reference speed, in a speed control loop. Reaching a
position limit switch stops the motor, until the host sends a speed reference in
the opposite direction. The drive ENABLE input needs to be used to activate /
deactivate the motion. The motion is activated only in the presence of the drive
ENABLE signal. Also, you can use the limit switches and internal reference to
position the motor in the middle of an interval defined by the left margin and the
right margin.

Solution:

Drive

S/W environment :
S/W application

Description:

Technosoft Intelligent Motor IM23x-MA


Technosoft EasyMotion Studio

P091.042.IM23x-MA.APN-MOT1.105.x.msq
P091.042.IM23x-MA.APN-MOT2.105.x.msq
The application implements a speed control with external motion reference read
on-line through RS-232. The motor movement is limited between two limit
switches. There are two Limit Switch inputs on IM23x-MA (LSP and LSN), which
are used for this purpose. The motor will be stopped as soon as it reaches a
limit switch and you can start it again only in the opposite direction. The
application uses also the ENABLE input in order to activate/deactivate the
motion.
A second part implements a position control with internal generated reference.
The motor movement is limited between two margins (defined by the limit
switches) and then the motor is centered in the middle of the moving interval.
:

Project set-up:
1. Install EasyMotion Studio on your PC. Please find the setup kit on our web site.
2. From the attached archive P091.042.IM23x-MA.APN-DOC.105.x.zip extract the files
P091.042.IM23x-MA.APN-MOT1.105.x.msq and P091.042.IM23x-MA.APN-MOT2.105.x.msq
into the ..\ESM\Archives folder.
3. Perform all the hardware connections as it is explained in P091.042.IM23x-MA.APNDOC.101.x.pdf document (Getting started using IM23x-MA).
4. Start EasyMotion Studio, then create a new project using the template IM23x IM23x-MA
(see the section 1. Create a new project of P091.042.IM23x-MA.APN-DOC.101.x.pdf
document).
5. Setup the intelligent motor for speed and position control (see the section 3.B. Drive setup of
P091.042.IM23x-MA.APN-DOC.101.x.pdf document).

Technosoft 2005

APN.105 - 1

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

6. Import the motion file P091.042.IM23x-MA.APN-MOT1.105.x.msq (for the first part of the
application) or P091.042.IM23x-MA.APN-MOT2.105.x.msq (for the second part) in your
application by selecting Application | Motion | Import Sequence menu. You will be
prompted to select from ..\ESM\Archives folder a .msq file. Select the file P091.042.IM23xMA.APN-MOT1.105.x.msq or P091.042.IM23x-MA.APN- MOT2.105.x.msq.
NOTE: You must import the two .msq files in two separate applications of the project, or in
two separate projects.
7. In the window left side please select Interrupts and check User defined for int 6 LSP
programmed transition detection and int 7 LSN programmed transition detection.
8. Select from window left side int-6 LSP programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091.042.IM23x-MA.APN-INT6.1.105.x.msq by
pressing the Import icon on the right
. You will be prompted to select from
..\ESM\Arhives folder a .msq file. Select the file P091.042.IM23x-MA.APN-INT6.1.105.x.msq
9. Select from window left side int-7 LSN programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091.042.IM23x-MA.APN-INT7.1.105.x.msq by
pressing the Import icon on the right
. You will be prompted to select from
..\ESM\Arhives folder a .msq file. Select the file P091.042.IM23x-MA.APN-INT7.1.105.x.msq
10. In the second application in the window left side select Interrupts and check User defined for
int 6 LSP programmed transition detection and int 7 LSN programmed transition
detection.
11. Select from window left side int-6 LSP programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091.042.IM23x-MA.APN-INT6.2.105.x.msq by
pressing the Import icon on the right
. You will be prompted to select from
..\ESM\Arhives folder a .msq file. Select the file P091.042.IM23x-MA.APN-INT6.2.105.x.msq
12. Select from window left side int-7 LSN programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091.042.IM23x-MA.APN-INT7.2.105.x.msq by
pressing the Import icon on the right
. You will be prompted to select from
..\ESM\Arhives folder a .msq file. Select the file P091.042.IM23x-MA.APN-INT7.2.105.x.msq

Technosoft 2005

APN.105 - 2

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Application running (on-line reference):


In order to run the first part of the application, follow the next steps:
1. Power up the intelligent motor IM23x-MA.
2. Select your first application.
3. Download the setup, using the menu command Application | Setup | Download to
Drive/Motor or by pressing the correspondent button from EasyMotion Studio toolbar
4. Download and execute the programmed motion sequences, by pressing the button
from EasyMotion Studio toolbar.
and set the reference on-line as you can see
5. Click on the Command Interpreter icon
in figure 3 (e.g. type the TML command EREF(H) = 30).
6. Press LSP button IM23x-MA to generate an interrupt for Limit Switch Positive. The motor
will be stopped by the ISR associated to the Limit Switch Positive interrupt. Any positive
speed reference imposed by EREF(H) can no longer restart the motor.
7. Inside the Command Interpreter window set on-line a negative reference (e.g. type the
TML command EREF(H) = - 100).
8. The motor will start running with negative speed (in negative direction).
9. Press LSN button on IM23x-MA to generate an interrupt for Limit Switch Negative. The
motor will be stopped by the interrupts associated to the Limit Switch Negative interrupt.
Any negative speed reference imposed by EREF(H) can no longer restart the motor.
10. Inside the Command Interpreter window set on-line a positive reference (e.g. type the TML
command EREF(H) = 50).
11. Press and keep down the ENABLE button in order to disable the IM23x-MA intelligent
motor.
12. Release the ENABLE button in order to enable the IM23x-MA intelligent motor.
For more details about other configuration for your application, using of data analysis tools and
saving your project/application please refer to P091.042.IM23x-MA.APN-DOC.101.x.pdf document
(Getting started using IM23x-MA).

Technosoft 2005

APN.105 - 3

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Digital I/O connection

IM23x - MA v1.1

J3
24V_IO

LOAD

READY

Optical
isolation

OUT#25
3

50 mA max
LOAD

Optical
isolation

GPO

OUT#16

50 mA max

5...24V
+

MotionChipTM

GND IO
GND IO
ENABL
LSP
LSN
GPI1
GPI2

2
6
2.5 K

7
Optical
isolation

GND IO GND

ENABLE
LSP

+3.3V

LSN
Figure 1. How to generate Limit Switch and Enable events on IM23x-MA

Technosoft 2005

APN.105 - 4

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Implementation:
In the flow-chart below is shown the principle structure of the application:
Start the Motion
sequences

Setup TML interrupts for LSN and LSP


(Lim it Switch- and Lim it Switch+)
Enable LSN and LSP for falling edge

User variable declaration:


flag_LSN, flag_LSP,
LSN_state, LSP_state etc.

flag_LSP = 0
flag_LSN = 0
LSN_state = 0
LSP_state = 0
CACC = 100

NO

ENABLE = 1 ?
YES

Turn ON the m otor in External


Speed control m ode with
on-line speed reference sent
through RS-232

Check ENABLE and speed reference /


restart the m otion only for negative speed
YES

YES

flag_LSN = 0 ?

flag_LSP = 0 ?

NO

NO

NO

ENABLE = 1 ?
YES

YES

ENABLE = 1 ?

NO

Check ENABLE and speed reference /


restart the m otion only for positive speed

NO

Speed Reference < 0 ?

YES

flag_LSP = 0

NO

ENABLE = 1 ?

YES
NO

Speed Reference > 0 ?

YES

flag_LSN = 0

Start m otion with


pozitive reference

Technosoft 2005

APN.105 - 5

Start m otion with


negative reference

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

Interrupt Service Routine for Lim it Sw itch+

YES

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Speed Reference < 0 ?

Interrupt Service Routine for Lim it Sw itch-

NO

YES

Speed Reference > 0 ?

NO

W ait for Relative Tim e to avoid


the m ultiple transitions (5m s)

W ait for Relative Tim e to avoid


the m ultiple transitions (5m s)

LSP_state = IN#2/LSP

LSN_state = IN#24/LSN

YES

LSP_state = 0 ?

YES

NO

LSN_state = 0 ?

flag_LSP = 1

flag_LSN = 1

Stop the m otor by applying 0


speed reference with
acceleration profile (Stop3)

Stop the m otor by applying 0


speed reference with
acceleration profile (Stop3)

Enable LSP for falling edge

Enable LSN for falling edge

RETI

RETI

NO

Figure 2. Application structure

The application purpose is to limit the motor movement between two limits by using two digital
inputs (Limit Switch inputs LSP and LSN) Also the application take into account the ENABLE input
which activate/deactivate the motion.

This application performs the following main tasks:


1. Configure the TML interrupts for the Limit Switch inputs LSP and LSN in order to stop the
motor on the falling edge of these inputs.
2. Run the motor in External Speed control mode with external motion reference read on-line
through RS-232. To send the reference on-line you can click from EasyMotion the
Command Interpreter icon
and inside the Command Interpreter window set the
reference as you can see in figure 3 (the values are in bits).
3. Stop the motion when a transition from high to low of the limit switch occurs.
4. Restart the motion only for the opposite sense of movement. For example if the motor has
been stopped by the Limit Switch Positive falling edge then the motor starts again only for
negative speed reference value.
5. Check the ENABLE input and restart the motion every time this signal becomes active.

Technosoft 2005

APN.105 - 6

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Figure 3. How to use Command Interpreter window to send external on-line reference

The application structure above is implemented in the Main section of the TML program. Select
the M Motion item in your application tree to view this section.

Technosoft 2005

APN.105 - 7

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

4, 6 5

4
5
6
7
8

Figure 4. Motion sequences window

The figure 4 shows you which buttons were used in order to generate the motion sequences. To
get details about how the motion sequences were configured in the window above, double-click in
the areas marked with 1 to 8.
To see how the Interrupts for Limit Switch Positive (LSP) and Limit Switch Negative (LSN) are
implemented please follow the next steps:
1. In the project window left side, in your application select Interrupts, to open this window:

Technosoft 2005

APN.105 - 8

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Figure 5. How to edit the Interrupts for Int6 Limit Switch Positive and Int7 Limit Switch Negative

2. Check User Defined and then in the window left side choose int 6 LSP programmed
transition detected

Figure 6. TML Interrupt for Int6 Limit Switch Positive

3. Check User Defined and then in the window left side choose int 7 LSN programmed
transition detected

Technosoft 2005

APN.105 - 9

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

Figure 7. TML Interrupt for Int7 Limit Switch Negative

Technosoft 2005

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

APN.105 - 10

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Application running (internal reference):


In order to run the second part of the application, follow the next steps:

1. Power up the intelligent motor IM23x-MA.


2. Select your second application.
3. Download the setup, using the menu command Application | Setup | Download to
Drive/Motor or by pressing the correspondent button from EasyMotion Studio toolbar
4. Download and execute the programmed motion sequences, by pressing the button
from EasyMotion Studio toolbar.
5. Press LSP button on IM23x-MA to signal the left margin of the interval, and to reverse the
movement.
6. Press LSN button on IM23x-MA to signal the right margin of the interval, and to start the
positioning movement.
For more details about other configuration for your application, using of data analysis tools and
saving your project/application please refer to P091.042.IM23x-MA.APN-DOC.101.x.pdf document
(Getting started using IM23x-MA).

Implementation:
In the flow-chart below is shown the principle structure of the application:
Start the Motion
sequences

Setup the TML Interrupt


Settings for LSP and LSN

Enable LSP

Start m otion with


pozitive reference

Technosoft 2005

APN.105 - 11

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

Interrupt Service Routine for Lim it Sw itch+

Interrupt Service Routine for Lim it Sw itch-

Set actual position to zero

Com pute the m iddle point of interval

Reverse the m otion

Start the positioning


m ovem ent

Enable LSN

Reset the m otor position to


zero and hold position

RETI

RETI

Figure 8. Application structure

The application purpose is to sense the two margins of an interval (left margin represented by LSP
and right margins represented by LSN) and then to center the motor in the middle of the interval
and reset its zero position to the center of the interval, thus preparing the motor for further
movement. Also, its purpose is to show how you can do the limit switch position capture without
using a capture interrupt.

This application performs the following main tasks:


1. Configure the TML interrupts for the Limit Switch inputs LSP and LSN in order to sense
the margins.
2. Run the motor in Internal Speed control mode
3. Compute the center point based on the two margins.
6. Position the motor to centre of the interval, and reset its position.

Technosoft 2005

APN.105 - 12

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

The left margin has been reached. The position of the


motor is set to zero, in order to start measuring the
interval.
Figure 9. The LSP subroutine

Every time the LSP or LSN is activated the actual


position of the motor (APOS) is saved in the variable
CAPPOS, and can be used for calculation and/or
reference commands.
Figure 10. The LSN subroutine

Technosoft 2005

APN.105 - 13

APPLICATION NOTE 042.IM23x-MA.105


12/23/05

This page is empty

Technosoft 2005

IM23x-MA

Using the Limit Switches and Enable inputs with on-line or internal reference

APN.105 - 14

Potrebbero piacerti anche