You are here

Did You Know? Interrupts with the OI Command

Aug
26
by Bob Loyzim

Q programmer is a versatile application that permits programmed motion to be combined with digital I/O. The combination can occur in several ways: sequentially, simultaneously and armed-at-all-times.

SEQUENTIAL:
In some applications simple line-by-line sequencing of motion and I/O is all that is needed. The sequential nature of Q programs does this seamlessly. No special setup is required. Here’s a Q program that sequentially waits for a digital input, makes a move, then turns on and off a digital output.

Cmd Param1 Param2 Comment
WI 4L   wait for input 4 to go LO
FL 40000   feed to length 40,000 steps
SO 1L   set output 1 LO
WT 0.50   wait .5 sec
SO 1H   set output 1 HI

SIMULTANEOUS:
Some applications require I/O actions and motion to occur simultaneously. For this we offer multitasking capability. Setting the Q program command MT1 is all that’s required. Here’s a Q program that simultaneously causes motion and sets a digital output in the middle of the move.

Cmd Param1 Param2 Comment
MT 1   activate multitasking
WI 1L   wait for input 1 to go LO
CJ     commence jogging
WT 1.00   wait 1 second
SO 1L   set output 1 LO
WT 0.50   wait .5 seconds
SO 1H   set output 1 HI
WI 1H   wait for input 1 to go HI
SM D   stop jogging

ARMED-AT-ALL-TIMES:
Some applications require interrupt capability that is armed-at-all-times. This capability is well suited for motion applications involving safety door switches, palm buttons, light curtains etc. These safety interlocks can be wired to a digital input and armed in Q programmer with the OI command. When this input is triggered the Q program immediately jumps to Segment 10, the interrupt segment, and the proper shutdown sequence can be executed. Here’s a Q program with Segment 1 arming the interrupt function and Segment 10 responding when the interrupt is triggered.

Segment 1

Cmd Param1 Param2 Comment
OI 3L   arm the interrupt function and use input 3 LO as the trigger condition
WI 4L   wait for input 4 to go LO
FL 40000   feed to length 40,000 steps
SO 1L   set output 1 LO
WT 0.50   wait .5 sec
SO 1H   set output 1 HI

Segment 10

Cmd Param1 Param2 Comment
WM     wait for move to finish, the interrupt function uses AM decel rate
SO 2L   set output 2 LO
WT 0.50   wait .5 sec
SO 2H   set output 2 HI
OI 3L   re-arm the interrupt function

Points to remember about the OI interrupt command:

  • OI functions as a latch and must be armed to take effect. It must also be re-armed once the interrupt input is triggered and the latch disarmed. Re-arming is often done toward the end of Segment 10.
  • The OI command is automatically paired with Segment 10. That is to say Segment 10 automatically runs when an interrupt occurs.
  • Motion can be terminated in a shorter period of time using the AM decel rate; see graph below.

Q Programmer is included with the following software applications from Applied Motion Products:

News Tags: