OPTO 22 SNAP PAC MOTION CONTROL, SNAP-SCM-BB4, SNAP-SCM-MCH16 User Manual

Page 1
SNAP PAC MOTION CONTROL
USER’S GUIDE
SNAP-SCM-MCH16 Motion Module
SNAP-SCM-BB4 Breakout Board
OptoMotion Command Set
Form 1673-170718July 2017
43044 Business Park Drive Temecula CA 92590-3614
Phone: 800-321-OPTO (6786) or 951-695-3000
www.opto22.com
Product Support Services
800-TEK-OPTO (835-6786) or 951-695-3080
Fax: 951-695-3017
Email: support@opto22.com
Web: support.opto22.com
Page 2
SNAP PAC Motion Control User’s Guide Form 1673-170718July 2017
Copyright © 2003–2017 Opto 22. All rights reserved. Printed in the United States of America.
The information in this manual has been checked carefully and is believed to be accurate; however, Opto 22 assumes no responsibility for possible inaccuracies or omissions. Specifications are subject to change without notice.
Opto 22 warrants all of its products to be free from defects in material or workmanship for 30 months from the manufacturing date code. This warranty is limited to the original cost of the unit only and does not cover installation, labor, or any other contingent costs. Opto 22 I/O modules and solid-state relays with date codes of 1/96 or newer are guaranteed for life. This lifetime warranty excludes reed relay, SNAP serial communication modules, SNAP PID modules, and modules that contain mechanical contacts or switches. Opto 22 does not warrant any product, components, or parts not manufactured by Opto 22; for these items, the warranty from the original manufacturer applies. These products include, but are not limited to, OptoTerminal-G70, OptoTerminal-G75, and Sony Ericsson GT-48; see the product data sheet for specific warranty information. Refer to Opto 22 form number 1042 for complete warranty information.
Wired+Wireless controllers and brains are licensed under one or more of the following patents: U.S. Patent No(s). 5282222, RE37802, 6963617; Canadian Patent No. 2064975; European Patent No. 1142245; French Patent No. 1142245; British Patent No. 1142245; Japanese Patent No. 2002535925A; German Patent No. 60011224.
Opto 22 FactoryFloor, groov, Optomux, and Pamux are registered trademarks of Opto 22. Generation 4, groov Server, ioControl, ioDisplay, ioManager, ioProject, ioUtilities, mistic, Nvio, Nvio.net Web Portal, OptoConnect, OptoControl, OptoDataLink, OptoDisplay, OptoEMU, OptoEMU Sensor, OptoEMU Server, OptoOPCServer, OptoScript, OptoServer, OptoTerminal, OptoUtilities, PAC Control, PAC Display, PAC Manager, PAC Project, SNAP Ethernet I/O, SNAP I/O, SNAP OEM I/O, SNAP PAC System, SNAP Simple I/O, SNAP Ultimate I/O, and Wired+Wireless are trademarks of Opto 22.
ActiveX, JScript, Microsoft, MS-DOS, VBScript, Visual Basic, Visual C++, Windows, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. Linux is a registered trademark of Linus Torvalds. Unicenter is a registered trademark of Computer Associates International, Inc. ARCNET is a registered trademark of Datapoint Corporation. Modbus is a registered trademark of Schneider Electric, licensed to the Modbus Organization, Inc. Wiegand is a registered trademark of Sensor Engineering Corporation. Nokia, Nokia M2M Platform, Nokia M2M Gateway Software, and Nokia 31 GSM Connectivity Terminal are trademarks or registered trademarks of Nokia Corporation. Sony is a trademark of Sony Corporation. Ericsson is a trademark of Telefonaktiebolaget LM Ericsson. CompactLogix, MicroLogix, SLC, and RSLogix are trademarks of Rockwell Automation. Allen-Bradley and ControlLogix are a registered trademarks of Rockwell Automation. CIP and EtherNet/IP are trademarks of ODVA.
groov includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org)
All other brand or product names are trademarks or registered trademarks of their respective companies or organizations.
Opto 22 Automation Made Simple.
ii
SNAP PAC Motion Control User’s Guide
Page 3

Table of Contents

Chapter 1: Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Software Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
About this Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
For Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Module Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Module Bias and Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Module LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Breakout Board Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Breakout Board LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Power and Serial LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Axis LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Breakout Board Connector Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
J2: Serial Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
J3 (and J6, J9, & J12): Encoder Signal Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
J4 (and J7, J10, & J13): Stepper Motor Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
J5 (and J8, J11, & J14): Stepper Motor Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
J15: Auxiliary Power Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Breakout Board Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
SW1–SW8: Signal Selection for Encoder Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
S3 (and S5, S4, & S6): Enable/Disable Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
S7: Bias & Termination, Voltage Select, Breakout Board Address . . . . . . . . . . . . . . . . . . . . . 9
S1 & S2: Pull-up Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
If Pull-Up Resistors Are Not Used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
RS-422/485 Serial Cable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Calculating Power Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Chapter 3: Hardware Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What You Will Need. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Setting Up the SNAP-SCM-MCH16 Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
SNAP PAC Motion Control User’s Guide iii
iii
Page 4
Removing a Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Configuring the Breakout Board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Assigning an IP Address to the Controller or Brain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Checking the Firmware Version of the Controller or Brain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Component Connection Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Connecting Multiple Breakout Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Daisy-Chained Breakout Boards Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Chapter 4: Commands Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Using the Example Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
How To Structure a Motion Control Strategy in PAC Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1: Open a communication handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2: Reset the axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3: Configure parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4: Enable each axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5: Close the communication handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
How To Find Home. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Single Axis Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Multiple Axis Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Moving a Set Distance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Using a Smooth Start and Smooth Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Host I/O Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
How To Use the Command Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Entering Commands in OptoScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Response Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 5: Command Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Commands by Group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Commands in Alphabetical Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Appendix: SNAP-SCM-MCH16 Conversion Formulas . . . . . . . . . . . . . . . . . . . 111
iv
SNAP PAC Motion Control User’s Guide
Page 5

Overview

Introduction

The easy-to-use SNAP PAC Motion Control Subsystem provides an integrated hardware and software toolset for controlling multi-axis stepper motors. The subsystem consists of:
SNAP Motion Control host communication modules (SNAP-SCM-MCH16)
SNAP Motion Control breakout boards (SNAP-SCM-BB4)
OptoMotion command set.
The SNAP-SCM-MCH16 motion control host module is a serial communication module that links up to four SNAP-SCM-BB4 motion control breakout boards with a SNAP PAC I/O unit. When mounted on an I/O unit and connected to a breakout board, a single SNAP-SCM-MCH16 module allows a SNAP PAC controller running a PAC Control™ programming strategy to control up to 16 stepper motors. The module snaps into an Opto 22 SNAP PAC mounting rack right beside digital and analog modules. LED indicators are provided to indicate Transmit and Receive on each port.
1: OverviewChapter 1
Each SNAP-SCM-BB4 breakout board is equipped with a MagellanTM processor chip set that outputs pulse and direction signals for up to four stepper motor systems. You can daisy-chain up to four breakout boards connected to a single module. The module’s external connector provides lines to power one breakout board; additional boards require a separate power source. The SNAP-SCM-BB4 breakout board is designed to be mounted using a DIN-rail system. For additional information on using the MagellanTM Motion Processor, see version 1.x of the MagellanTM Motion Processor User’s Guide available on the web at www.pmdcorp.com.
The OptoMotion commands supports many of the Magellan commands are entered in a PAC Control strategy as text strings using the Transmit String and Receive commands or the TransmitReceiveString command in OptoScript. The OptoMotion commands give you the ability to define and acquire motion process data such as position, velocity, acceleration, breakpoints, interrupts, and time intervals. In addition, you can execute motion-related actions such as smooth stops, stepping, and position adjustments.
SNAP PAC Motion Control User’s Guide 1
TM
Motion Processor commands. These
1
Page 6

ABOUT THIS GUIDE

Software
SNAP PAC controllers use Opto 22’s PAC Pro j e c t Microsoft software for programming, human-machine-interface (HMI) development, and OPC connectivity. Two versions of PAC Project are available:
•PAC Project Basic includes PAC Control for developing control programs, PAC Display™ for creating operator interfaces, and PAC Manager™ configuration software.
PAC Project Professional adds expanded versions of PAC Control and PAC Display plus OptoOPCServer™ software for exchanging data with OPC 2.0-compliant client software applications.
For more information, see the PAC Project Data Sheet.
®
Windows®-compatible automation

Software Availability

PAC Project Basic is included with SNAP PAC controllers and is a free download from the Opto 22 website. PAC Project Professional is available for purchase on a CD with both Acrobat PDF format and printed documentation.
To get PAC Project Professional immediately, you can buy and download the software from the Opto 22 website at www.opto22.com; the CD and printed documentation will be shipped to you. You can also separately purchase PAC Control Professional, PAC Display Professional, and OptoOPCServer as needed. For additional information, see the PAC Project data sheet, Opto 22 form 1699.

Compatibility

SNAP-SCM-MCH16 motion modules are designed to work with SNAP PAC mounting racks. For information on using older SNAP racks, see form 1688, SNAP PAC System Migration Tech Note.
About this Guide
This guide shows you how to install and use the SNAP PAC Motion Control Subsystem. This guide assumes that you know how to create a strategy in PAC Control, and how to use motion control technology. If you are not familiar with these subjects, we strongly suggest you consult commercially available resources to learn about them before attempting to install or use the SNAP PAC Motion Control Subsystem.
The following sections are included in this user’s guide:
Chapter 1, “Overview”—Information about the guide and how to reach Opto 22 Product
Support.
Chapter 2, “Specifications”—Specifications of the SNAP-SCM-MCH16 module and
SNAP-SCM-BB4 breakout board.
Chapter 3, “Hardware Quick Start”—Quick-start steps to get SNAP PAC Motion Control
Subsystem up and running quickly.
Chapter 4, “Commands Quick Start”—How to use the OptoMotion library of motion commands,
which you can use within PAC Control strategies.
2
SNAP PAC Motion Control User’s Guide
Page 7
CHAPTER 1: OVERVIEW
NOTE: Email messages and phone calls to Opto 22 Product Support are grouped together and answered in the order received.
Chapter 5, “Command Reference”—A list of the motion control commands by group, and a
detailed explanation of each command listed in alphabetical order.
Appendix A, “SNAP-SCM-MCH16 Conversion Formulas”—Provides a table for converting
Counts/Cycle used by some of the motion commands.

Related Documentation

See the following documents for additional information.
For this information See this guide Form #
Designing flowchart-based control programs for the system
Configuring I/O points and system functions PAC Manager User’s Guide 1704 Installing and using SNAP PAC brains and I/O units. SNAP PAC Brains User’s Guide 1690
Installing and using Opto 22's SNAP PAC R-series of programmable automation controllers
PAC Control User’s Guide 1700 PAC Control Command Reference 1701
SNAP PAC R-Series Controllers User's Guide
1595

For Help

If you have problems installing or using SNAP PAC Motion Control Subsystem, first check this guide and the Troubleshooting section of the user’s guide for your Opto 22 hardware. If you cannot find the help you need in the guides or on the Opto 22 website, contact Opto 22 Product Support.
Phone: 800-TEK-OPTO (800-835-6786)
951-695-3080 (Hours are Monday through Friday, 7 a.m. to 5 p.m. Pacific Time)
Fax: 951-695-3017
Email: support@opto22.com
Opto 22 website: www.opto22.com
SNAP PAC Motion Control User’s Guide
3
3
Page 8
FOR HELP
4
SNAP PAC Motion Control User’s Guide
Page 9
2: SpecificationsChapter 2

Specifications

This chapter provides specifications of the SNAP-SCM-MCH16 module and SNAP-SCM-BB4 breakout board.
In This Chapter
Module Specifications.......................................below
Breakout Board Specifications ................................. 7
RS-422/485 Serial Cable ...........................................10
Calculating Power Requirements.........................10

Module Specifications

Baud rates 115,200
Parity Even
Data bits 8 only
Logic supply voltage 5.0 to 5.2 VDC
1
Logic supply current
Number of ports per module 1
Maximum number of modules per rack
Maximum cable length, multi-drop 1,000 feet at 115,200 Baud
I/O processor (brain or on-the-rack controller) compatibility
Operating temperature -20 to 70 °C
Storage temperature -30 to 85 °C
Torque, hold-down screws 4 in-lb (0.45 N-m)
Torque, connector screws 5.26 in-lb (0.6 N-m)
Agency Approvals
Warranty 30 months
1. Each breakout board is powered by a separate power supply.
2. Breakout board uses power from the module.
250 mA
2
500 mA
1
8
SNAP-PAC-R1, SNAP-PAC-R2, SNAP-PAC-EB1, or SNAP-PAC-EB2
UL, CE, RoHS, DFARS
SNAP PAC Motion Control User’s Guide 5
5
Page 10
MODULE SPECIFICATIONS
OFF ON
Pull up Termination Pull down
Tx+
Tx-
Vcc
Pullup Rx+ Te rm
Rx-
Pulldown
Vcc
Pullup
Te rm
Pulldown
Power supply
Tx
Status
Rx

Module Bias and Termination

Module LEDs

Transmit and receive LEDs are provided as shown in the diagram at right.
LED Indicates
1 Power Supply Fault
2Tx
3Status
4Rx
Power Supply Fault indicates a fault on the internal power supply of the module (too much draw). This will happen if more than one breakout board is connected without additional power supplies, or there is a short in the system.
Tx: transmitting data
Status: shows module status. This LED blinks twice when the kernel is started.
Rx: receiving data
6
SNAP PAC Motion Control User’s Guide
Page 11

Breakout Board Specifications

CHAPTER 2: SPECIFICATIONS
Power Requirements
Operating Temperature -20 to 70 °C
Relative Humidity 95%, non-condensing
Agency Approvals
Warranty 30 months
8.0 to 32.0 VDC @ 250mA
5.00 to 5.20 VDC @ 500mA
UL, DFARS

Breakout Board LEDs

There are LED indicators for power and serial, and there are four sets of LEDs for the axis connections, one for each axis.
Axis LEDs
Power and Serial LEDs
Power and Serial LEDs
The power and serial LEDs indicate the following:
Axis LEDs
There is one set of LED indicators for each axis that indicates the following:
TX
+3.3V
Serial
RX
+5V
Power
Pulse
Encoder
+Limit
–Limit
SNAP PAC Motion Control User’s Guide
7
7
Page 12
J2: Serial Connector
Pin Description
1 ToHost+
2 ToHost-
3GND
4FromHost+
5FromHost-
6Chassis GND
7VMod
8VMod
9GND
10 GND
J2
J15
J3
J3 (and J6, J9, & J12): Encoder Signal Inputs
Pin Description
1 QuadA+
2 QuadA-
3GND
4 QuadB+
5 QuadB-
6 Index+
7 Index-
8GND
9 Home+
10 Home-
J4 (and J7, J10, & J13): Stepper Motor Outputs
Pin Description
1Pulse+
2Pulse-
3GND
4Direction+
5Direction-
6 AtRest+
7 AtRest-
8GND
9AxisOut+
10 AxisOut-
J4
J5
J5 (and J8, J11, & J14): Stepper Motor Inputs
Pin Description
1 PosLimit
2GND
3 NegLimit
4GND
5 AxisIn
6GND
J15: Auxiliary Power Input
Pin Description
1Aux +5Vin
2 Aux +8-24Vin
3GND
4 Chassis GND
Axis 0
Pin 1
Pin 1 Pin 1
Pin 1
BREAKOUT BOARD SPECIFICATIONS

Breakout Board Connector Pins

8
SNAP PAC Motion Control User’s Guide
Page 13

Breakout Board Switches

