Sie sind auf Seite 1von 14

APPLICATION NOTE 042.IM23x-MA.

106
12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Problem:

In some applications, a speed reference is imposed to the drive using an


external analogue signal and the motor moves with the reference speed, in a
speed control loop. Reaching a position limit switch stops the motor, until the
speed reference is changed in the opposite direction. The same must operate at
system start, if the motor is already in a limit switch position. Also, 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.

Solution:

Drive

Description:

Technosoft Intelligent Motor IM23x-MA

S/W environment :

Technosoft EasyMotion Studio

S/W application

P091.042.IM23x-MA.APN-MOT.106.x.msq

The application implements a speed control with external motion reference read
from an analog input (0V to +5V). For this purpose, a potentiometer (REF) can
be used, connected to the IM23x-MA drive as you can see in figure 1. 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.
This application also uses the ENABLE input line in order to activate/deactivate
the motion.
The limit switches are active on level that means only the movements in the
opposite directions are allowed while the limit switch is active. As soon as the
limit switch is off (becomes inactive) the movement is allowed on both
directions.

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.106.x.zip extract
P091.042.IM23x-MA.APN-MOT.106.x.msq into the ..\ESM\Archives folder.

the

file

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 (see the section 3.B. Drive setup of P091.042.IM23xMA.APN-DOC.101.x.pdf document).

Technosoft 2005

APN.106 - 1

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

6. For this application, the drive must be configured in speed control mode with analogue external
reference read from the potentiometer REF (see figure 1). In the External Reference Setup,
at Analogue, set the Maximum Speed equal with 900 rpm and Minimum Speed equal with
900 rpm (see figure 3) and connect the potentiometer to the IM23x-MA drive as you can see in
figure 1.

IM23x - MA v1.1

Analog Inputs
Connection
J2

TM

GND

REF

10K

0..5V
470 R

5V/DEF

MotionChip

30K

+5V
Internally Generated
DEFAULT

9
470 R

+3.3V

Figure 1. How to connect the potentiometer REF to the IM23x-MA drive

Technosoft 2005

APN.106 - 2

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Figure 2. Drive window settings for external speed reference read from an analogue input

Technosoft 2005

APN.106 - 3

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Figure 3. External reference setup

7. Import the motion file P091.042.IM23x-MA.APN-MOT.106.x.msq 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.IM23x-MA.APNMOT.106.x.msq.
8. In the window left side please select Functions. Add the following functions:

CheckAndWaitEnable
WaitForLSNtoBecomeInactive
WaitForLSPtoBecomeInactive

The TML functions defined are listed in the Project window left side, in the current application,
as a sub-tree of the Functions section.

Technosoft 2005

APN.106 - 4

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

9. Each defined function has a corresponding motion sequence:

P091. 042.IM23x-MA.APN-FCT1.106.x.msq CheckAndWaitEnable


P091. 042.IM23x-MA.APN-FCT2.106.x.msq WaitForLSNtoBecomeInactive
P091. 042.IM23x-MA.APN-FCT3.106.x.msq WaitForLSPtoBecomeInactive

on the
Import the motion sequences by selecting a function and press the Import button
right toolbar. You will be prompted to select from ..\ESM\Arhives folder a .msq file. Select the
appropriate motion sequence file for each function.
10. In the Project 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 int6 - LSP programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091.042.IM23x-MA.APN-INT6.106.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 P091042.IM23x-MA.APN-INT6.106.x.msq
12. Select from window left side int7 - LSP programmed transition detection from Interrupts
branch. Import the interrupt sequence file P091. 042.IM23x-MA.APN-INT7.106.x.msq by
. You will be prompted to select from
pressing the Import icon on the right
..\ESM\Arhives folder a .msq file. Select the file P091. 042.IM23x-MA.APN-INT7.106.x.msq

Technosoft 2005

APN.106 - 5

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Application running:
In order to run your application, follow the next steps:
1. Power up the intelligent motor IM23x-MA.
2. Download the setup, using the menu command Application | Setup | Download to
Drive/Motor or by pressing the correspondent button from EasyMotion Studio toolbar
3. Download and execute the programmed motion sequences, by pressing the button from
4.
5.

6.

7.

8.
9.

10.
11.

EasyMotion Studio toolbar


