Ethernet/ip and q programs – Applied Motion RS-232 User Manual
Page 308

308
920-0002 Rev. I
2/2013
Host Command Reference
EtherNet/IP And Q Programs
To provide additional functionality and autonomy, Q programs can be stored in EtherNet/IP drives. These
programs can be started and stopped “on demand” using explicit messaging. The Q Programmer application is
used to compose, download and test Q programs. Please avoid sending EtherNet/IP messages to the drive while
the Q Programmer software is running.
To start a Q program from an EtherNet/IP message, you must send a Type 1 message with opcode 0x78
(the QX command). You’ll need to specifiy the Q segment number, as shown in the example. This allows you to
store up to 12 Q segments, or subprograms, and operate them independently. Q segments can also call each
other once one has been started.
Example: Starting Q Segment 1
QX1
start Q segment 1
opcode
0x0078
from
Table
1
operand 0x1
segment 1 (up to 12 segments are allowed in a Q program)
Type 2 Command Message Payload
Type 2 Response Message Payload
byte 0
0
reserved
byte 0
0
reserved
byte 1
2
message type
byte 1
2
message type
byte 2
78
opcode
byte 2
78
opcode
byte 3
1
operand
byte 3
1
operand
byte 4
0
unused
byte 4
?
Status Code MSB
byte 5
0
unused
byte 5
?
Status Code LSB
byte 6
0
unused
byte 6
0
not used
byte 7
1
segment number
byte 7
0
not used
Once a Q segment has begun, Type 1 messages are no longer permitted, because the CPU is busy
executing the commands in the Q segment. To stop a Q program, you must use a Type 2 “SK” message (opcode
98, as shown in the next example). Q programs also stop running if they encounter a blank line in the segment.
This makes it possible to launch a segment, have it complete a task, and stop by itself.
Example: Stopping a Q Program
SK
stop the Q program
opcode
0x98
from
Table
2
operand decel rate (0 = use quick decel rate from AM, 1 = use normal decel rate from DE or JL)
Type 2 Command Message Payload
Type 2 Response Message Payload
byte 0
0
reserved
byte 0
0
reserved
byte 1
2
message type
byte 1
2
message type
byte 2
98
opcode
byte 2
98
opcode
byte 3
0
operand
byte 3
0
operand
byte 4
0
not used
byte 4
?
status code MSB
byte 5
0
not used
byte 5
?
status code LSB
byte 6
0
not used
byte 6
0
not used
byte 7
0
not used
byte 7
0
not used