SW1–SW8: Signal Selection for Encoder Inputs
Position Description
SW1 (and SW3, SW5, & SW7)
1 & 2 QuadA
3 & 4 QuadB
SW2 (and SW4, SW6, & SW8)
1 & 2 Index
3 & 4 Home
SW2
SW1
12341234
Differential
S3 (and S5, S4, & S6): Enable/Disable Axis
Position Enable/Disable
Up Disable
Middle Enable
Down Enable
S7: Bias & Termination, Voltage Select, Breakout Board Address
S1 & S2: Pull-up Resistors
Switch Axis Description
S1: J5 & J8 470 Ohm
Pull Up Resistors
10PosLimit
2 0 NegLimit
30 AxisIn
41PosLimit
5 1 NegLimit
61 AxisIn
S2: J11 & J14 Pull Ups
12PosLimit
2 2 NegLimit
32 AxisIn
43PosLimit
5 3 NegLimit
63 AxisIn
S3
Axis 0 Axis 1 Axis 2 Axis 3
SW2 SW1
All up=Non-differential All down=Differential
6
5
4321
ON
Enable
SW4 SW3 SW6 SW5 SW8 SW7
S5
S4 S6S1 S2S7
6
5
4321
ON
ON
ON
* Set both switches to ON for VMod, or both to OFF for Aux +8-24Vin.
See also,“If Pull-Up Resistors
Are Not Used” on page 10.
Switch Description
1 ToHost Termination
2 FromHost Termination
3
VMod/Aux +8-24Vin
Select*
4
5 ADDR0
6 ADDR1
Switch Description
1 ToHost Termination
2 FromHost Termination
3
VMod/Aux +8-24Vin
Select*
4
5 ADDR0
6 ADDR1
Use switches 5 and 6 to set the address as follows:
Switch 5 (ADDR0)
Switch 6
(ADDR1)
Address
OFF OFF 0
ON OFF 1
OFF ON 2
ON ON 3
CHAPTER 2: SPECIFICATIONS
SNAP PAC Motion Control User’s Guide
9
9
Page 14

RS-422/485 SERIAL CABLE

+5v
470 J5, J8, J11, J14
Limit LED
+5v
SNAP-SCM-BB4 Chipset
Ω
Equivalent Circuit
SNAP-SCM-MCH16 SNAP-SCM-BB4
Description Pin Pin Description
GND 1, 2 3, 9, 10 GND
TX+ 3 4 FROM HOST+
TX- 4 5 FROM HOST-
RX+ 5 1 TO HOST+
RX- 6 2 TO HOST-
VMOD* 7, 8 7, 8 VMOD*
* VMOD can only power one SNAP-SCM-BB4
If Pull-Up Resistors Are Not Used
If pull-up resistors are not used, the inputs shown on page 9 (see “S1 & S2: Pull-up Resistors” ) will be floating and could cause unexpected behavior if not driven by an external source.
If driven to +5v, the Limit inputs will be asserted. If driven to GND, the Limit inputs will be de-asserted. See circuit below. If you wish to invert this logic, see the SetSignalSense command. If you wish to disable the limit inputs, see the SetLimitSwitchMode command on page 93.
RS-422/485 Serial Cable
Use the following schematic to build the RS-422/485 cable that connects the module to the breakout board. The connectors (Opto part numbers 6346 and R80088) are provided in the motion control kit.

Calculating Power Requirements

When you assemble a SNAP rack that includes a SNAP-SCM-MCH16, you need to calculate the
10
power requirements to make sure that the rack’s power supply is adequate for the combined current needed by the brain or controller and all the I/O modules. For more information and power requirements worksheets, see the SNAP I/O Wiring Guide (form 1403) as well as the wiring appendices in the brain or controller’s user’s guide.
SNAP PAC Motion Control User’s Guide
Page 15
3: Hardware Quick StartChapter 3

Hardware Quick Start

This chapter describes how to set up the Motion Control Subsystem hardware.
In This Chapter
What You Will Need............................................below
Setting Up the SNAP-SCM-MCH16 Module....12
Configuring the Breakout Board...........................15
Component Connection Schematic...................20
Connecting Multiple Breakout Boards...............21

What You Will Need

To set up the Motion Control Subsystem you need the following things:
SNAP-SCM-MCH16 motion module
SNAP-SCM-BB4 motion control breakout board
RS-422/485 serial cable (see
PC running Opto 22 PAC Project software version 8.0 or newer
SNAP PAC rack-mounted controller or brain with firmware version 8.0 or newer.
NOTE: The I/O unit must be part of a system using PAC Control on a SNAP PAC controller.
A SNAP PAC rack
NOTE: Assemble the hardware according to the directions that came with it. For help with wiring, see product data sheets, which are available on our website at www.opto22.com.
Power supply
Stepper motor
“RS-422/485 Serial Cable” on page 10)
SNAP PAC Motion Control User’s Guide 11
11
Page 16

SETTING UP THE SNAP-SCM-MCH16 MODULE

OFF ON
position 0
Retention bar
Module connectors
Setting Up the SNAP-SCM-MCH16 Module
The SNAP-SCM-MCH16 module snaps into place in the row of connectors on any SNAP PAC rack. Each module connector has a number.
1. Set the termination and bias for the SNAP-SCM-MCH16 as follows:
2. Place the rack so that the module connector numbers are right-side up, with zero on the left.
3. With the power off, position the SNAP-SCM-MCH16 module over the module connector in
position 0, aligning the small slot at the base of the module with the retention bar on the rack.
The module can be placed in any position on the rack. This example shows the module in position 0.
12
SNAP PAC Motion Control User’s Guide
Page 17
4. With the module correctly aligned over the
connector, push on the module to snap it into place.
When positioning modules next to each other, be sure to align the male and female module keys (shown in the detailed view in the illustration at right) before snapping a module into position.
Modules snap securely into place and require a special tool (provided) to remove them. To remove a module, see page 14.
5. As shown in the photo at right, use
standard 4-40 x 1/4 truss-head Phillips hold-down screws to secure both sides of each module.
CAUTION: Do not over-tighten screws.
6. Make sure the rack is wired to receive 5.0 to 5.2
VDC @ 4A. Leave the power supply off at this time. For more information on power requirements, see , the SNAP I/O Racks Data Sheet.
CHAPTER 3: HARDWARE QUICK START
SNAP PAC Motion Control User’s Guide
13
13
Page 18
SETTING UP THE SNAP-SCM-MCH16 MODULE

Removing a Module

1. If the module is held in place with
screws, remove them.
2. Holding the SNAP module tool
(provided) as shown in the illu stration at right, inser t it into the notch at the base of the module.
3. Squeeze the module tool against
the module to open the release latch, and pull straight up on the module to remove it.
14
SNAP PAC Motion Control User’s Guide
Page 19

Configuring the Breakout Board

SW1
SW2
12 3412 34
Differential: all down
SW1
SW2
12 3412 34
Non-Differential: all up
Enabled
S3 (and S5)
For breakout board layout information, see “Breakout Board Specifications” on page 7.
1. Decide which of the following example strategies you want to use. For the Electronic Gearing
Example you will need to attach a stepper motor (described below) to Axis 0 and Axis 1. For all other example strategies you only need a stepper motor on axis 0.
Electronic Gearing Example
S-Curve Contouring Example
Trapezoidal Contouring Example
Velocity Contouring Example
For more information, see “Using the Example Strategies” on page 24.
2. (Optional) If you have an encoder, set the Signal Selection switches for Axis 0 (SW1 and SW2) as
shown below for your encoder type. If you are using the Electronic Gearing example strategy, also set the switches for Axis 1 (SW3 and SW4). For help locating the switches on the board, see
“Breakout Board Switches” on page 9.
If your encoder outputs differential signals, make sure they are in the Differential Signals position: all down.
CHAPTER 3: HARDWARE QUICK START
If your encoder outputs non-differential signals, make sure they are in the Non-Differential Signals position: all up.
3. Enable Axis 0 by setting S3 to the Enabled position. If you
are using the Electronic Gearing example strategy (see
page 24), enable Axis 1 too by setting S5 to the Enabled
position.
SNAP PAC Motion Control User’s Guide
15
15
Page 20
CONFIGURING THE BREAKOUT BOARD
6
5
4321
ON
S7
Direction GND Pulse
J4
4. Set the SNAP-SCM-BB4 address and termination on S7 as
shown at right.
5. Connect the SNAP-SCM-MCH16 to the SNAP-SCM-BB4
with the RS-422/485 serial cable (see
“RS-422/485 Serial Cable” on page 10).
6. Connect your stepper motors to the SNAP-SCM-BB4. Minimum connections are Pulse,
Direction, and GND. Make sure you have a power supply for the stepper motor. To locate the connector pins on the board, see “Breakout Board Connector Pins” on page 8.
7. (Optional) If you have an encoder, see “Breakout Board Connector Pins” on page 8 to locate and
connect the connector pins.
8. If the controller or brain on the rack already has an IP address, skip to “Checking the Firmware
Version of the Controller or Brain” on page 19. If not (as indicated by the STAT LED on controller
16
SNAP PAC Motion Control User’s Guide
or brain blinking orange), assign an IP address by following the steps in the next section.
Page 21
CHAPTER 3: HARDWARE QUICK START

Assigning an IP Address to the Controller or Brain

The following instructions for assigning an IP address are provided here in simplified form for your convenience. For detailed instructions on assigning an IP address, please see form 1704, the PAC
Manager User’s Guide.
Before you begin, please note the following:
All SNAP Ethernet-based controllers and brains must be assigned a unique, static IP address. If the network you’re using has a Dynamic Host Configuration Protocol (DHCP) server, either assign a static IP address before connecting the device to the network (preferred), or disable the server. (These servers may respond to BootP requests and assign a dynamic address.)
CAUTION: To make sure the controller or I/O unit is not on a network with a DHCP server, we recommend you use a crossover cable with a direct connection to assign IP addresses.
If you are adding an I/O segment to an existing Ethernet network, your network administrator must provide static IP addresses and subnet masks for the I/O units. If you are creating an independent, dedicated Ethernet network just for I/O, you can choose your own addresses.
You will need to know the device’s MAC address. The MAC address is printed on a label on the side of the device.
BootP broadcasts cannot get through a firewall in the PC where PAC Manager is running. Make sure any firewall in the computer (such as the built-in firewall in Windows XP) is disabled before you try to assign IP addresses. Firewalls in a router should not be a problem.
To assign an IP address:
1. Connect the device (controller or brain) using ETHERNET 1. (Only Ethernet 1 sends a BootP
request.)
NOTE: As stated in the CAUTION above, we recommend you use a crossover cable with a direct connection to assign IP addresses.
2. Choose Start > Programs > Opto 22 > PAC Pro jec t > PAC Manager.
3. Choose Tools > Assign IP Address.
In the dialog that opens you should see the device’s MAC address. Addresses of other Opto 22 Ethernet-based devices without IP addresses might appear as well.
4. Turn on the controller.
5. Double-click the MAC address of the device to open the Mapping dialog box.
CAUTION: PAC Manager lists ALL Opto 22 devices sending BootP or DHCP broadcasts. Assign IP addresses only to the ones you know are yours!
SNAP PAC Motion Control User’s Guide
17
17
Page 22
CONFIGURING THE BREAKOUT BOARD
6. Enter an IP Address and Subnet Mask compatible with your network.
WARNING! Each device on your network, including computers, routers, controllers, brains, and so on, must have a unique IP address. Failure to assign unique IP addresses may cause catastrophic network or hardware failures. If you don’t know which IP addresses are safe to use, check with your system administrator.
7. When the IP address, subnet mask, and other fields are correct, click OK.
The new IP address information appears in the upper list in the dialog box, and the device’s status changes to Mapped. The address information also appears in the lower list to show that this device has been mapped to this address.
8. With the device still highlighted, click Assign.
The address is saved to flash memory, and the status changes to Static IP.
9. To verify that the IP address has been successfully assigned, highlight the device in the upper
list and click Test.
A DOS window opens and the IP address is automatically contacted using the PING program. You should see a reply similar to the following:
18
If you don’t see a reply, make sure the subnet mask you’ve assigned matches the subnet mask on your PC.
10. For future reference, write the IP address next to the MAC address on the white sticker provided
on the device, then close the DOS window.
SNAP PAC Motion Control User’s Guide
Page 23
CHAPTER 3: HARDWARE QUICK START
Firmware version
11. Click Close to exit.
Next you will check to make sure the controller or brain is running firmware version 8.0 or newer.

Checking the Firmware Version of the Controller or Brain

1. Choose Start > Programs > Opto 22 > PAC Project > PAC Manager.
2. In the PAC Manager main window, click Inspect .
3. In the IP Address field, type the IP address of the SNAP-PAC-R controller or brain, and then click
Status Read.
If you don’t have firmware version 8.0 or newer, new firmware can be downloaded from our website, www.opto22.com. For information on how to load new firmware, see Chapter 6 of the PAC Manager User’s Guide, form 1704.
SNAP PAC Motion Control User’s Guide
19
19
Page 24

COMPONENT CONNECTION SCHEMATIC

Motion host module SNAP-SCM-MCH16
RS-422/485 serial link (included)
Optional encoder
Amplifier/ driver
J4 Motor
J3 Encoder
J5 Inputs:
- Positive limit
- Negative limit
- General purpose axis input
Breakout board SNAP-SCM-BB4
Stepper motor
Component Connection Schematic
The following schematic shows a basic connection of one module to one breakout board, and includes an optional encoder.
20
SNAP PAC Motion Control User’s Guide
Page 25

Connecting Multiple Breakout Boards

PC running PAC Control
Controller
SNAP-SCM-MCH16 Motion Module
SNAP-SCM-BB4 breakout boards (up to 4 per module)
Stepper motors (Up to 4 per breakout board)
Ethernet network
Serial RS-422/485
External power supplies are required for additional breakout boards.
You can daisy-chain up to four breakout boards as shown here. The first breakout board in the chain receives power from the motion module, while each additional breakout board requires its own external power supply. The boards are connected with serial RS-422/485 cables. You can connect up to four stepper motors per breakout board. Also see the schematic on the next page.
A PC is used to develop and maintain a PAC Control strategy. The strategy is downloaded to the controller where it runs independently of the PC.
CHAPTER 3: HARDWARE QUICK START
SNAP PAC Motion Control User’s Guide
21
21
Page 26
CONNECTING MULTIPLE BREAKOUT BOARDS
SNAP-SCM-BB4 Next SNAP-SCM-BB4
Description Pin Pin Description
TO HOST+ 1 1 TO HOST+
TO HOST- 2 2 TO HOST-
GND 3 3 GND
FROM HOST+ 4 4 FROM HOST+
FROM HOST- 5 5 FROM HOST-

Daisy-Chained Breakout Boards Schematic

Use the following schematic to daisy-chain SNAP-SCM-BB4 breakout boards.
22
SNAP PAC Motion Control User’s Guide
Page 27
4: Commands Quick StartChapter 4

Commands Quick Start

This chapter gets you started using the OptoMotion library of motion commands, which you can use within PAC Control strategies.
In This Chapter
Introduction..........................................................................................................24
Using the Example Strategies .......................................................................24
How To Structure a Motion Control Strategy in PAC Control ..........25
How To Find Home............................................................................................ 27
Moving a Set Distance...................................................................................... 29
Using a Smooth Start and Smooth Stop..................................................29
Host I/O Errors...................................................................................................... 30
How To Use the Command Details............................................................. 31
Entering Commands in OptoScript............................................................32
Response Format................................................................................................33
SNAP PAC Motion Control User’s Guide 23
23
Page 28

INTRODUCTION