Rotate the REF potentiometer in order to change the speed reference. Impose a positive
speed reference.
Then, for the positive speed reference, press the LSP button to generate an interrupt for
Limit Switch Positive (for positive speed reference the pressing of the LSN button has no
effect). The motor will be stopped by the interrupt associated to the Limit Switch Positive
interrupt. Any positive speed reference imposed by the REF potentiometer can no longer
restart the motor.
Rotate the REF potentiometer in order to impose a negative speed reference. As soon as
the speed reference becomes negative the motor will start running with negative speed (in
negative direction). If the LSP button is still pressed down the motor can run only with
negative speed. As soon as the LSP button is released the motor can run in both directions
depending on the reference imposed by the REF potentiometer.
While the motor is running with negative speed, press the LSN button to generate an
interrupt for Limit Switch Negative. The motor will be stopped by the ISR associated to the
Limit Switch Negative interrupt. Any negative speed reference imposed by the REF
potentiometer can no longer restart the motor.
Rotate the REF potentiometer in order to impose a positive speed reference. As soon as
the speed reference becomes positive the motor will start running with positive speed.
If the LSN button is still pressed down the motor can run only with positive speed. As soon
as the LSN button is released the motor can run in both directions depending on the
reference imposed by the REF potentiometer.
While the motor is running, press and keep down the ENABLE button in order to disable the
intelligent motor IM23x-MA.
Release the ENABLE button in order to enable the intelligent motor IM23x-MA.

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.106 - 6

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue 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 4. How to generate Limit Switch and Enable events on IM23x-MA

Technosoft 2005

APN.106 - 7

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Implementation:
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 status of the
ENABLE input in order to activate/deactivate the motion. In the flow-chart below is shown the
principle structure of the application
Start the Motion
sequences

Setup TML interrupts for LSN and LSP


(Limit Switch- and Limit Switch+)
Enable LSN and LSP on rising edge

User variable declaration:


flag_LSN, flag_LSP,
LSP_state, LSN_state etc.

CheckAndWaitEnable

Disable PWM (AXISOFF)


YES

flag_LSP = 0
flag_LSN = 0
LSP_state = 0
LSN_state = 0

ENABLE =1 ?
NO

Enable PWM (AXISON)


CALL
"CheckAndWaitEnable"

RET

CALL
"WaitForLSNtoBecomeInactive"

CALL
"WaitForLSPtoBecomeInactive"

Turn ON the motor in External


Speed control mode with
analogue speed reference

Check ENABLE and speed reference /


restart the motion only for negative speed
YES

YES

flag_LSN = 0 ?

NO

flag_LSP = 0 ?

NO

CALL
"CheckAndWaitEnable"

CALL
"CheckAndWaitEnable"

NO

Check ENABLE and speed reference /


restart the motion only for positive speed

Speed Reference < 0 ?

YES

flag_LSP = 0

CALL
"CheckAndWaitEnable"

NO

Speed Reference > 0 ?

Start motion with


negative reference

YES

flag_LSN = 0

Start motion with


pozitive reference

Technosoft 2005

APN.106 - 8

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

InterruptService
Service
Routine
Lim
it Sw itch+
Interrupt
Routine
forfor
Limit
Switch+

YES

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

InterruptService
Service
Routine
Lim
it Sw itchInterrupt
Routine
forfor
Limit
Switch-

NO

Speed Reference
Reference << 00 ??

YES

Speed Reference
Reference >> 00 ??

W ait for Relative Tim


