Example - using inputs to control program flow, Example - start motion on switch, The auxiliary encoder inputs – Galil DMC-2X00 User Manual

Page 170: Input interrupt function

Advertising
background image

Example - Using Inputs to control program flow

Instruction Interpretation

JP #A,@IN[1]=0

Jump to A if input 1 is low

JP #B,@IN[2]=1

Jump to B if input 2 is high

AI 7

Wait until input 7 is high

AI -6

Wait until input 6 is low

Example - Start Motion on Switch

Motor A must turn at 4000 counts/sec when the user flips a panel switch to on. When panel switch is
turned to off position, motor A must stop turning.

Solution: Connect panel switch to input 1 of DMC-2x00. High on input 1 means switch is in on
position.

Instruction Interpretation

#S;JG 4000

Set speed

AI 1;BGA

Begin after input 1 goes high

AI -1;STA

Stop after input 1 goes low

AMA;JP #S

After motion, repeat

EN;

The Auxiliary Encoder Inputs

The auxiliary encoder inputs can be used for general use. For each axis, the controller has one
auxiliary encoder and each auxiliary encoder consists of two inputs, channel A and channel B. The
auxiliary encoder inputs are mapped to the inputs 81-96.

Each input from the auxiliary encoder is a differential line receiver and can accept voltage levels
between +/- 12 volts. The inputs have been configured to accept TTL level signals. To connect TTL
signals, simply connect the signal to the + input and leave the - input disconnected. For other signal
levels, the - input should be connected to a voltage that is ½ of the full voltage range (for example,
connect the - input to 6 volts if the signal is a 0 - 12 volt logic).

Example:

A DMC-2x10 has one auxiliary encoder. This encoder has two inputs (channel A and channel B).
Channel A input is mapped to input 81 and Channel B input is mapped to input 82. To use this input
for 2 TTL signals, the first signal will be connected to AA+ and the second to AB+. AA- and AB-
will be left unconnected. To access this input, use the function @IN[81] and @IN[82].

NOTE: The auxiliary encoder inputs are not available for any axis that is configured for stepper
motor.

Input Interrupt Function

The DMC-2x00 provides an input interrupt function which causes the program to automatically
execute the instructions following the #ININT label. This function is enabled using the II m,n,o
command. The m specifies the beginning input and n specifies the final input in the range. The
parameter o is an interrupt mask. If m and n are unused, o contains a number with the mask. A 1
designates that input to be enabled for an interrupt, where 2

0

is bit 1, 2

1

is bit 2 and so on. For

example, II,,5 enables inputs 1 and 3 (2

0

+ 2

2

= 5).

A low input on any of the specified inputs will cause automatic execution of the #ININT subroutine.
The Return from Interrupt (RI) command is used to return from this subroutine to the place in the
program where the interrupt had occurred. If it is desired to return to somewhere else in the program

160

Chapter 7 Application Programming

DMC-2X00

Advertising