Introduction
The OptoMotion commands support many of the MagellanTM Motion Processor commands, giving you the ability to define and acquire motion process data such as position, velocity, acceleration, breakpoints, interrupts, and time intervals. In addition, you can execute motion-related actions such as smooth stops, stepping, and position adjustments.
Commands are sent to the SNAP-SCM-MCH16 motion module via PAC Control. The SNAP-SCM-MCH16 motion module acts as a communication link between Opto 22 controllers and the SNAP-SCM-BB4 breakout board. Using a PAC Control strategy, you open a TCP Communication Handle to the module. Then you use Transmit/Receive in an OptoScript block to send to the module native English text commands used by the motion processor. The module converts the text strings to binary commands, which it then passes to the motion processor on the breakout board to control the motion of a stepper motor.
You can also use standard PAC Control blocks to enter the motion control commands. However, this typically takes several blocks in a strategy, so it is usually better to use OptoScript. For detailed descriptions of the available commands, see the commands starting on page 38.

Using the Example Strategies

Four example strategies are available on the Opto 22 website, www.opto22.com. Click here, or else navigate to the Downloads section and search for “Motion_Control_Example_Strategies.zip”.
The ZIP file contains the following example strategies:
Electronic Gearing Example: causes axis 0 and axis 1 to rotate for 10 seconds and then stop for 10 seconds.
S-Curve Contouring Example: turns the motor a quarter turn every 10 seconds. This example uses the S-curve profiling mode.
Trapezoidal Contouring Example: Turns the motor a quarter turn every 10 seconds. This example uses the Trapezoidal profiling mode.
Velocity Contouring Example: Turns axis 0 on for 10 seconds then off for 10 seconds.
You can use the example strategies as a starting point for creating your own control strategies. In particular, take a look at the OptoScript blocks, Axis Setup and Axis 0 Move for each example. The Axis Setup block initializes the SNAP-SCM-BB4 and the Axis 0 Move block makes axis 0 move.
If you don’t have PAC Control you can download it from our website, www.opto22.com. For the Electronic Gearing Example you need a stepper motor attached to axis 0 and axis 1. For all other example strategies you only need a stepper motor on axis 0.
To use an example strategy:
1. Unzip the examples from the CD provided to a directory on your local hard drive, and then
open one of the strategies.
2. With an example strategy open in Configure mode or Online mode, double-click the Control
Engines folder on the Strategy Tree and add the control engine as described in Chapter 5 of the PAC Control User’s Guide, form 1700.
In the Control Engine dialog box, you only need to enter a descriptive Control Engine Name and the Primary IP address, which is the address of the controller. In the Configure Control Engines dialog box, make sure to select the control engine and click Set Active.
24
SNAP PAC Motion Control User’s Guide
Page 29
CHAPTER 4: COMMANDS QUICK START
3. Close the dialog boxes for adding a control engine.
4. Choose Mode > Debug.
The strategy is downloaded to the controller.
5. Click Run Strategy , then attend to any dialog boxes that might appear.
At this point your stepper motor should be spinning.

How To Structure a Motion Control Strategy in PAC Control

A motion control strategy in PAC Control should have the following structure:
1: Open a communication handle (page 29)
2: Reset each axis (page 29)
3: Configure parameters (page 30)
4: Enable each axis (page 31)
5: Close the communication handle (page 32)
Also see, “Entering Commands in OptoScript” on page 32 and “Response Format” on page 33.

1: Open a communication handle

Before anything else, open a communication handle in your PAC Control strategy using the Open Outgoing Communication command.
For example, the comm handle used in this example is
Open Outgoing Communication
Communication Handle comMotionModule Put Result in comMotionModule_status
For more information on using communication handles, see form 1700, the PAC Contro l User’s Guide.
comMotionModule.

2: Reset the axes

To start configuration, it’s a good idea to reset all four axes (0–3).
In an OptoScript block use the PAC Control command Transmit/Receive to the send the motion control Reset command.
For example, to reset the axes for board 0, enter the following code using your own com handle and response string variable:
Status = TransmitReceiveString(">Reset,0", ComHandleVariable, RespStringVariable)
Also see, “Entering Commands in OptoScript” on page 32
For more information on using the Transmit/Receive command, see form 1701, the PAC Control Command Reference.
NOTE: It’s not necessary to reset with every move.
SNAP PAC Motion Control User’s Guide
25
25
Page 30
HOW TO STRUCTURE A MOTION CONTROL STRATEGY IN PAC CONTROL

3: Configure parameters