e to
Wait
Time
to avoid
avoid
ultiple transitions
s)
the m
multiple
transitions (5m
(5ms)

W
ait for Relative
e to
Wait
Relative Tim
Time
to avoid
avoid
ultiple transitions
s)
the m
multiple
transitions (5m
(5ms)

LSP_state
= IN#2/LSP
LSP_state
= LSP

YES

LSP_state =
= 01 ??

NO

LSN_state
= LSN
LSN_state
= IN#24/LSN

YES

NO
NO

LSN_state
LSN_state == 01 ??

flag_LSP =
flag_LSP
= 11

flag_LSN =
flag_LSN
= 11

otor by
Stop the m
motor
by applying
applying 00
speed reference
reference with
with
acceleration profile
acceleration
profile (Stop3)
(Stop3)

otor by
Stop the m
motor
by applying
applying 00
speed reference
reference with
with
acceleration profile
acceleration
profile (Stop3)
(Stop3)

W ait for the stop


Wait
m otion com
plete
motion
complete

W ait for the stop


Wait
m otion com
plete
motion
complete

W ait for 5ms


5m s
Wait

W ait for 5ms


5m s
Wait

CALL
"W
aitForLSPtoBecom eInactive"
"WaitForLSPtoBecomeInactive"

CALL
"W aitForLSNtoBecom eInactive"
"WaitForLSNtoBecomeInactive"

edge
Enable LSP
LSP for
for falling
rising edge

edge
Enable LSN
LSN for
for falling
rising edge

RETI

RETI

W aitForLSPtoBecom eInactive
WaitForLSPtoBecomeInactive

W aitForLSNtoBecom eInactive
WaitForLSNtoBecomeInactive

LSP_state
= LSP
LSP_state
= IN#2/LSP

LSN_state
= LSN
LSN_state
= IN#24/LSN

NO (LSP
(LSP inactive)
inactive)

LSP_state == 01 ??

NO (LSN
(LSN inactive)
inactive)
LSN_state == 01 ??

YES (LSP active)

NO
Speed Reference
Reference << 00 ??

otor (Stop3)
Stop the m
motor
(Stop3)

YES (LSN active)


active)

YES

NO
NO

Speed Reference
Reference >> 00 ??

Start with
with negative
negative
reference
reference

otor (Stop3)
Stop the m
motor
(Stop3)

Figure 5. Application structure

Technosoft 2005

APN.106 - 9

YES

Start with
with positive
positive
reference
reference

NO
NO

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

This application performs the following main tasks:


1. Configure the TML interrupts for the Limit Switch inputs IN#2/LSP (Limit Switch Positive)
and IN#24/LSN (Limit Switch Negative) in order to stop the motor on the falling edge of
these inputs (when you press down the IN#2/LSP and IN#24/LSN buttons)
2. Run the motor in External Speed control mode with external motion reference read from the
potentiometer REF, which gives a monopolar analog input (0V to +5V).
3. Stop the motion when you press the IN#2/LSP and IN#24/LSN buttons (press IN#2/LSP
and IN#24/LSN buttons depending on the rotation sense: IN#2/LSP for positive speed,
IN#24/LSN for negative speed).
Remark: The pressing of the IN#2/LSP button has no effect while the motor is running
with negative speed. Also, the pressing of the IN#24/LSN button has no effect while the
motor is running with positive speed.
4. Restart the motion only for the opposite sense of movement. For example if the motor has
been stopped by the falling edge of the Limit Switch Positive then the motor starts again
only for negative speed reference value given from the REF potentiometer.
Remark: The limit switches are active on low level, that means only the movement in the
opposite directions are allowed while the limit switch is active (buttons IN#2/LSP/
IN#24/LSP are pressed and kept down). As soon as the limit switch is off (becomes
inactive by releasing the IN#2/LSP/ IN#24/LSP buttons) the movement is allowed on both
directions.
5. Check the status of ENABLE input:
- disable PWM when ENABLE input is in low state (the button ENABLE is pressed)
- enable PWM when ENABLE input is in high state (the button ENABLE is released)
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.106 - 10

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Figure 6. Motion sequences window

To get details about how the motion sequences are configured in the window above, double-click
on the motion sequence for which you need details.
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 Interrupt, to open this window:

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

Technosoft 2005

APN.106 - 11

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

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

Figure 8. TML Interrupt 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.106 - 12

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Figure 9. TML Interrupt for Int7 Limit Switch Negative

To see how the user-functions CheckAndWaitEnable, WaitForLSPtoBecomeInactive, and


WaitForLSNtoBecomeInactive are implemented follow the next steps:
1. In the Project window select the function CheckAndWaitEnable and the following window
will open:

Figure 10. Implementation of the CheckAndWaitEnable routine

2. In the Project window select the function WaitForLSNtoBecomeInactive and the


following window will open:

Technosoft 2005

APN.106 - 13

APPLICATION NOTE 042.IM23x-MA.106


12/23/05

IM23x-MA

Using the Limit Switches and Enable inputs with analogue reference

Figure 11. Implementation of the WaitForLSNtoBecomeInactiv routine

3. In the Project window select the function WaitForLSPtoBecomeInactive and the


following window will open:

Figure 12. Implementation of the WaitForLSPtoBecomeInactiv routine

Technosoft 2005

APN.106 - 14

Das könnte Ihnen auch gefallen