Galil DMC-3425 Digital Inputs, Example- Output Port, Example - Turn on output after move

Models: DMC-3425

1 210
Download 210 pages 53.34 Kb
Page 149
Image 149

Example- Output Port

Instruction

OP6

Interpretation

Sets outputs 2 and 3 of output port to high. All other bits are 0. (21 + 22 = 6)

OP0

Clears all bits of output port to zero

OP 255

Sets all bits of output port to one.

The output port is useful for setting relays or controlling external switches and events during a motion sequence.

Example - Turn on output after move

Instruction

Interpretation

#OUTPUT

Label

PR 2000

Position Command

BG

Begin

AM

After move

SB1

Set Output 1

WT 1000

Wait 1000 msec

CB1

Clear Output 1

EN

End

Digital Inputs

The general digital inputs for are accessed by using the @IN[n] function or the TI command. The @IN[n] function returns the logic level of the specified input, n.

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-3425. 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;

 

DMC-3425

Chapter 7 Application Programming141

Page 149
Image 149
Galil DMC-3425 Digital Inputs, Example- Output Port, Example - Turn on output after move, Example - Start Motion on Switch