Next you’ll want to configure all of the parameters.
In the following example, the parameters are borrowed from the S-Curve Contouring example included with the motion control example strategies (see “Using the Example Strategies” on
page 24). Only 8 of the parameters are set. The rest have been commented out with //.
Example:
// Setup Axis 0 for S-Curve Contouring.
nStatus = TransmitReceiveString(">SetAcceleration,0,3,FF", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetDeceleration,0,3,FF", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetActualPosition,0,0,0", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetActualPositionUnits,0,1", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetProfileMode,0,2", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetLimitSwitchMode,0,1", comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">SetSignalSense,0,0800", comMotionModule, sCommandResponse);//StepOutput Bit 11
nStatus = TransmitReceiveString(">SetJerk,0,2,FFFF", comMotionModule, sCommandResponse);
26

4: Enable each axis

After configuring the parameters, make sure each axis you are using is enabled by sending the
GetMotorMode command.
For example, for axis 0 send troubleshoot the configuration strings used in the previous step.
Example:
sVelocity0 = ">SetVelocity,0,";
nVelocity0 = nRPM * 447.392426667; // Look in the User's Guide to Calculate RPMs, etc.
NumberToHexString((nVelocity0 >> 16) bitand 0xFFFF, sTemp);
sVelocity0 += sTemp; // Append the first data word.
sVelocity0 += Chr(',');
NumberToHexString(nVelocity0 bitand 0xFFFF, sTemp);
sVelocity0 += sTemp; // Append the second data word.
SNAP PAC Motion Control User’s Guide
>GetMotorMode,0. If the response is 1, the axis is ready. If its 0,
Page 31
nStatus = TransmitReceiveString(sVelocity0, comMotionModule, sCommandResponse);

5: Close the communication handle

Finally, close the communication handle.
Example:
Close Communication
Communication Handle comMotionModule
Put Status in comMoitonModule_status

How To Find Home

For many applications it’s important to be able to move your device to the home position. To do this, send the SetBreakPointValue and SetBreakPoint commands to enable a breakpoint at home. Then send the device position to a value past the home point. This allows you to rely on the home inputs and the breakpoints to stop the device.
CHAPTER 4: COMMANDS QUICK START
NOTE: A lways make s ure to loa d the breakpoint comparison value (SetBreakPointValue command) before setting a new breakpoint condition (SetBreakPoint command). Failure to do so will likely result in unexpected behavior.
Single Axis Example
// Set Positions to a value just past home.
nPosition0 = 280000;
sPosition0 = ">SetPosition,0,";
NumberToHexString((nPosition0 >> 16) bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the first data word.
sPosition0 += Chr(',');
NumberToHexString(nPosition0 bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the second data word.
nStatus = TransmitReceiveString(sPosition0, comMotionModule,sCommandResponse);
// Set Breakpoint 0 setup for signal status
nStatus = TransmitReceiveString(">SetBreakPointValue,0,0,0008,0000", comMotionModule, sCommandResponse);
//Breakpoint 0, abrupt stop, signal status
nStatus = TransmitReceiveString(">SetBreakPoint,0,0,0A20", comMotionModule, sCommandResponse)
SNAP PAC Motion Control User’s Guide
27
27
Page 32
HOW TO FIND HOME
//Send the update command that will the axis move
nStatus = TransmitReceiveString(">Update,0", comMotionModule, sCommandResponse);
Multiple Axis Example
For a multi-axis system, multiple homes can be done simultaneously by setting up all of the axes individually and then using the MultiUpdate command instead of the Update command used above.
// Set Positions to a value just past home for axis 0.
nPosition0 = 280000;
sPosition0 = ">SetPosition,0,";
NumberToHexString((nPosition0 >> 16) bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the first data word.
sPosition0 += Chr(',');
NumberToHexString(nPosition0 bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the second data word.
nStatus = TransmitReceiveString(sPosition0, comMotionModule,sCommandResponse);
// Set Breakpoint 0 setup for signal status
nStatus = TransmitReceiveString(">SetBreakPointValue,0,0,0008,0000", comMotionModule, sCommandResponse);
//Breakpoint 0, abrupt stop, signal status
nStatus = TransmitReceiveString(">SetBreakPoint,0,0,0A20", comMotionModule, sCommandResponse)
// Set Positions to a value just past home for axis 1.
nPosition1 = -170000;
sPosition1 = ">SetPosition,1,";
NumberToHexString((nPosition1 >> 16) bitand 0xFFFF, sTemp);
sPosition1 += sTemp; // Append the first data word.
sPosition1 += Chr(',');
NumberToHexString(nPosition1 bitand 0xFFFF, sTemp);
sPosition1 += sTemp; // Append the second data word.
nStatus = TransmitReceiveString(sPosition1, comMotionModule,sCommandResponse);
// Set Breakpoint 1 setup for signal status
28
SNAP PAC Motion Control User’s Guide
Page 33
nStatus = TransmitReceiveString(">SetBreakPointValue,1,1,0008,0000", comMotionModule, sCommandResponse);
//Breakpoint 1, abrupt stop, signal status
nStatus = TransmitReceiveString(">SetBreakPoint,1,1,0A21", comMotionModule, sCommandResponse)
//Send the update command that will make all the axis move
nStatus = TransmitReceiveString(">MultiUpdate,0,F", comMotionModule, sCommandResponse);

Moving a Set Distance

To move a set distance, set a variable such as “X_MOVE_COUNT” with an integer. In the following example code taken from a strategy for a module test bed, 12,000 is the number of steps from one module to the next on an X-Y table.
sPosition0= ">SetPosition,0,";
nPosition0 = X_MOVE_COUNT ; //12000 is the distance(Steps) between the modules.
NumberToHexString((nPosition0 >> 16) bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the first data word.
sPosition0 += Chr(',');
NumberToHexString(nPosition0 bitand 0xFFFF, sTemp);
sPosition0 += sTemp; // Append the second data word.
nStatus = TransmitReceiveString(sPosition0, comMotionModule, sCommandResponse);
nStatus = TransmitReceiveString(">Update,0", comMotionModule, sCommandResponse);
The actual move happens when the >Update,0 command is executed.
CHAPTER 4: COMMANDS QUICK START

Using a Smooth Start and Smooth Stop

The SetStopMode command and the breakpoint commands (such as SetBreakPoint) all have SmoothStop or AbruptStop options.
Set the starting acceleration with the SetAcceleration command. For example,
>SetAcceleration,0,3,FF.
SNAP PAC Motion Control User’s Guide
29
29
Page 34

HOST I/O ERRORS

Host I/O Errors
The motion processor performs a number of checks on the commands sent to it. These checks improve the safety of the motion system by eliminating incorrect command data values. All such checks associated with host I/O commands are referred to as host I/O errors. To determine the error’s cause, use the command GetHostIOError. This command also clears both the error code and the I/O error bit in the I/O status read word.
The following I/O error codes may be returned by the GetHostIOError command.
Code (hex) Indication Cause
00 No error No error condition
01 Magellan reset Default value of error code on reset or power-up.
02 Invalid instruction
03 Invalid axis
04 Invalid parameter
05 Trace running
06 Reserved --
07 Block bound exceeded
08 Trace zero
09
0A Communication Timeout
Bad checksum (Serial port
only)
Instruction is not valid in the current context, or an illegal instruction code has been detected.
The axis number contained in the upper bits of the instruc­tion word is not supported by this motion processor.
The parameter value sent to the motion processor was out of its acceptable range.
An instruction was issued that would change the state of the tracing mechanism while the trace is running. Instructions which can return this error are SetTraceVariable, SetTrace­Mode & SetTracePeriod
1. The value sent by SetBufferLength or SetBufferStart would create a memory block which extends beyond the allowed limits of 400h - 7FFFFFFFh.
2. Either SetBufferReadIndex or SetBufferWriteIndex sent an index value greater than or equal to the block length.
SetTraceStart Immediate was issued, but the length of the trace buffer is currently set to zero.
The checksum complied and returned by Magellan does not match the checksum which was sent by the host.
1. Make sure your communication handle is pointing to the SNAP-SCM-MCH16.
2. Check the SNAP-SCM-BB4 address, switch S7. Each motion command has an “Axis” parameter that corresponds to a SNAP-SCM-BB4 address.
3. Check the physical link between the SNAP-SCM-MCH16 and SNAP-SCM-BB4.
.
30
0B Negative velocity
0C S-curve change
0D Limit event pending A limit switch event has occurred.
0E Move into limit
SNAP PAC Motion Control User’s Guide
An attempt was made to set a negative velocity without the axis being in velocity contouring profile mode.
The axis is currently executing an S-curve profile move and an attempt was made to change the profile parameters. This is not permitted.
An attempt was made to execute a move without first clear­ing the limit bit(s) in the event status register.
Page 35

How To Use the Command Details

Also see, “Entering Commands in OptoScript” on page 32 and “Response Format” on page 33.
For each command in Chapter 5, the instruction mnemonic is shown in the command heading at the left. Certain parameters and other data written to the motion processor are buffered. That is, they are not acted upon until the next Update or MultiUpdate command is executed. These parameters are identified by the word buffered in the command heading at the right.
The details for each command are as follows:
CHAPTER 4: COMMANDS QUICK START
Syntax
Arguments
Data Structure
The instruction mnemonic and its required arguments are shown with all arguments separated by commas.
Encoded-field arguments are packed into a single 16-bit data word. The Name of the argument is that shown in the generic syntax.
Instance is the mnemonic used to represent the data value. Encoding is the value assigned to the field for that instance.
For numeric arguments, the parameter Value, the Type (signed or unsigned integer) and Range of acceptable values are given. Numeric arguments may require one or two data words. For 32-bit arguments, the high-order part is transmitted first.
You must specify the location of the stepper for each command. The number of the stepper motor identifies one of four SNAP-SCM-BB4 breakout boards as follows:
Stepper Motor Location Breakout Board Address
0 to 3 0
4 to 7 1
8 to B 2
C to F 3
This is a graphic representation of the 16-bit words transmitted in the packet: the instruction, which is identified by its name, followed by 1, 2, or 3 data words. Bit numbers are shown directly below each word. For each field in a word, only the high and low bits are shown. For 32-bit numeric data, the high-order bits are numbered from 16 to 31, the low-order bits from 0 to 15.
Argument names are shown in their respective words or fields.
For data words, the direction of transfer-read or write-is shown at the left of the word's diagram.
Description
Restrictions
OptoScript
Example
See Also
Unused bits are shaded. All unused bits must be 0 in data words and instructions sent (written) to the motion processor.
Describes what the instruction does and any special information relating to the instruction.
Describes the circumstances in which the instruction is not valid, that is, when it should not be issued. For example, velocity, acceleration, deceleration, and jerk parameters may not be issued while an S-curve profile is being executed.
The syntax of the text string entered within the TransmitReceiveString OptoScript command, which is sent to the motion module for conversion to the corresponding PMD C-Motion command for implementation by the motion control processor.
Refers to related instructions.
SNAP PAC Motion Control User’s Guide
31
31
Page 36

ENTERING COMMANDS IN OPTOSCRIPT

Status = TransmitReceiveString(">SetAcceleration,4,0,3E", ComHandleVariable, RespStringVariable)
PAC Control command Motion control command Communication Handle Put Result in
Axis Data
P1 P2
Quotation mark
Quotation mark
> symbol
Command name
IP address of the controller
Port 22500 - 22531 even only
For more information on communication handles, see Chapter 10 in the PAC Co ntr ol
User’s Guide.
Motion control command:
If the status byte returns a 00, the command is successful. Any other response indicates an error. See “Response Format” on page 33.
Communication Handle:
Put Result in:
tcp: 127.0.0.1:22500
">SetAcceleration, 4,0,3E"
RespStringVariable
Entering Commands in OptoScript
A motion control command is entered as a text string in OptoScript using the TransmitReceiveString command, which is the same as Transmit/Receive String in standard PAC Control. This command sends the motion control command to the processor and then waits for a response. For more information on the Transmit/Receive String command, see the PAC Control Command Reference, form 1701. For information on motion control strategy examples available on the Opto 22 website, see “Using the Example Strategies” on page 24.
To enter a motion control command, use the > symbol at the beginning of the command and enclose the command in double quotes, as shown in the following example:
Syntax:
TransmitReceiveString(“>Command”, Communication Handle, Put Result in)
For the PAC Control command use TransmitReceiveString. Note that the Put Result in parameter is for the response from the motion control command. The following examples show the SetAcceleration and Get Acceleration commands. Quotation marks are used here because these are string literals rather than string variables.
Example 1: SetAcceleration.
32
SNAP PAC Motion Control User’s Guide
Page 37
Example 2: Get Acceleration.
Axis
Quotation mark Quotation mark
> symbol
Command name
IP address of the controller
Port 22500 - 22531 even only
For more information on communication handles, see Chapter 10 in the PA C Co nt ro l
User’s Guide.
Motion control command:
Communication Handle:
Put Result in:
tcp: 127.0.0.1:22500
If the status byte returns a 00, the command is successful. Any other response indicates an error. See “Response Format,” below.
RespStringVariable
">GetAcceleration, 4"
>Status,P1,P2,P3
> symbol
16-bit returned data encoded as a hex string. Depending on the command, includes 0, 1, 2, or 3 parameters.
Status: If successful, 00 If not successful, a code from the Host I/O Errors list.
CHAPTER 4: COMMANDS QUICK START

Response Format

Command responses are in the following format:
Returned packet examples:
Successful command:
>00,0123,4567,89AB
Not successful: >04
SNAP PAC Motion Control User’s Guide
33
33
Page 38
RESPONSE FORMAT
34
SNAP PAC Motion Control User’s Guide
Page 39
5: Command ReferenceChapter 5

Command Reference

This command reference provides a list of the motion control commands by group, and a detailed explanation of each command listed in alphabetical order.
For an explanation on how to use the information included for each command, page 31.
In This Chapter
Commands by Group ................................................36
Commands in Alphabetical Order.......................38
SNAP PAC Motion Control User’s Guide 35
35
Page 40

COMMANDS BY GROUP

Commands by Group
The following Magellan™ Motion Processor commands are supported in PAC Control using OptoScript.
Commands Description
Breakpoints and Interrupts
ClearInterrupt Reset interrupt line.
GetInterruptAxis Get the axes with pending interrupts.
SetBreakPoint, GetBreakPoint Set/Get breakpoint type.
SetBreakPointValue, GetBreakPointValue Set/Get breakpoint comparison value.
SetInterruptMask, GetInterruptMask Set/Get interrupt mask.
Digital Servo Filter
ClearPositionError Set position error to 0.
GetPositionError Get the position error.
SetAutoStopMode, GetAutoStopMode Set/Get auto stop on position error (on or off).
SetPositionErrorLimit, GetPositionErrorLimit Set/Get the maximum position error limit.
Encoder
AdjustActualPosition Sum the specified offset with the actual encoder position.
GetActualVelocity Get the actual encoder velocity.
GetCaptureValue Get the position capture value, and reset the capture.
SetActualPosition, GetActualPosition Set/Get the actual encoder position.
SetActualPositionUnits, GetActualPositionUnits Set/Get the unit type returned for the actual encoder position.
SetCaptureSource, GetCaptureSource Set/Get the capture source (home or index).
SetEncoderModulus, GetEncoderModulus Set/Get the full scale range of the parallel-word encoder
SetEncoderSource, GetEncoderSource Set/Get the encoder type.
SetEncoderToStepRatio, GetEncoderToStepRatio Set/Get encoder count to step ratio.
External RAM
ReadBuffer Read a long word value from a buffer memory locations.
SetBufferLength, GetBufferLength Set/Get the length of a memory buffer.
SetBufferReadIndex, GetBufferReadIndex Set/Get the buffer read pointer for a particular buffer.
SetBufferStart, GetBufferStart Set/Get the start location of a memory buffer.
SetBufferWriteIndex, GetBufferWriteIndex Set/Get the buffer write pointer for a particular buffer.
WriteBuffer Write a long word value to a buffer memory location.
Motor Output
SetMotorMode, GetMotorMode Set/Get motor loop mode.
SetStepRange, GetStepRange Set/Get the allowable range (in kHz) for step output generation.
Profile Generation
GetCommandedAcceleration Get commanded (instantaneous desired) acceleration
GetCommandedPosition Get commanded (instantaneous desired) position.
GetCommandedVelocity Get commanded (instantaneous desired) velocity.
MultiUpdate Forces buffered command values to become active for multiple axes.
SetAcceleration, GetAcceleration Set/Get acceleration limit.
36
SNAP PAC Motion Control User’s Guide
Page 41
CHAPTER 5: COMMAND REFERENCE
Commands Description
SetDeceleration, GetDeceleration Set/Get deceleration limit.
SetGearMaster, GetGearMaster
SetGearRatio, GetGearRatio Set/Get commanded electronic gear ratio.
SetJerk, GetJerk Set/Get jerk limit.
SetPosition, GetPosition Set/Get the destination position.
SetProfileMode, GetProfileMode
SetStartVelocity, GetStartVelocity Set/Get start velocity.
SetStopMode, GetStopMode Set/Get stop command; abrupt, smooth, or none.
SetVelocity, GetVelocity Set/Get velocity limit.
Update Forces buffered command values to become active.
ServoLoopControl
GetTime Get current chip set time (number of servo loops).
SetAxisMode, GetAxisMode Set/Get the axis operation mode (enabled or disabled).
SetLimitSwitchMode, GetLimitSwitchMode Set/Get the limit switch mode (on or off).
SetMotionCompleteMode, GetMotionCompleteMode Set/Get the motion complete mode (target-based or actual).
SetSampleTime, GetSampleTime Set/Get servo loop sample time.
SetSettleTime, GetSettleTime Set/Get the axis-settled time.
SetSettleWindow, GetSettleWindow Set/Get the settle-window boundary value.
SetTrackingWindow, GetTrackingWindow Set/Get the tracking window boundary value.
Status Registers and AxisOut Indicator
GetActivityStatus Get activity status register.
GetEventStatus Get event status register.
GetSignalStatus Get the signal status register.
ResetEventStatus Reset bits in event status register.
SetAxisOutSource, GetAxisOutSource Set/Get axis out signal monitor source.
SetSignalSense, GetSignalSense Set/Get the interpretation of the signal status bits.
Miscellaneous
NoOperation Perform no operation.
Reset Reset the SNAP-SCM-BB4.
Set/Get the electronic gear mode master axis and source (actual or target-based).
Set/Get the profile mode (S-curve, trapezoidal, velocity-contouring, or electronic gear).
SNAP PAC Motion Control User’s Guide
37
37
Page 42

COMMANDS IN ALPHABETICAL ORDER

Commands in Alphabetical Order
AdjustActualPosition 33 GetJerk 50 SetBufferLength, GetBufferLength 73
ClearInterrupt 34 GetLimitSwitchMode 50 SetBufferReadIndex, GetBufferReadIndex 74
ClearPositionError 35 GetMotionCompleteMode 50 SetBufferStart, GetBufferStart 75
GetAcceleration 35 GetMotorMode 50 SetBufferWriteIndex, GetBufferWriteIndex 76
GetActivityStatus 36 GetPosition 50 SetCaptureSource, GetCaptureSource 77
GetActualPosition 37 GetPositionError 51 SetDeceleration, GetDeceleration 78
GetActualPositionUnits 37 GetPositionErrorLimit 51 SetEncoderModulus,GetEncoderModulus 79
GetActualVelocity 38 GetProfileMode 51 SetEncoderSource, GetEncoderSource 80
GetAutoStopMode 39 GetSampleTime 52 SetEncoderToStepRatio, GetEncoderToStepRatio 81
GetAxisMode 39 GetSettleTime 52 SetGearMaster, GetGearMaster 82
GetAxisOutSource 39 GetSettleWindow 52 SetGearRatio, GetGearRatio 83
GetBreakPoint 39 GetSignalSense 52 SetInterruptMask, GetInterruptMask 85
GetBreakPointValue 39 GetSignalStatus 53 SetJerk, GetJerk 86
GetBufferLength 39 GetStartVelocity 54 SetLimitSwitchMode, GetLimitSwitchMode 87
GetBufferReadIndex 40 GetStepRange 54 SetMotionCompleteMode, GetMotionCompleteMode 88
GetBufferStart 40 GetStopMode 54 SetMotorMode, GetMotorMode 89
GetBufferWriteIndex 40 GetTrackingWindow 54 SetPosition, GetPosition 90
GetCaptureSource 40 GetTime 55 SetPositionErrorLimit, GetPositionErrorLimit 91
GetCaptureValue 41 GetVelocity 55 SetProfileMode, GetProfileMode 92
GetCommandedAcceleration 42 MultiUpdate 56 SetSampleTime, GetSampleTime 93
GetCommandedPosition 43 NoOperation 57 SetSettleTime, GetSettleTime 94
GetCommandedVelocity 44 ReadBuffer 58 SetSettleWindow, GetSettleWindow 95
GetDeceleration 45 Reset 59 SetSignalSense, GetSignalSense 96
GetEncoderModulus 45 ResetEventStatus 61 SetStartVelocity, GetStartVelocity 98
GetEncoderSource 45 SetAcceleration, GetAcceleration 62 SetStepRange, GetStepRange 99
GetEncoderToStepRatio 45 SetActualPosition, GetActualPosition 63 SetStopMode, GetStopMode 100
GetEventStatus 46 SetActualPositionUnits, GetActualPositionUnits 64 SetTrackingWindow, GetTrackingWindow 101
GetGearMaster 47 SetAutoStopMode,GetAutoStopMode 65 SetVelocity, GetVelocity 102
GetGearRatio 47 SetAxisMode, GetAxisMode 66 Update 103
GetHostIOError 48 SetAxisOutSource, GetAxisOutSource 67 WriteBuffer 104
GetInterruptAxis 49 SetBreakPoint, GetBreakPoint 69
GetInterruptMask 50 SetBreakPointValue, GetBreakPointValue 71
38
SNAP PAC Motion Control User’s Guide
Page 43

AdjustActualPosition

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
Description
AdjustActualPosition, axis, P1, P2
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Type Range Scaling Units
position signed 32 bits -231 to 231-1 unity
counts/cycle microsteps/cycle
2
AdjustActualPosition
First data word
P1 write position (high-order part)
P2 write position (low-order part)
31 16
Second data word
15 0
The position specified as the parameter to AdjustActualPosition is summed with the actual position register (encoder position) for the specified axis. This has the effect of adding or subtracting an offset to the current actual position. At the same time, the commanded position is replaced by the new actual position value minus the position error. This prevents a servo “bump” when the new axis position is established. The destination position (see “SetPosition, GetPosition” on page 96) is also modified by this amount so that no trajectory motion will occur when the update instruction is issued. In effect, this instruction establishes a new reference position from which subsequent positions can be calculated. It is commonly used to set a known reference position after a homing procedure. The position error is also zeroed.
AdjustActualPosition takes effect immediately, it is not buffered.
OptoScript
Example
See Also
Status=TransmitReceiveString (“>AdjustActualPosition,4,0,3E”,ComHandle,ResponseString)
GetPositionError (page 57), GetActualVelocity (page 44), SetActualPositionUnits, GetActualPositionUnits (page 70), SetActualPosition, GetActualPosition (page 69)
SNAP PAC Motion Control User’s Guide
39
39
Page 44
COMMANDS IN ALPHABETICAL ORDER

ClearInterrupt

Syntax
Arguments
Description
OptoScript
Example
See Also
ClearInterrupt, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
ClearInterrupt resets the HostInterrupt signal to its inactive state. If interrupts are still pending, the HostInterrupt line will return to its active state within one chip cycle. Refer to Set/GetSampleTime for information on chip cycle timing (page 99). It is used after an interrupt has been recognized and processed by the host. This command does not affect the event status register. The ResetEventStatus command should be issued prior to the ClearInterrupt command to clear the condition which generated the interrupt. The ClearInterrupt command has no effect if it is executed when no interrupts are pending.
The axis number is not used.
Status=TransmitReceiveString (“>ClearInterrupt,0”,ComHandle,ResponseString)
GetInterruptAxis (page 55), SetInterruptMask, GetInterruptMask (page 91), ResetEventStatus (page 67)
40
SNAP PAC Motion Control User’s Guide
Page 45

ClearPositionError

CHAPTER 5: COMMAND REFERENCE
buffered
Syntax
Arguments
Description
Restrictions
OptoScript
Example
See Also
ClearPositionError, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
ClearPositionError sets the profile's commanded position equal to the actual position (encoder input), thereby clearing the position error for the specified axis. This command can be used when the axis is at rest, or when it is moving.
ClearPositionError is a buffered command. The new value set will not take effect until the next Update or MultiUpdate instruction.
This command should not be sent while the chip is executing a move using the S-curve profile mode.
Status=TransmitReceiveString (“>ClearPositionError,1”,ComHandle,ResponseString)
GetPositionError (page 57), MultiUpdate (page 62), SetPositionErrorLimit, GetPositionErrorLimit (page 97)

GetAcceleration

See “SetAcceleration, GetAcceleration” on page 68.
SNAP PAC Motion Control User’s Guide
41
41
Page 46
COMMANDS IN ALPHABETICAL ORDER

GetActivityStatus

Syntax
Arguments
Returned Data
Data Structure
Description
GetActivityStatus, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type
status unsigned 32 bits see below
GetActivityStatus
First data word
P1 read position (high-order part)
16 0
GetActivityStatus reads the 16-bit activity status register for the specified axis. Each of the bits in this register continuously indicate the state of the motion processor without any action on the part of the host. There is no direct way to set or clear the state of these bits, since they are controlled by the motion processor.
The following table shows the encoding of the data returned by this command
Name Bits Description
reserved 6 Not used; may be 0 or 1. reserved 0 Not used; may be 0 or 1.
At maximum velocity 1
Tracking 2 Set to 1 when the axis is within the tracking window.
Current profile mode 3-5 Contains trajectory mode encoded as follows:
Axis settled 7 Set to 1 when the axis is settled.
Motor on/off 8 Set to 1 when motor mode is on, 0 when off.
Position capture 9
In-motion 10 Set to 1 when the trajectory generator is executing a profile.
In positive limit 11 Set to 1 when the positive limit switch is active.
In negative limit 12 Set to 1 when the negative limit switch is active.
Set to 1 when the trajectory is at maximum velocity. This bit is deter­mined by the trajectory generator, not the actual encoder velocity.
bit 5 0 0 0 0
Set to 1 when a value has been captured by the high speed position capture hardware but has not yet been read.
bit 4 0 0 1 1
bit 3 0 1 0 1
Profile Mode trapezoidal velocity contouring s-curve electronic gear
42
SNAP PAC Motion Control User’s Guide
Page 47
Name Bits Description
When the profile mode is S-curve, it contains the profile segment
Profile segment 13-15
number 1-7 while profile is in motion, and contains a value of 0 when the profile is at rest. This field is undefined when using the Trapezoi­dal and Velocity Contouring profile modes.
CHAPTER 5: COMMAND REFERENCE
OptoScript
Example
See Also
Status=TransmitReceiveString (“>GetActivityStatus,2”,ComHandle,ResponseString)
GetEventStatus (page 52), GetSignalStatus (page 59)

GetActualPosition

See “SetActualPosition, GetActualPosition” on page 69.

GetActualPositionUnits

See “SetActualPositionUnits, GetActualPositionUnits” on page 70.
SNAP PAC Motion Control User’s Guide
43
43
Page 48
COMMANDS IN ALPHABETICAL ORDER

GetActualVelocity

Syntax
Arguments
Returned Data
Data Structure
Description
GetActualVelocity, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
velocity signed 32 bits -231 to 231-1
GetActualVelocity
First data word
P1 read actual velocity (high-order part)
31 16
Second data word
P2 read actual velocity (low-order part)
15 0
1/2
16
counts/cycle
2
GetActualVelocity reads the value of the velocity for the specified axis. The actual velocity is derived by subtracting the actual position during the previous chip cycle from the actual position for this chip cycle. The result of this subtraction will always be integer because position is always integer. As a result the value returned by GetActualVelocity will always be a multiple of 65,536 since this represents a value of one in the 16.16 number format. The low word is always zero.
This value is the result of the last encoder input, so it will be accurate to within one cycle.
Scaling example: If a value of 1,703,936 is retrieved by the GetActualVelocity command (high word: 01Ah, low word: 0h) this corresponds to a velocity of 1,703,936/65,536 or 26 counts/cycle. See
“SNAP-SCM-MCH16 Conversion Formulas” on page 111.
Restrictions
OptoScript
Example
See Also
44
SNAP PAC Motion Control User’s Guide
The actual velocity is derived by subtracting the actual position during the previous chip cycle from the actual position for this chip cycle. The result of this subtraction will always be integer because position is always integer. As a result the value returned by GetActualVelocity will always be a multiple of 65,536 since this represents a value of one in the 16.16 number format. The low word is always zero.
Status=TransmitReceiveString (“>GetActualVelocity,3”,ComHandle,ResponseString)
GetCommandedVelocity (page 50)
Page 49

GetAutoStopMode

See “SetAutoStopMode, GetAutoStopMode” on page 71.

GetAxisMode

See “SetAxisMode, GetAxisMode” on page 72.

GetAxisOutSource

See “SetAxisOutSource, GetAxisOutSource” on page 73.
CHAPTER 5: COMMAND REFERENCE

GetBreakPoint

See “SetBreakPoint, GetBreakPoint” on page 75.

GetBreakPointValue

See “SetBreakPointValue, GetBreakPointValue” on page 77.

GetBufferLength

See “SetBufferLength, GetBufferLength” on page 79.
SNAP PAC Motion Control User’s Guide
45
45
Page 50
COMMANDS IN ALPHABETICAL ORDER

GetBufferReadIndex

See “SetBufferReadIndex, GetBufferReadIndex” on page 80.

GetBufferStart

See “SetBufferStart, GetBufferStart” on page 81.

GetBufferWriteIndex

See “SetBufferWriteIndex, GetBufferWriteIndex” on page 82.

GetCaptureSource

See “SetCaptureSource, GetCaptureSource” on page 83.
46
SNAP PAC Motion Control User’s Guide
Page 51

GetCaptureValue

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
Description
OptoScript
Example
GetCaptureValue, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
captured position signed 32 bits -231 to 231-1 unity counts
microsteps
GetCaptureValue
First data word
P1 read captured position (high-order part)
31 16
Second data word
P2 read captured position (low-order part)
15 0
GetCaptureValue returns the contents of the position capture register for the specified axis. This command also resets bit 9 of the activity status register; thus allowing another capture to occur.
If actual position units is set to steps, the returned position will be in units of steps.
Status=TransmitReceiveString (“>GetCaptureValue,4”,ComHandle,ResponseString)
See Also
SetCaptureSource, GetCaptureSource (page 83), SetActualPositionUnits, GetActualPositionUnits (page 70), GetActivityStatus (page 42)
SNAP PAC Motion Control User’s Guide
47
47
Page 52
COMMANDS IN ALPHABETICAL ORDER

GetCommandedAcceleration

Syntax
Arguments
Returned Data
Data Structure
Description
GetCommandedAcceleration, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
acceleration signed 32 bits -231 to 231-1
GetCommandedAcceleration
First data word
P1 read acceleration (high-order part)
31 16
Second data word
P2 read acceleration (low-order part)
15 0
1/2
16
counts/cycle microsteps/cycle
2
GetCommandedAcceleration returns the commanded acceleration value for the specified axis. Commanded acceleration is the instantaneous acceleration value output by the trajectory generator.
Scaling example: If a value of 114,688 is retrieved using this command then this corresponds to 114,688/ 65,536 = 1.750 counts/cycle2 acceleration value. See “SNAP-SCM-MCH16 Conversion
Formulas” on page 111.
OptoScript
Example
See Also
Status=TransmitReceiveString (“>GetCommandedAcceleration,5”,ComHandle,ResponseString)
GetCommandedPosition (page 49), GetCommandedVelocity (page 50)
48
SNAP PAC Motion Control User’s Guide
Page 53

GetCommandedPosition

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Data Structure
Description
OptoScript
Example
GetCommandedPosition, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
position signed 32 bits -231 to 231-1 unity counts
microsteps
GetCommandedPosition
First data word
P1 read position (high-order part)
31 16
Second data word
P2 read position (low-order part)
15 0
GetCommandedPosition returns the commanded position for the specified axis. Commanded position is the instantaneous position value output by the trajectory generator.
This command functions in all profile modes.
Status=TransmitReceiveString (“>GetCommandedPosition,6”,ComHandle,ResponseString)
See Also
GetCommandedAcceleration (page 48), GetCommandedVelocity (page 50)
SNAP PAC Motion Control User’s Guide
49
49
Page 54
COMMANDS IN ALPHABETICAL ORDER

GetCommandedVelocity

Syntax
Arguments
Returned Data
Data Structure
Description
GetCommandedVelocity, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
velocity signed 32 bits
GetCommandedVelocity
First data word
P1 read velocity (high-order part)
31 16
Second data word
P2 read velocity (low-order part)
15 0
-231 to 23
1
-1 1/2
16
counts/cycle microsteps/cycle
GetCommandedVelocity returns the commanded velocity value for the specified axis. Commanded velocity is the instantaneous velocity value output by the trajectory generator.
Scaling example: If a value of -1,234,567 is retrieved using this command (FFEDh in high word, 2979h in low word) then this corresponds to -1,234,567/65,536 = -18.8380 counts/cycle velocity value. See “SNAP-SCM-MCH16 Conversion Formulas” on page 111.
OptoScript
Example
See Also
Status=TransmitReceiveString (“>GetCommandedVelocity,7”,ComHandle,ResponseString)
GetCommandedAcceleration (page 48), GetCommandedPosition (page 49)
50
SNAP PAC Motion Control User’s Guide
Page 55

GetDeceleration

See “SetDeceleration, GetDeceleration” on page 84.

GetEncoderModulus

See “SetEncoderModulus, GetEncoderModulus” on page 85.

GetEncoderSource

See “SetEncoderSource, GetEncoderSource” on page 86.
CHAPTER 5: COMMAND REFERENCE

GetEncoderToStepRatio

See “SetEncoderToStepRatio, GetEncoderToStepRatio” on page 87.
SNAP PAC Motion Control User’s Guide
51
51
Page 56
COMMANDS IN ALPHABETICAL ORDER

GetEventStatus

Syntax
Arguments
Returned Data
Data Structure
Description
GetEventStatus, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type
status unsigned 16 bits see below
GetEventStatus
P1 read
15 14 13 12 11 10 8 7 6 5 4 3 2 1 0
Data
GetEventStatus reads the event register for the specified axis. All of the bits in this status word are set by the motion processor and cleared by the host. To clear these bits, use the ResetEventStatus command. The following table shows the encoding of the data returned by this command.
Name Bit(s) Description
Motion complete 0
Set to 1 when motion has completed. SetMotionCompleteMode determines if this bit is based on the trajectory generator position or the encoder position.
OptoScript
Example
See Also
Wrap-around 1
Breakpoint 1 2 Set to 1 when breakpoint 1 has been triggered.
Capture received 3 Set to 1 when a position capture has occurred.
Motion error 4 Set to 1 when a motion error has occurred.
In positive limit 5 Set to 1 when the axis has entered a positive limit switch.
In negative limit 6 Set to 1 when the axis has entered a negative limit switch.
Instruction error 7 Set to 1 when an instruction error has occurred.
reserved 8 - 10 8 - 10 Not used; may be 0 or 1.
Commutation error 11 Set to 1 when a commutation error has occurred.
reserved 12 - 13 12 - 13 Not used; may be 0 or 1.
Breakpoint 2 14 Set to 1 when breakpoint 2 has been triggered.
reserved 15 15 Not used; may be 0 or 1.
Status=TransmitReceiveString (“>GetEventStatus,8”,ComHandle,ResponseString)
Set to 1 when the actual (encoder) position has wrapped from maximum allowed position to minimum, or vice versa.
GetActivityStatus (page 42), GetSignalStatus (page 59)
52
SNAP PAC Motion Control User’s Guide
Page 57

GetGearMaster

See “SetGearMaster, GetGearMaster” on page 88.

GetGearRatio

See “SetGearRatio, GetGearRatio” on page 89.
CHAPTER 5: COMMAND REFERENCE
SNAP PAC Motion Control User’s Guide
53
53
Page 58
COMMANDS IN ALPHABETICAL ORDER

GetHostIOError

Syntax
Arguments
Returned Data
Name Type
Range
Packet
Structure
Description
GetHostIOError, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name
axis mask None 0
Instance Encoding
Axis0mask 1 Axis1mask 2 Axis2mask 4 Axis3mask 8
error unsigned 16 bits 0 - Eh
GetHostIOError
P1 read error
15 4 3 0
Data
GetHostIOError returns the code for the last host I/O error, and then resets the error to zero. Generally, this command is issued only after the instruction error bit in the event status register indicates there was an I/O error. It also resets the HostIOError bit in the I/O status read word to zero.
The error codes are encoded as defined below:
54
Error Code Encoding
No error 0
Processor Reset 1
Invalid instruction 2
Invalid axis 3
Invalid parameter 4
Trace running 5
reserved 6
Block out of bounds 7
Trace buffer zero 8
Bad serial checksum 9
reserved Ah
Invalid negative value Bh
Invalid parameter change Ch
SNAP PAC Motion Control User’s Guide
Page 59
Error Code Encoding
Invalid move after limit condition Dh
Invalid move into limit Eh
CHAPTER 5: COMMAND REFERENCE
OptoScript
Example
See also
Status=TransmitReceiveString (“>GetIOHostError,0”,ComHandle,ResponseString)
GetEventStatus (page 52)

GetInterruptAxis

Syntax
Arguments
Returned Data
GetInterruptAxis, axis
none
axis unsigned 8 bits 0 to 3 0
Name
axis mask None 0
Type Range Board Address
4 to 7 1 8 to B 2 C to F 3
Instance Encoding
Axis0mask 1 Axis1mask 2 Axis2mask 4 Axis3mask 8
Data Structure
Description
OptoScript
Example
See Also
GetInterruptAxis
P1 read
15 4 3 0
Data
0 axis mask
GetInterruptAxis returns a field which identifies all axes on the breakout board with pending interrupts. Axis numbers are assigned to the low-order four bits of the returned word; bits corresponding to interrupting axes are set to 1. If there are no pending interrupts, the returned word is 0. If any axis has a pending interrupt, the HostInterrupt signal will be in an active state.
Status=TransmitReceiveString (“>GetInterruptAxis,9”,ComHandle,ResponseString);
ClearInterrupt (page 40), SetInterruptMask, GetInterruptMask (page 91)
SNAP PAC Motion Control User’s Guide
55
55
Page 60
COMMANDS IN ALPHABETICAL ORDER

GetInterruptMask

See “SetInterruptMask, GetInterruptMask” on page 91.

GetJerk

See “SetJerk, GetJerk” on page 92.

GetLimitSwitchMode

See “SetLimitSwitchMode, GetLimitSwitchMode” on page 93.

GetMotionCompleteMode

See “SetMotionCompleteMode, GetMotionCompleteMode” on page 94.

GetMotorMode

See “SetMotorMode, GetMotorMode” on page 95.

GetPosition

See “SetPosition, GetPosition” on page 96.
56
SNAP PAC Motion Control User’s Guide
Page 61

GetPositionError

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Data Structure
Description
GetPositionError, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
velocity signed 32 bits -231 to 231-1 unity counts
microsteps
GetPositionError
First data word
P1 read position error (high-order part)
31 16
Second data word
P2 read position error (low-order part)
15 0
GetPositionError returns the position error of the specified axis. The error is the difference between the actual position (encoder position) and the commanded position (instantaneous output of the trajectory generator). When used with the motor type set to microstepping, or pulse and direction, the error is defined as the difference between the encoder position (represented in steps), and the commanded position (instantaneous output of the trajectory generator).
OptoScript
Example
See Also
Status=TransmitReceiveString (“>GetPositionError,9”,ComHandle,ResponseString)
SetPosition, GetPosition (page 96), SetPositionErrorLimit, GetPositionErrorLimit (page 97)

GetPositionErrorLimit

See “SetPositionErrorLimit, GetPositionErrorLimit” on page 97.

GetProfileMode

See “SetProfileMode, GetProfileMode” on page 98.
SNAP PAC Motion Control User’s Guide
57
57
Page 62
COMMANDS IN ALPHABETICAL ORDER

GetSampleTime

See “SetSampleTime, GetSampleTime” on page 99.

GetSettleTime

See “SetSettleTime, GetSettleTime” on page 100.

GetSettleWindow

See “SetSettleWindow, GetSettleWindow” on page 101.

GetSignalSense

See “SetSignalSense, GetSignalSense” on page 102.
58
SNAP PAC Motion Control User’s Guide
Page 63

GetSignalStatus

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Data Structure
Description
GetSignalStatus, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type
see below unsigned 16 bits
GetSignalStatus
First data word
P1 read status
15 0
GetSignalStatus returns the contents of the signal status register for the specified axis. The signal status register contains the value of the various hardware signals connected to each axis of the motion processor. The value read is combined with the signal sense register (see “SetSignalSense,
GetSignalSense” on page 102) and then returned to the user. For each bit in the Signal Sense register
that is set to 1, the corresponding bit in the GetSignalStatus command will be inverted. Therefore, a low signal will be read as 1, and a high signal will be read as a 0. Conversely, for each bit in the signal sense register that is set to 0, the corresponding bit in the GetSignalStatus command is not inverted. Therefore, a low signal will be read as 0, and a high signal will be read as a 1.
OptoScript
Example
All of the bits in the GetSignalStatus command are inputs, except for AxisOut. The value read for this bit is equal to the value output by the axis out mechanism. See “SetAxisOutSource,
GetAxisOutSource” on page 73 for more details. The bit definitions are as follows:
Description Bit Number
Encoder A 0
Encoder B 1
Encoder Index 2
Encoder Home 3
Positive limit 4
Negative limit 5
AxisIn 6
reserved 7–9
AxisOut 10
reserved 11–15
Status=TransmitReceiveString (“>GetSignalStatus,A”,ComHandle,ResponseString)
See Also
GetActivityStatus (page 42), GetEventStatus (page 52), SetSignalSense, GetSignalSense (page 102)
SNAP PAC Motion Control User’s Guide
59
59
Page 64
COMMANDS IN ALPHABETICAL ORDER

GetStartVelocity

See “SetStartVelocity, GetStartVelocity” on page 104.

GetStepRange

See “SetStepRange, GetStepRange” on page 105.

GetStopMode

See “SetStopMode, GetStopMode” on page 106.

GetTrackingWindow

See “SetTrackingWindow, GetTrackingWindow” on page 107.
60
SNAP PAC Motion Control User’s Guide
Page 65

GetTime

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Data Structure
Description
OptoScript
Example
GetTime, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
velocity signed 32 bits -231 to 231-1 unity counts
GetTime
First data word
P1 read time (high-order part)
31 16
Second data word
P2 read time (low-order part)
15 0
GetTime returns the number of cycles which have occurred since the motion processor was last reset.
Status=TransmitReceiveString (“>GetTime,B”,ComHandle,ResponseString)

GetVelocity

See “SetVelocity, GetVelocity” on page 108.
SNAP PAC Motion Control User’s Guide
61
61
Page 66
COMMANDS IN ALPHABETICAL ORDER

MultiUpdate

Syntax
Arguments
Returned data
Data Structure
Description
MultiUpdate, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Instance Encoding
mask None 0
Axis0mask 1 Axis1mask 2 Axis2mask 4 Axis3mask 8
none
MultiUpdate
P1 write
15 4 3 0
Data
0 mask
MultiUpdate causes an Update to occur on all axes whose corresponding bit is set to 1 in the mask argument. After this command is executed, and for those axes which are selected using the mask, all buffered data parameters are copied into the corresponding run-time registers. The following table shows the buffered commands and variables which are made active as a result of the Update command.
Type Command
General ClearPositionError
Acceleration Deceleration GearRatio
Trajectory
Servo
Motor MotorCommand
Jerk Position ProfileMode StopMode Vel ocity
DerivativeTime IntegrationLimit Kaff Kd Ki Kp Kvff
62
SNAP PAC Motion Control User’s Guide
Page 67
CHAPTER 5: COMMAND REFERENCE
OptoScript
Example
See Also

NoOperation

Syntax
Arguments
Returned Data
Description
Status=TransmitReceiveString (“>MultiUpdate,B,P1”,ComHandle,ResponseString)
Update (page 109)
NoOperation, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
none
The NoOperation command has no effect on the motion processor.
SNAP PAC Motion Control User’s Guide
63
63
Page 68
COMMANDS IN ALPHABETICAL ORDER

ReadBuffer

Syntax
Arguments
Returned Data
Data Structure
Description
ReadBuffer, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range
bufferID unsigned 16 bits -0 to 31
Name Type Range
data signed 32 bits -231 to 231-1
ReadBuffer
P1 write
15
P1 read data (high-order part)
31
P2 read data (high-order part)
15
First data word
0 bufferID
Second data word
Third data word
5
4
0
16
0
ReadBuffer returns the 32-bit contents of the location pointed to by the read buffer index in the specified buffer. After the contents have been read, the read index is incremented by 1; if the result is equal to the buffer length (set by SetBufferLength), the index is reset to 0. The read index is automatically changed at the completion of a trace when in rolling trace mode.
OptoScript
Example
See Also
64
Status=TransmitReceiveString (“>ReadBuffer,C,P1”,ComHandle,ResponseString)
SetBufferReadIndex, GetBufferReadIndex (page 80), WriteBuffer (page 110), SetBufferStart, GetBufferStart (page 81), SetBufferLength, GetBufferLength (page 79)
SNAP PAC Motion Control User’s Guide
Page 69

Reset

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Description
Reset, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
none
Reset restores the motion processor to its initial condition, setting all motion processor variables to their default values.
Variable Name Default Value Variable Name Default Value
StartVelocity 0 LimitSwitchMode 1
Acceleration 0 MotionCompleteMode 0
ActualPosition 0 MotorBias 0
ActualPositionUnits 0 MotorCommand 0
AutoStopMode 1 MotorLimit 32767
AuxilliaryEncoderSource 0 MotorMode 1
AxisMode 1 OutputMode -
AxisOutSource 0 PhaseAngle 0
BiQuadCoefficients 0 PhaseCorrectionMode -
Breakpoint 1 0 PhaseCounts -
Breakpoint 2 0 PhaseCounts 1
BreakpointValue 1 0 PhaseInitializeMode 0
BreakpointValue 2 0 PhaseInitializeTime 0
BufferLength 0 PhaseOffset 65535
BufferReadIndex 0 PhasePrescaleMode 0
BufferStart 0 Position 0
BufferWriteIndex 0 PositionErrorLimit 65535
CaptureSource 0 ProfileMode 0
CommutationMode - PWMFrequency (kHz) -
Deceleration 0 SampleTime see notes
DerivativeTime 1 SettleTime 0
EncoderModulus 0 SettleWindow 0
EncoderSource 3 SPIMode -
EncoderToStepRatio 00010001h StepRange 1*
EventStatus 1 StepRange see notes
GearMaster 0 StopMode 0
GearRatio 0 SynchronizationMode 0
GetSignalStatus 800 (hex) TraceMode 0
IntegrationLimit 0 TracePeriod 1
InterruptMask 0 TraceStart 0
Jerk 0 TraceStop 0
Kaff 0 TraceVariable 1 0
SNAP PAC Motion Control User’s Guide
65
65
Page 70
COMMANDS IN ALPHABETICAL ORDER
Variable Name Default Value Variable Name Default Value
Kd 0 TraceVariable 2 0
Ki 0 TraceVariable 3 0
Kout 65535 TraceVariable 4 0
Kp 0 TrackingWindow 0
Kvff 0 Velocity 0
*The SNAP-SCM-BB4 has a maximum step range of 100kHz which cannot changed.
Notes:
All axes supported by the motion processor are enabled at reset.
See “SetSampleTime, GetSampleTime” on page 99 for information regarding the default
sample time.
The typical time before the device is ready for communication after a Reset is 20ms.
The Reset command “axis” parameter selects the board to reset. Axes 0x00-0x03 will reset
board 0. Axes 0x04-0x07 will reset board 1. Axes 0x08-0x0B will reset board 2. Axes 0x0C-0x0F will reset board 3. No motion command directly addresses a SNAP-SCM-BB4 by board address. Instead the board address is determined by which axis the command is sent to. See the following examples.
Reset Board 0:
"Status=TransmitReceiveString (“>Reset,0”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,1”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,2”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,3”,ComHandle,ResponseString)"
Reset Board 1:
"Status=TransmitReceiveString (“>Reset,4”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,5”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,6”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,7”,ComHandle,ResponseString)"
Reset Board 2:
"Status=TransmitReceiveString (“>Reset,8”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,9”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,10”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,11”,ComHandle,ResponseString)"
Reset Board 3:
"Status=TransmitReceiveString (“>Reset,12”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,13”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,14”,ComHandle,ResponseString)"
"Status=TransmitReceiveString (“>Reset,15”,ComHandle,ResponseString)"
OptoScript
Example
66
Status=TransmitReceiveString (“>Reset,0”,ComHandle,ResponseString)
SNAP PAC Motion Control User’s Guide
Page 71

ResetEventStatus

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Returned Data
Packet
Structure
ResetEventStatus, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Instance Encoding
mask Motion Complete 0001h
Wrap-Around 0002h Breakpoint 1 0004h Capture Received 0008h Motion Error 0010h In positive limit 0020h In negative limit 0040h Instruction error 0080h Commutation error 0800h Breakpoint 2 4000h
none
ResetEventStatus
Data
P1 write mask
15 0
Description
OptoScript
Example
See Also
ResetEventStatus clears (sets to 0), for the specified axis, each bit in the event status register that has a value of 0 in the mask sent with this command. All other event status register bits (bits which have a mask value of 1) are unaffected.
Status=TransmitReceiveString (“>ResetEventStatus,D,P1”,ComHandle,ResponseString)
GetEventStatus (page 52)
SNAP PAC Motion Control User’s Guide
67
67
Page 72
COMMANDS IN ALPHABETICAL ORDER

SetAcceleration, GetAcceleration

buffered
Syntax
Arguments
Data Structure
SetAcceleration, axis, P1, P2 GetAcceleration, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
acceleration unsigned 32 bits
SetAcceleration
P1 write acceleration (high-order part)
31
P2 write acceleration (low-order part)
15
GetAcceleration
P1 read acceleration (high-order part)
31 16
P2 read acceleration (low-order part)
15 0
0 to 23
First data word
Second data word
First data word
Second data word
1
-1 1/2
16
counts/cycle
microsteps/cycle
2
2
16
0
Description
Restrictions
OptoScript
Example
68
SNAP PAC Motion Control User’s Guide
SetAcceleration loads the maximum acceleration buffer register for the specified axis. This command is used with the Trapezoidal, Velocity Contouring, and S-curve profiling modes.
GetAcceleration reads the maximum acceleration buffer register.
Scaling example: To load a value of 1.750 counts/cycle
2
multiply by 65,536 (giving 114,688) and load the resultant number as a 32-bit number, giving 0001 in the high word and C000h in the low word. See “SNAP-SCM-MCH16 Conversion Formulas” on page 111.
Values returned by GetAcceleration must correspondingly be divided by 65,536 to convert to units of counts/cycle
2
or steps/cycle2. See “SNAP-SCM-MCH16 Conversion Formulas” on page 111.
SetAcceleration may not be issued while an axis is in motion with the S-curve profile.
SetAcceleration is not valid in Electronic Gearing profile mode.
SetAcceleration is a buffered command. The value set using this command will not take effect until the next Update or MultiUpdate instruction.
Status=TransmitReceiveString (“>SetAcceleration,C,P1,P2”,ComHandle,ResponseString)
Page 73
Status=TransmitReceiveString (“>GetAcceleration,C”,ComHandle,ResponseString)
CHAPTER 5: COMMAND REFERENCE
See Also
SetDeceleration, GetDeceleration (page 84), SetJerk, GetJerk (page 92), SetPosition, GetPosition (page 96), SetVelocity, GetVelocity (page 108), MultiUpdate (page 62), Update (page 109)

SetActualPosition, GetActualPosition

Syntax
Arguments
Data Structure
SetActualPosition, axis, P1, P2 GetActualPosition, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
position signed 32 bits
SetActualPosition
P1 write position (high-order part)
P2 write position (low-order part)
31
15
4 to 7 1 8 to B 2 C to F 3
1
1
to 23
23
First data word
Second data word
-1
unity counts
microsteps
16
0
Description
GetActualPosition
First data word
P1 read position (high-order part)
P2 read position (high-order part)
31 16
Second data word
15 0
SetActualPosition loads the position register (encoder position) for the specified axis. At the same time, the commanded position is replaced by the loaded value minus the position error. This prevents a servo “bump” when the new axis position is established. The destination position (see
“SetPosition, GetPosition” on page 96) is also modified by this amount so that no trajectory motion
will occur when the update instruction is issued. In effect, this instruction establishes a new reference position from which subsequent positions can be calculated. It is commonly used to set a known reference position after a homing procedure.
For axes configured as Pulse & Direction or Microstepping motor types, ActualPositionUnits determines if the position is specified and returned in units of counts or steps. Additionally, for these motor types, the position error is zeroed when the SetActualPosition command is sent. SetActualPosition takes effect immediately, it is not buffered. GetActualPosition reads the contents of the encoder's actual position register. This value will be accurate to within one cycle (as determined by Set/GetSampleTime).
SNAP PAC Motion Control User’s Guide
69
69
Page 74
COMMANDS IN ALPHABETICAL ORDER
OptoScript
Example
See Also
Status=TransmitReceiveString (“>SetActualPosition,D,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetActualPosition,D”,ComHandle,ResponseString)
GetPositionError (page 57) SetActualPositionUnits, GetActualPositionUnits (page 70), AdjustActualPosition (page 39)

SetActualPositionUnits, GetActualPositionUnits

Syntax
Arguments
SetActualPositionUnits, axis, P1 GetActualPositionUnits, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Data Structure
Description
OptoScript
Example
See Also
Name Instance Encoding
mode Counts 0
Steps 1
SetActualPositionUnits
P1 write
15
GetActualPositionUnits
P1 read
15
Data
0 mode
10
Data
0 mode
10
SetActualPositionUnits determines the units used by the Set/GetActualPosition, AdjustActualPosition and GetCaptureValue for the specified axis. When set to Counts, position units are in encoder counts. When set to Steps, position units are in steps. The step position is calculated using the ratio as set by the SetEncoderToStepRatio command.
GetActualPositionUnits returns the position units for the specified axis.
Status=TransmitReceiveString (“>SetActualPositionUnits,E,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetActualPositionUnits,E”,ComHandle,ResponseString)
SetActualPosition, GetActualPosition (page 69), SetEncoderToStepRatio, GetEncoderToStepRatio (page 87), AdjustActualPosition (page 39), GetCaptureValue (page 47)
70
SNAP PAC Motion Control User’s Guide
Page 75

SetAutoStopMode, GetAutoStopMode

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
Description
SetAutoStopMode, axis, P1 GetAutoStopMode, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Instance Encoding
mode Disable 0
Enable 1
SetAutoStopMode
P1 write
15
GetAutoStopMode
P1 read
15
Data
0 mode
10
Data
0 mode
10
SetAutoStopMode determines the behavior of the specified axis when a motion error occurs. When auto stop is enabled (SetAutoStopMode Enable), the axis goes into open-loop mode when a motion error occurs. When Auto-Stop is disabled (SetAutoStopMode Disable), the axis is not affected by a motion error.
Restrictions
OptoScript
Example
See Also
GetAutoStopMode returns the state of the Auto-Stop mode.
When the encoder source is set to none (SetEncoderSource None), setting the auto stop mode to Enable will not stop motion in the event that the position error limit is exceeded.
Status=TransmitReceiveString (“>SetAutoStopMode,F,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetAutoStopMode,F”,ComHandle,ResponseString)
GetEventStatus (page 52), SetPositionErrorLimit, GetPositionErrorLimit (page 97)
SNAP PAC Motion Control User’s Guide
71
71
Page 76
COMMANDS IN ALPHABETICAL ORDER

SetAxisMode, GetAxisMode

Syntax
Arguments
Data Structure
Description
SetAxisMode, axis, P1 GetAxisMode, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Instance Encoding
mode Off 0
On 1
SetAxisMode
P1 write
15
GetAxisMode
P1 read
15
Data
0 mode
10
Data
0 mode
10
SetAxisMode enables (On) or disables (Off ) the specified axis. A disabled axis will not respond to profile or other motion commands.
GetAxisMode returns the mode of the specified axis.
Restrictions
OptoScript
Example
72
SNAP PAC Motion Control User’s Guide
Disabled axes do not provide encoder feedback. If it is desired that an axis provide encoder feedback even though no profiling or servo control is to be used, the axis must be left enabled.
Status=TransmitReceiveString (“>SetAxisMode,0,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetAxisMode,0”,ComHandle,ResponseString)
Page 77

SetAxisOutSource, GetAxisOutSource

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetAxisOutSource, axis, P1 GetAxisOutSource, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
NOTE: The source axis must be on the same SNAP-SCM-BB4 as the axis argument.
Name Type Range Board Address
sourceAxis unsigned 8 bits 0 to 3 0
Name Instance Encoding
bit see below 0 to 15
register Disabled 0
EventStatus 1 ActivityStatus 2 SignalStatus 3
SetAxisMode
P1 write
15
0 register bit source axis
4 to 7 1 8 to B 2 C to F 3
12
11
Data
8
7
4
3
0
Description
GetAxisMode
P1 read
15
0 register bit source axis
12
11
Data
8
7
4
3
0
SetAxisOutSource maps the specified bit of the specified status register of axis to the AxisOut pin for the specified axis. The state of the AxisOut pin will thereafter track the state of bit. If register is absent (encoding of 0), bit is ignored, and the specified AxisOut pin is, in effect, turned off (inactive). When the AxisOutSource is set to disabled, the AxisOut signal can be set high or low using SetSignalSense bit 10.
GetAxisOutSource returns the mapping of the AxisOut pin of axis.
The following table shows the corresponding value for combinations of bit and register.
bit event status register activity status register signal status register
0 Motion complete Phasing initialized Encoder A
1 Wrap-around At maximum velocity Encoder B
2 Breakpoint 1 Tracking Encoder index
SNAP PAC Motion Control User’s Guide
73
73
Page 78
COMMANDS IN ALPHABETICAL ORDER
bit event status register activity status register signal status register
3 Position capture Home
4 Motion error Positive limit
5 In positive limit Negative limit
6 In negative limit AxisIn
7 Instruction error Axis settled Hall sensor 1
8 Motor on/off Hall sensor 2
9 Position capture Hall sensor 3
0Ah In motion
0Bh Commutation error In positive limit
0Ch In negative limit
0Dh
0Eh Breakpoint 2
0Fh
OptoScript
Example
See Also
Status=TransmitReceiveString (“>SetAxisOutSource,1,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetAxisOutSource,1”,ComHandle,ResponseString)
SetSignalSense, GetSignalSense (page 102)
74
SNAP PAC Motion Control User’s Guide
Page 79

SetBreakPoint, GetBreakPoint

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
SetBreakPoint, axis, P1, P2 GetBreakPoint, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
NOTE: The source axis must be on the same SNAP-SCM-BB4 as the axis argument.
Name Instance Encoding
breakpointID Breakpoint1 0
Breakpoint2 1
sourceAxis Axis0 0
action (none) 0
trigger (none) 0
Data Structure
SetBreakPoint
P1 write
Axis1 1 Axis2 2 Axis3 3
Update 1 AbruptStop 2 SmoothStop 3 MotorOff 4
GreaterOrEqualCommandedPosition 1 LesserOrEqualCommandedPosition 2 GreaterOrEqualActualPosition 3 LesserOrEqualActualPosition 4 CommandedPositionCrossed 5 ActualPositionCrossed 6 Time 7 EventStatus 8 ActivityStatus 9 SignalStatus Ah
First data word
0 breakpointID
15
1
0
P2 write trigger action source Axis
15
GetBreakPoint
P1 write
15
P1 read trigger action source Axis
15
12
12
Second data word
11
First data word
0 breakpointID
Second data word
11
8
7
8
7
4
3
1
4
3
SNAP PAC Motion Control User’s Guide
0
0
0
75
75
Page 80
COMMANDS IN ALPHABETICAL ORDER
Description
SetBreakPoint establishes a breakpoint for the specified axis to be triggered by a condition or event on sourceAxis, which may be the same as or different from axis. Up to two concurrent breakpoints can be set for each axis, each of which may have its own breakpoint type and comparison value. The breakpointID field specifies which breakpoint the SetBreakPoint and GetBreakPoint commands will address.
The six Position breakpoints and the Time breakpoint are threshold-triggered; the breakpoint occurs when the indicated value reaches or crosses a threshold. The Status breakpoints are level-triggered; the breakpoint occurs when a specific bit or combination of bits in the indicated status register changes state. Thresholds and bit specifications are both set by the SetBreakPointValue instruction.
action determines what the motion processor does when the breakpoint occurs, as follows:
Action Resultant command sequence
None No action
Update Update axis
AbruptStop The profile executes an abrupt stop
SmoothStop The profile executes a smooth stop
MotorOff SetMotorMode axis, Off
GetBreakPoint returns the trigger, action, and axis for the specified breakpoint (0 or 1) of the indicated axis. When a breakpoint occurs, the trigger value will be reset to none. The CommandedPositionCrossed and the ActualPositionCrossed triggers are converted to one of the Position trigger types 1-4; depending on the current position when the command is issued.
Restrictions
OptoScript
Example
See Also
Always load the breakpoint comparison value (SetBreakPointValue command) before setting a new breakpoint condition (SetBreakPoint command). Failure to do so will likely result in unexpected behavior.
Status=TransmitReceiveString (“>SetBreakPoint,2,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBreakPoint,2,P1”,ComHandle,ResponseString)
SetBreakPointValue, GetBreakPointValue (page 77)
76
SNAP PAC Motion Control User’s Guide
Page 81

SetBreakPointValue, GetBreakPointValue

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetBreakPointValue, axis, P1, P2, P3 GetBreakPointValue, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
breakpointID Breakpoint 1 0
Breakpoint 2 1
value see below
SetBreakPointValue
P1 write
15
P1 write value (high-order part)
31
P32write value (low-order part)
15
4 to 7 1 8 to B 2 C to F 3
First data word
0 breakpointID
Second data word
Third data word
1
0
16
0
Description
GetBreakPointValue
P1 write
15
P2 read value (high-order part)
31
P3 read value (low-order part)
15
First data word
0 breakpointID
Second data word
Third data word
1
0
16
0
SetBreakPointValue sets the breakpoint comparison value for the specified axis. For the position and time breakpoints, this is a threshold comparison value.
The value parameter is interpreted according to the trigger condition for the selected breakpoint; see “SetBreakPoint, GetBreakPoint” on page 75. The data format for each trigger condition is as follows:
Breakpoint Trigger Value Type Range Units
31
GreaterOrEqualCommandedPosition signed 32-bit
-2
to 2
31
-1
counts
SNAP PAC Motion Control User’s Guide
77
77
Page 82
COMMANDS IN ALPHABETICAL ORDER
Breakpoint Trigger Value Type Range Units
LesserOrEqualCommandedPosition signed 32-bit
GreaterOrEqualActualPosition signed 32-bit
LesserOrEqualActualPosition signed 32-bit
CommandedPositionCrossed signed 32-bit
ActualPositionCrossed signed 32-bit
-2
-2
-2
-2
-2
31
31
31
31
31
to 2
to 2
to 2
to 2
to 2
31
31
31
31
31
-1
-1
-1
-1
-1
counts
counts
counts
counts
counts
Restrictions
Time unsigned 32-bit
EventStatus 2 word mask - boolean status values
ActivityStatus 2 word mask - boolean status values
SignalStatus 2 word mask - boolean status values
0 to 231-1
cycles
For level-triggered breakpoints, the high-order part of value is the selection mask, and the low-order word is the sense mask. For each selection bit that is set to 1, the corresponding bit of the specified status register is conditioned to cause a breakpoint when it changes state. The sense-mask bit determines which state causes the break. If it is 1, the corresponding status-register bit will cause a break when it is set to 1. If it is 0, the status-register bit will cause a break when it is set to 0.
For example assume it is desired that the breakpoint type will be set to EventStatus and that a breakpoint should be recognized whenever the motion complete bit (bit 0 of event status register) is set to 1, or the commutation error bit (bit 11 of event status register) is set to 0. In this situation the high and low words for value would be high word: 0x801 (hex) and low word: 1.
GetBreakPointValue returns the breakpoint value for the specified breakpointID.
Two completely separate breakpoints are supported, each of which may have its own breakpoint type and comparison value. The breakpointID field specifies which breakpoint the SetBreakPointValue and GetBreakPointValue commands will address.
Always load the breakpoint comparison value (SetBreakPointValue command) before setting a new breakpoint condition (SetBreakPoint command). Failure to do so will likely result in unexpected behavior.
OptoScript
Example
See Also
78
Status=TransmitReceiveString (“>SetBreakPointValue,3,P1,P2,P3”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBreakPointValue,3,P1”,ComHandle,ResponseString)
SetBreakPoint, GetBreakPoint (page 75)
SNAP PAC Motion Control User’s Guide
Page 83

SetBufferLength, GetBufferLength

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetBufferLength, axis, P1, P2, P3 GetBufferLength, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range
bufferID unsigned 16 bits 0 to 31
length unsigned 32 bits 1 to 230 - 1
SetBufferLength
P1 write
15
P2 write length (high-order part)
31
P3 write length (low-order part)
15
4 to 7 1 8 to B 2 C to F 3
First data word
0 bufferID
Second data word
Third data word
5
40
16
0
Description
OptoScript
Example
See Also
GetBufferLength
P1 write
15
P1 read length (high-order part)
31
P2 read length (low-order part)
15
First data word
0 bufferID
Second data word
Third data word
5
40
16
0
SetBufferLength sets the length, in number of 32-bit elements, of the buffer in the memory block identified by bufferID.
NOTE: SetBufferLength resets the buffers read and write indexes to 0.
GetBufferLength returns the length of the specified buffer.
Status=TransmitReceiveString (“>SetBufferLength,4,P1,P2,P3”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBufferLength,4,P1”,ComHandle,ResponseString)
SetBufferReadIndex, GetBufferReadIndex (page 80), SetBufferStart, GetBufferStart (page 81), SetBufferWriteIndex, GetBufferWriteIndex (page 82)
SNAP PAC Motion Control User’s Guide
79
79
Page 84
COMMANDS IN ALPHABETICAL ORDER

SetBufferReadIndex, GetBufferReadIndex

Syntax
Arguments
Data Structure
SetBufferReadIndex, axis, P1, P2, P3 GetBufferReadIndex, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
bufferID unsigned 16 bits 0 to 31 unity - index unsigned 32 bits 0 to buffer unity double words
SetBufferReadIndex
P1 write
15
P2 write length (high-order part)
31
P3 write length (low-order part)
15
4 to 7 1 8 to B 2 C to F 3
length - 1
First data word
0 bufferID
Second data word
Third data word
5
40
16
0
Description
Restrictions
OptoScript
Example
See Also
GetBufferReadIndex
P1 write
15
P1 read length (high-order part)
31
P2 read length (low-order part)
15
First data word
0 bufferID
Second data word
Third data word
5
40
16
0
SetBufferReadIndex sets the address of the read index for the specified bufferID.
GetBufferReadIndex returns the current read index for the specified bufferID.
If the read index is set to an address beyond the length of the buffer, the command will not be executed and will return host I/O error code 7, buffer bound exceeded.
Status=TransmitReceiveString (“>SetBufferReadIndex,5,P1,P2,P3”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBufferReadIndex,5,P1”,ComHandle,ResponseString)
SetBufferLength, GetBufferLength (page 79), SetBufferStart, GetBufferStart (page 81), SetBufferWriteIndex, GetBufferWriteIndex (page 82)
80
SNAP PAC Motion Control User’s Guide
Page 85

SetBufferStart, GetBufferStart

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetBufferStart, axis, P1, P2, P3 GetBufferStart, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
bufferID unsigned 16 bits 0 to 31 unity - address unsigned 32 bits
SetBufferStart
P1 write
15
P2 write address (high-order part)
31
P3 write address (low-order part)
15
4 to 7 1 8 to B 2 C to F 3
31
0 to 2
First data word
0 bufferID
Second data word
Third data word
unity double words
- 1
5
40
16
0
Description
OptoScript
Example
See Also
GetBufferStart
P1 write
15
P1 read address (high-order part)
31
P2 read address (low-order part)
15
First data word
0 bufferID
Second data word
Third data word
5
40
16
0
SetBufferStart sets the starting address for the specified buffer, in double-words, of the buffer in the memory block identified by bufferID.
NOTE: SetBufferStart resets the buffers read and write indexes to 0.
GetBufferStart returns the starting address for the specified bufferID.
Status=TransmitReceiveString (“>SetBufferStart,6,P1,P2,P3”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBufferStart,6,P1”,ComHandle,ResponseString)
SetBufferLength, GetBufferLength (page 79), SetBufferReadIndex, GetBufferReadIndex (page 80), SetBufferWriteIndex, GetBufferWriteIndex (page 82)
SNAP PAC Motion Control User’s Guide
81
81
Page 86
COMMANDS IN ALPHABETICAL ORDER

SetBufferWriteIndex, GetBufferWriteIndex

Syntax
Arguments
Description
Data Structure
SetBufferWriteIndex, axis, P1, P2, P3 GetBufferWriteIndex, axis, P1
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
bufferID unsigned 16 bits 0 to 31 unity - index unsigned 32 bits 0 to buffer unity double words
4 to 7 1 8 to B 2 C to F 3
length - 1
SetBufferWriteIndex sets the write index for the specified bufferID.
GetBufferWriteIndex returns the write index for the specified bufferID.
SetBufferWriteIndex
P1 write
15
P2 write index (high-order part)
31
First data word
0 bufferID
4
Second data word
30
16
OptoScript
Example
See Also
P3 write index (low-order part)
15
GetBufferWriteIndex
P1 write
15
P1 read index (high-order part)
31
P2 read index (low-order part)
15
Status=TransmitReceiveString (“>SetBufferWriteIndex,7,P1,P2,P3”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetBufferWriteIndex,7,P1”,ComHandle,ResponseString)
Third data word
First data word
0 bufferID
4
Second data word
Third data word
0
30
16
0
SetBufferLength, GetBufferLength (page 79), SetBufferReadIndex, GetBufferReadIndex (page 80), SetBufferStart, GetBufferStart (page 81)
82
SNAP PAC Motion Control User’s Guide
Page 87

SetCaptureSource, GetCaptureSource

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
Description
SetCaptureSource, axis, P1 GetCaptureSource, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
source Index 0
Home 1
SetCaptureSource
P1 write
15
GetCaptureSource
P1 read
15
4 to 7 1 8 to B 2 C to F 3
Data
0 source
Data
0 source
1
0
1
0
SetCaptureSource determines which of two encoder signals, Index or Home, is used to trigger the high-speed capture of the actual axis position for the specified axis.
GetCaptureSource returns the capture signal source for the selected axis.
OptoScript
Example
See Also
Status=TransmitReceiveString (“>SetCaptureSource,2,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetCaptureSource,2”,ComHandle,ResponseString)
GetCaptureValue (page 47)
SNAP PAC Motion Control User’s Guide
83
83
Page 88
COMMANDS IN ALPHABETICAL ORDER

SetDeceleration, GetDeceleration

buffered
Syntax
Arguments
Data Structure
SetDeceleration, axis, P1, P2 GetDeceleration, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
deceleration unsigned 32 bits
SetDeceleration
P1 write deceleration (high-order part)
31
P2 write deceleration (low-order part)
31
GetDeceleration
P1 read deceleration (high-order part)
31
0 to 2
First data word
Second data word
First data word
31
-1 1/2
16
counts/cycle
microsteps/cycle
2
2
16
0
16
Description
Restrictions
84
SNAP PAC Motion Control User’s Guide
P2 read deceleration (low-order part)
31
Second data word
0
SetDeceleration loads the maximum deceleration buffer register for the specified axis.
GetDeceleration returns the value of the maximum deceleration buffer.
Scaling example: To load a value of 1.750 counts/cycle2 multiply by 65,536 (giving 114,688) and load the resultant number as a 32-bit number, giving 0001 in the high word and C000h in the low word. Retrieved numbers (GetDeceleration) must correspondingly be divided by 65,536 to convert to units of counts/cycle
2
or steps/cycle2 . See “SNAP-SCM-MCH16 Conversion Formulas” on
page 111.
This is a buffered command. The new value set will not take effect until the next Update or MultiUpdate instruction is entered.
These commands are used with the Trapezoidal and Velocity Contouring profile modes. They are not used with the Electronic Gearing or S-curve profile mode.
NOTE: If deceleration is set to zero, then the value specified for acceleration (SetAcceleration) will automatically be used to set the magnitude of deceleration.
Page 89
CHAPTER 5: COMMAND REFERENCE
OptoScript
Example
See Also
Status=TransmitReceiveString (“>SetDeceleration,5,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetDeceleration,5”,ComHandle,ResponseString)
SetAcceleration, GetAcceleration (page 68), SetPosition, GetPosition (page 96), SetVelocity, GetVelocity (page 108), MultiUpdate (page 62), Update (page 109)

SetEncoderModulus, GetEncoderModulus

Syntax
Arguments
SetEncoderModulus, axis, P1
GetEncoderModulus, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
modulus unsigned 16bits
4 to 7 1 8 to B 2 C to F 3
16
-1
0 to 2
unity counts
Data Structure
Description
Restrictions
OptoScript
Example
See Also
SetEncoderModulus
P1 write modulus
15
GetEncoderModulus
P1 read modulus
15
Data
0
Data
0
SetEncoderModulus sets the parallel word range for the specified axis when parallel-word feedback is used. Modulus determines the range of the connected device. For multi-turn systems, this value is used to determine when a position wrap condition has occurred. The value provided should be one half of the actual range of the axis. For example if the parallel-word input is used with a linear potentiometer connected to an external A/D (Analog to Digital converter) which has 12 bits of resolution, then the total range is 4,096 and a value of 2,048 should be loaded with this command.
GetEncoderModulus returns the encoder modulus.
A value for encoder modulus is only required when the encoder source is set to parallel.
Status=TransmitReceiveString (“>SetEncoderModulus,5,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetEncoderModulus,5”,ComHandle,ResponseString)
SetEncoderSource, GetEncoderSource (page 86)
SNAP PAC Motion Control User’s Guide
85
85
Page 90
COMMANDS IN ALPHABETICAL ORDER

SetEncoderSource, GetEncoderSource

Syntax
Arguments
Data Structure
Description
SetEncoderSource, axis, P1 GetEncoderSource, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
source Incremental 0
reserved 1 None 3 Loopback 4
SetEncoderSource
P1 write
15
GetEncoderSource
P1 read
15
4 to 7 1 8 to B 2 C to F 3
Data
0 source
Data
0 source
2
2
0
1
0
1
SetEncoderSource sets the type of feedback (Incremental, None, or Loopback) for the specified axis. When incremental is selected the motion processor expects A and B quadrature signals to be input at the quad A/B axis inputs. When Loopback is selected, the step output is internally fed back into the quad counters. This allows for position capture of the step position when a physical encoder is not present.
OptoScript
Example
86
GetEncoderSource returns the code for the current type of feedback.
Status=TransmitReceiveString (“>SetEncoderSource,7,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetEncoderSource,7”,ComHandle,ResponseString)
SNAP PAC Motion Control User’s Guide
Page 91

SetEncoderToStepRatio, GetEncoderToStepRatio

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetEncoderToStepRatio, axis, P1, P2 GetEncoderToStepRatio, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Type Range Scaling Units
counts unsigned 16 bits steps unsigned 16 bits
SetEncoderToStepRatio
P1 write counts
15
P2 write steps
15
GetEncoderToStepRatio
P1 read counts
15
4 to 7 1 8 to B 2 C to F 3
15
-1
0 to 2
15
-1
0 to 2
First data word
Second data word
First data word
unity counts
unity microsteps
0
0
0
Description
OptoScript
Example
See Also
P2 read steps
15
Second data word
0
SetEncoderToStepRatio sets the ratio of the number of encoder counts to the number of output steps per motor rotation used by the motion processor to convert encoder counts into steps. Counts is the number of encoder counts per full rotation of the motor. Steps is the number of steps output by the motion processor per full rotation of the motor. Since this command sets a ratio, the parameters do not have to be for a full rotation as long as they correctly represent the encoder count to step ratio.
GetEncoderToStepRatio returns the ratio of the number of encoder counts to the number of output steps per motor rotation.
Status=TransmitReceiveString (“>SetEncoderToStepRatio,8,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetEncoderToStepRatio,8”,ComHandle,ResponseString)
SetActualPositionUnits, GetActualPositionUnits (page 70)
SNAP PAC Motion Control User’s Guide
87
87
Page 92
COMMANDS IN ALPHABETICAL ORDER

SetGearMaster, GetGearMaster

Syntax
Arguments
Data Structure
SetGearMaster, axis, P1 GetGearMaster, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
NOTE: The master axis must be on the same SNAP-SCM-BB4 as the axis argument.
Name Type Range
masterAxis unsigned 8 bits 0
1 2 3
Name Instance Encoding
source Actual 0
Commanded 1
SetGearMaster
P1 write
15
0 source masterAxis
Data
9
87
0
Description
OptoScript
Example
See Also
GetGearMaster
P1 read
15
0 source masterAxis
Data
9
87
0
SetGearMaster establishes the slave (axis) and master (masterAxis) axes for the electronic-gearing profile, and sets the source, Actual or Commanded, of the master axis position data to be used.
The masterAxis determines the axis that will drive the slave axis. Both the slave and the master axes must be enabled (SetAxisMode command). The source determines whether the master axis' commanded position as determined by the trajectory generator will be used to drive the slave axis, or whether the master axis' encoder position will be used to drive the slave.
GetGearMaster returns the value for the geared axes and position source.
Status=TransmitReceiveString (“>SetGearMaster,A,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetGearMaster,A”,ComHandle,ResponseString)
SetGearRatio, GetGearRatio (page 89)
88
SNAP PAC Motion Control User’s Guide
Page 93

SetGearRatio, GetGearRatio

CHAPTER 5: COMMAND REFERENCE
buffered
Syntax
Arguments
Data Structure
SetGearRatio, slaveAxis, P1, P2 GetGearRatio, slaveAxis
Type Range Board Address
slaveaxis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
31
ratio signed 32 bits
SetGearRatio
P1 write ratio (high-order part)
31
P2 write ratio (low-order part)
15
GetGearRatio
P1 read ratio (high-order part)
31
31
to 2
-2
First data word
Second data word
First data word
-1 1/2
16
SlaveCts/MasterCts
16
0
16
Description
Restrictions
P2 read ratio (low-order part)
15
Second data word
0
SetGearRatio sets the ratio between the master and slave axes for the electronic gearing profile for the current axis. Positive ratios cause the slave to move in the same direction as the master, negative ratios in the opposite direction. The specified ratio has a unity scaling of 65,536.
GetGearRatio returns the gear ratio set for the specified slave axis.
Scaling examples:
Ratio Value Resultant Ratio
-32,768 .5 negative slave counts for each positive master count
1,000,000 15.259 positive slave counts for each positive master count
123 .0018 positive slave counts for each positive master count
This is a buffered command. The new value set will not take effect until the next Update or MultiUpdate instruction is entered.
SNAP PAC Motion Control User’s Guide
89
89
Page 94
COMMANDS IN ALPHABETICAL ORDER
OptoScript
Example
See Also
Status=TransmitReceiveString (“>SetGearRatio,B,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetGearRatio,B”,ComHandle,ResponseString)
SetGearMaster, GetGearMaster (page 88), MultiUpdate (page 62), Update (page 109)
90
SNAP PAC Motion Control User’s Guide
Page 95

SetInterruptMask, GetInterruptMask

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
SetInterruptMask, axis, P1 GetInterruptMask, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Instance Encoding
mask Motion complete 0001h
Wrap-around 0002h Breakpoint 1 0004h Capture received 0008h Motion error 0010h In positive limit 0020h In negative limit 0040h Instruction error 0080h Commutation error 0800h Breakpoint 2 4000h
SetInterruptMask
Data
P1 write mask
15
GetInterruptMask
Data
P1 read mask
15
0
0
Description
OptoScript
Example
See Also
SetInterruptMask determines which bits in the event status register of the specified axis will cause a host interrupt. For each interrupt mask bit that is set to 1, the corresponding event status register bit will cause an interrupt when that status register bit goes active (is set to 1). Interrupt mask bits set to 0 will not generate interrupts.
GetInterruptMask returns the mask for the specified axis.
Example: The interrupt mask value 28h will generate an interrupt when either the “in positive limit” bit or the “capture received” bit of the event status register goes active (set to 1).
Status=TransmitReceiveString (“>SetInterruptMask,C,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetInterruptMask,C”,ComHandle,ResponseString)
ClearInterrupt (page 40), GetInterruptAxis (page 55)
SNAP PAC Motion Control User’s Guide
91
91
Page 96
COMMANDS IN ALPHABETICAL ORDER

SetJerk, GetJerk

buffered
Syntax
Arguments
Data Structure
SetJerk, axis, P1, P2 GetJerk, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
jerk unsigned 32 bits
SetJerk
P1 write jerk (high-order part)
31
P2 write jerk (low-order part)
15
GetJerk
P1 read jerk (high-order part)
31
31
-1 1/2
0 to 2
First data word
Second data word
First data word
32
counts/cycle
microsteps/cycle
3
3
16
0
16
Description
Restrictions
OptoScript
Example
92
SNAP PAC Motion Control User’s Guide
P2 read jerk (low-order part)
15
Second data word
0
SetJerk loads the jerk register in the parameter buffer for the specified axis.
GetJerk reads the contents of the Jerk register. Scaling example: To load a jerk value (rate of change of acceleration) of 0.012345 counts/cycle3 (or steps/cycle3) multiply by 232 or 4,294,967,296. In this example this gives a value to load of 53,021,371 (decimal) which corresponds to a high word of 0329h and a low word of 0ABBh when loading each word in hexadecimal. See “SNAP-SCM-MCH16 Conversion Formulas” on page 111.
SetJerk is a buffered command. The value set using this command will not take effect until the next Update or MultiUpdate instruction.
This command is used only with the S-curve profile mode. It is not used with the trapezoidal, velocity contouring, or electronic gear profile modes.
Status=TransmitReceiveString (“>SetJerk,D,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetJerk,D”,ComHandle,ResponseString)
Page 97
CHAPTER 5: COMMAND REFERENCE
See Also
SetAcceleration, GetAcceleration (page 68), SetDeceleration, GetDeceleration (page 84), SetPosition, GetPosition (page 96), SetVelocity, GetVelocity (page 108), MultiUpdate (page 62), Update (page 109)

SetLimitSwitchMode, GetLimitSwitchMode

Syntax
Arguments
SetLimitSwitchMode, axis, P1 GetLimitSwitchMode, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
mode Off 0
On 1
4 to 7 1 8 to B 2 C to F 3
Data Structure
Description
OptoScript
Example
See Also
SetLimitSwitchMode
P1 write
15
GetLimitSwitchMode
P1 read
15
Data
0mode
Data
0mode
1
0
1
0
SetLimitSwitchMode enables (On) or disables (Off) limit-switch sensing for the specified axis. When the mode is enabled, the axis will cause the corresponding limit-switch bits in the event status register and activity status register to be set when it enters either the positive or negative limit switches and the axis will be brought to an abrupt stop. When it is disabled, the status bits are not set, and the axis is not stopped, regardless of whether or not the axis is in a limit switch.
GetLimitSwitchMode returns the value for the state of the limit-sensing mode.
Status=TransmitReceiveString (“>SetLimitSwitchMode,1,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetLimitSwitchMode,1”,ComHandle,ResponseString)
GetActivityStatus (page 42), GetEventStatus (page 52)
SNAP PAC Motion Control User’s Guide
93
93
Page 98
COMMANDS IN ALPHABETICAL ORDER

SetMotionCompleteMode, GetMotionCompleteMode

Syntax
Arguments
Data Structure
Description
SetMotionCompleteMode, axis, P1 GetMotionCompleteMode, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
mode commanded 0
actual 1
SetMotionCompleteMode
P1 write
15
GetMotionCompleteMode
P1 read
15
4 to 7 1 8 to B 2 C to F 3
Data
0mode
Data
0mode
1
0
1
0
SetMotionCompleteMode establishes the source for the comparison which determines the motion complete status for the specified axis. When set to commanded mode the motion is considered complete when the profile velocity reaches zero and no further motion will occur without an additional host command. This mode is unaffected by the actual encoder location.
When set to actual mode the motion complete bit will be set when the above condition is true, and when the actual encoder position has been within the settle window (SetSettleWindow command) for the number of cycles specified by the SetSettleTime command. The settle timer is started at zero at the end of the trajectory profile motion, so at a minimum a delay of SettleTime cycles will occur after the trajectory profile motion is complete.
OptoScript
Example
See Also
94
GetMotionCompleteMode returns the value for the motion-complete mode.
Status=TransmitReceiveString (“>SetMotionCompleteMode,2,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetMotionCompleteMode,2”,ComHandle,ResponseString)
SetSettleTime, GetSettleTime (page 100), SetSettleWindow, GetSettleWindow (page 101)
SNAP PAC Motion Control User’s Guide
Page 99

SetMotorMode, GetMotorMode

CHAPTER 5: COMMAND REFERENCE
Syntax
Arguments
Data Structure
Description
SetMotorMode, axis, P1 GetMotorMode, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
Name Instance Encoding
mode Off 0
On 1
SetMotorMode
P1 write
15
GetMotorMode
P1 read
15
4 to 7 1 8 to B 2 C to F 3
Data
0mode
Data
0mode
1
0
1
0
SetMotorMode determines the mode of motor operation. When set to On, several events take place. For step motor and microstepping axes, the trajectory generator controls the motor output. For all motor types, when the encoder source (Set/GetEncoderSource) is set to incremental or parallel, the position error is cleared; equivalent to a ClearPositionError command.
When the motor mode is set to Off, the axis is in open-loop mode, and is controlled by commands placed directly into the motor output register by the host. Setting the motor mode to Off also resets the trajectory generator, bringing any active motion to an abrupt stop. In addition, the maximum velocity (Set/GetVelocity) is set to zero. On axes configured for step motor and microstepping motor types, the step generator is switched off when the motor mode is set to Off. The following table shows the motor output source for each motor type and mode.
OptoScript
Example
See Also
Motor type Motor mode Motor output source
Pulse & direction; Off N/A
microstepping On Trajectory generator
GetMotorMode returns the value of the motor mode.
Status=TransmitReceiveString (“>SetMotorMode,3,P1”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetMotorMode,3”,ComHandle,ResponseString)
GetActivityStatus (page 42)
SNAP PAC Motion Control User’s Guide
95
95
Page 100
COMMANDS IN ALPHABETICAL ORDER

SetPosition, GetPosition

buffered
Syntax
Arguments
Data Structure
SetPosition, axis, P1, P2 GetPosition, axis
Type Range Board Address
axis unsigned 8 bits 0 to 3 0
4 to 7 1 8 to B 2 C to F 3
Name Type Range Scaling Units
31
position signed 32 bits
SetPosition
P1 write position (high-order part)
31
P2 write position (low-order part)
15
GetPosition
P1 read position (high-order part)
31
31
to 2
-2
First data word
Second data word
First data word
unity counts
-1 microsteps
16
0
16
Description
Restrictions
OptoScript
Example
See Also
96
SNAP PAC Motion Control User’s Guide
P2 read position (low-order part)
15
Second data word
0
SetPosition specifies the trajectory destination of the specified axis. It is used in the Trapezoidal and S-curve profile modes.
GetPosition reads the contents of the buffered position register.
SetPosition is a buffered command. The value set using this command will not take effect until the next Update or MultiUpdate instruction.
Status=TransmitReceiveString (“>SetPosition,5,P1,P2”,ComHandle,ResponseString)
Status=TransmitReceiveString (“>GetPosition,5”,ComHandle,ResponseString)
SetAcceleration, GetAcceleration (page 68), SetDeceleration, GetDeceleration (page 84), SetJerk, GetJerk (page 92), SetVelocity, GetVelocity (page 108), MultiUpdate (page 62), Update (page 109)
Loading...