Moog SmartMotor Instruction Manual

Developer’s
Guide
Class 5 & Later SmartMotor
Technology with
TM

Copyright Notice
©2001–2018, Moog Inc., Animatics.
Moog Animatics SmartMotor™Developer's Guide, Rev. L, PN:SC80100003-002.
This manual, as well as the software described in it, is furnished under license and may be
used or copied only in accordance with the terms of such license. The content of this manual is
furnished for informational use only, is subject to change without notice and should not be
construed as a commitment by Moog Inc., Animatics. Moog Inc., Animatics assumes no
responsibility or liability for any errors or inaccuracies that may appear herein.
Except as permitted by such license, no part of this publication may be reproduced, stored in a
retrieval system or transmitted, in any form or by any means, electronic, mechanical,
recording, or otherwise, without the prior written permission of Moog Inc., Animatics.
The programs and code samples in this manual are provided for example purposes only. It is
the user's responsibility to decide if a particular code sample or program applies to the
application being developed and to adjust the values to fit that application.
Moog Animatics and the Moog Animatics logo, SmartMotor and the SmartMotor logo,
Combitronic and the Combitronic logo, and SMI are all trademarks of Moog Inc., Animatics.
Other trademarks are the property of their respective owners.
Please let us know if you find any errors or omissions in this manual so that we can improve it
for future readers. Such notifications should contain the words "Developer's Guide" in the
subject line and be sent by e-mail to: animatics_marcom@moog.com. Thank you in advance
for your contribution.
Contact Us:
Americas - West
Moog Animatics
2581 Leghorn Street
Mountain View, CA 94043
USA
Americas - East
Moog Animatics
750 West Sproul Road
Springfield, PA 19064
USA
Tel: 1 650-960-4215 Tel: 1 610-328-4000 x3999
Fax: 1 610-605-6216
Support: 1 888-356-0357
Website: www.animatics.com
Email: animatics_sales@moog.com

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 3 of 909
Table Of Contents
Introduction 27
Overview 28
Combitronic Support 28
Communication Lockup Wizard 30
Safety Information 30
Safety Symbols 30
Other Safety Considerations 31
Motor Sizing 31
Environmental Considerations 31
Machine Safety 31
Documentation and Training 32
Additional Equipment and Considerations 33
Safety Information Resources 33
Additional Documents 34
Related Guides 34
Other Documents 34
Additional Resources 35
Part 1: Programming the SmartMotor 36
Beginning Programming 47
Setting the Motor Firmware Version 48
Setting the Default Firmware Version 48
Checking the Default Firmware Version 49
Opening the SMIWindow (Program Editor) 49
Understanding the Program Requirements 50
Creating a "Hello World" Program 51
Entering the Program in the SMI Editor 51
Adding Comments to the Code 52
Checking the Program Syntax 52
Saving the Program 52
Downloading a Program to the SmartMotor 52
Syntax Checking, Compiling and Downloading the Program 53
Additional Notes on Downloaded Programs 53
Running a Downloaded Program 54

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 4 of 909
Using the Program Download Window 55
Using the Terminal Window and Run Program Button 55
Using the RUN Command in the Terminal Window 55
Creating a Simple Motion Program 56
SMISoftware Features 57
Introduction 58
Menu Bar 58
Toolbar 59
Configuration Window 61
Terminal Window 63
Initiating Motion from the Terminal Window 65
Information Window 65
Program Editor 66
Motor View 68
SMI Trace Functions 70
Monitor Window 73
Serial Data Analyzer 75
Chart View 76
Chart View Example 77
Macros 80
Tuner 82
SMIOptions 86
SMIHelp 87
Context-Sensitive Help Using F1 87
Context-Sensitive Help Using the Mouse 87
Help Buttons 87
Hover Help 87
Table of Contents 87
Projects 88
SmartMotor Playground 89
Opening the SmartMotor Playground 90
Moving the Motor 91
Communication Details 93
Introduction 95
Connecting to a Host 96
Daisy Chaining Multiple D-Style SmartMotors over RS-232 97
ADDR=formula 98

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 5 of 909
SLEEP, SLEEP1 99
WAKE, WAKE1 99
ECHO, ECHO1 100
ECHO_OFF, ECHO_OFF1 100
Serial Commands 101
OCHN(type,channel,parity,bit rate,stop bits,data bits,mode,timeout) 101
CCHN(type,channel) 102
BAUDrate, BAUD(channel)=formula 102
PRINT(), PRINT1() 102
SILENT, SILENT1 103
TALK, TALK1 103
a=CHN(channel) 103
a=ADDR 104
Communicating over RS-485 104
Using Data Mode 104
CAN Communications 107
CADDR=formula 107
CBAUD=formula 107
=CAN, =CAN(arg) 107
CANCTL(function,value) 107
SDORD(...) 108
SDOWR(...) 108
NMT 109
RB(2,4), x=B(2,4) 109
Exceptions to NMT, SDORD and SDOWR Commands 109
I/O Device CAN Bus Master 110
Combitronic Communications 111
Combitronic Features 112
Other Combitronic Benefits 112
Program Loops with Combitronic 112
Global Combitronic Transmissions 113
Simplify Machine Support 113
Combitronic with RS-232 Interface 113
Other CANProtocols 115
CANopen - CAN Bus Protocol 115
DeviceNet - CAN Bus Protocol 115
I²C Communications (D-Style Motors) 115

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 6 of 909
OCHN(IIC,1,N,baud,1,8,D) 117
CCHN(IIC,1) 117
PRINT1(arg1,arg2, … ,arg_n) 117
RGETCHR1, Var=GETCHR1 117
RLEN1, Var=LEN1 117
Motion Details 118
Introduction 120
Motion Command Quick Reference 121
Basic Motion Commands 122
Target Commands 122
PT=formula 122
PRT=formula 123
ADT=formula 123
AT=formula 123
DT=formula 123
VT=formula 123
Motion Mode Commands 124
MP 124
MV 124
MT 124
Torque Commands 125
TS=formula 125
T=formula 125
Brake Commands 125
BRKRLS 125
BRKENG 125
BRKSRV 126
BRKTRJ 126
Brake Command Examples 126
EOBK(IO) 127
MTB 127
Index Capture Commands 128
Other Motion Commands 129
G 129
S 129
X 130
O=formula 130

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 7 of 909
OSH=formula 130
OFF 130
Commutation Modes 131
MDT 131
MDE 131
MDS 131
MDC 132
MDB 132
MINV(0), MINV(1) 132
Modes of Operation 133
Torque Mode 133
Torque Mode Example 133
Dynamically Change from Velocity Mode to Torque Mode 133
Velocity Mode 134
Constant Velocity Example 134
Change Commanded Speed and Acceleration 134
Absolute (Position) Mode 135
Absolute Move Example 135
Two Moves with Delay Example 135
Change Speed and Acceleration Example 135
Shift Point of Origin Example 136
Relative Position Mode 136
Relative Mode Example 136
Follow Mode with Ratio (Electronic Gearing) 137
Electronic Gearing and Camming over CANopen 137
Electronic Gearing Commands 138
SRC(enc_src) 138
MFR 138
MSR 138
MF0 138
MS0 138
MFMUL=formula, MFDIV=formula 138
MFA(distance[,m/s]) 139
MFD(distance[,m/s]) 139
MFSLEW(distance[,m/s]) 139
Follow Internal Clock Source Example 139
Follow Incoming Encoder Signal With Ramps Example 140

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 8 of 909
Electronic Line Shaft 142
ENCD(in_out) 142
Spooling and Winding Overview 143
Relative Position, Auto-Traverse Spool Winding 143
MFSDC(distance,mode) 144
Dedicated, Absolute Position, Winding Traverse Commands 146
MFSDC(distance,2) 147
MFLTP=formula 147
MFHTP=formula 147
MFCTP(arg1,arg2) 147
MFL(distance[,m/s]) 148
MFH(distance[,m/s]) 148
ECS(counts) 148
Single Trajectory Example Program 150
Chevron Wrap Example 150
Other Traverse Mode Notes 152
Traverse Mode Status Bits 153
CamMode (Electronic Camming) 153
Electronic Camming Details 156
Understanding the Inputs 156
Should I choose Source Counts or Intermediate Counts? 157
Should I choose Variable or Fixed cam? 157
Electronic Camming Notes and Best Practices 159
Examples 161
Electronic Gearing and Camming over CANopen 161
Electronic Camming Commands 162
CTE(table) 162
CTA(points,seglen[,location]) 162
CTW(pos[,seglen][,user]) 162
MCE(arg) 163
MCW(table,point) 163
RCP 164
RCTT 164
MC 164
MCMUL=formula 164
MCDIV=formula 164
O(arg)=formula 164

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 9 of 909
OSH(arg)=formula 164
Cam Example Program 165
Mode Switch Example 168
Position Counters 170
Modulo Position 171
Modulo Position Commands 171
Dual Trajectories 172
Commands That Read Trajectory Information 174
Dual Trajectory Example Program 175
Synchronized Motion 175
Synchronized-Target Commands 175
PTS(), PRTS() 175
VTS=formula 176
ADTS=formula, ATS=formula, DTS=formula 177
PTSS(), PRTSS() 177
A Note About PTS and PTSS 177
Other Synchronized-Motion Commands 178
GS 178
TSWAIT 179
Program Flow Details 181
Introduction 182
Flow Commands 182
RUN 183
RUN? 183
GOTO#, GOTO(label), C# 183
GOSUB#, GOSUB(label), RETURN 184
IF, ENDIF 184
ELSE, ELSEIF 185
WHILE, LOOP 186
SWITCH, CASE, DEFAULT, BREAK, ENDS 186
TWAIT 187
WAIT=formula 187
STACK 187
END 188
Program Flow Examples 189
IF, ELSEIF, ELSE, ENDIF Examples 189
WHILE, LOOPExamples 189

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 10 of 909
GOTO(), GOSUB() Examples 190
SWITCH, CASE, BREAK, ENDS Examples 191
Interrupt Programming 192
ITR(), ITRE, ITRD, EITR(), DITR(), RETURNI 192
TMR(timer,time) 194
Variables and Math 195
Introduction 196
Variable Commands 196
EPTR=formula 196
VST(variable,number) 196
VLD(variable,number) 197
Math Expressions 197
Math Operations 197
Logical Operations 197
Integer Operations 197
Floating Point Functions 197
Math OperationDetails and Examples 198
Array Variables 198
Array Variable Examples 199
Error and Fault Handling Details 200
Motion and Motor Faults 201
Overview 201
Drive Stage Indications and Faults 201
Fault Bits 201
Error Handling 202
Example Fault-Handler Code 202
PAUSE 203
RESUME 203
Limits and Fault Handling 204
Position Error Limits 204
dE/dt Limits 204
Velocity Limits 204
Hardware Limits 204
Software Limits 205
Fault Handling 205
Monitoring the SmartMotor Status 206
System Status 208

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 11 of 909
Introduction 209
Retrieving and Manipulating Status Words/Bits 209
System and Motor Status Bits 209
Reset Error Flags 211
System Status Examples 211
Timer Status Bits 212
Interrupt Status Bits 212
I/O Status 213
User Status Bits 213
Multiple Trajectory Support Status Bits 214
Cam Status Bits 215
Interpolation Status Bits 216
Motion Mode Status 216
RMODE, RMODE(arg) 216
I/OControl Details 217
I/O Port Hardware 218
I/O Connections Example (D-Style Motors) 219
I/O Voltage Spikes 219
Discrete Input and Output Commands 220
Discrete Input Commands 220
Discrete Output Commands 220
Output Condition and Fault Status Commands 221
Output Condition Commands 221
Output Fault Status Reports 221
General-Use Input Configuration 221
Multiple I/OFunctions Example 222
Analog Functions of I/O Ports 223
5 Volt Push-Pull I/O Analog Functions (D-Style Motors) 223
24 Volt I/O Analog Functions (D-Style AD1 Option Motors, M-Style Motors) 223
Special Functions of I/OPorts 224
Class 5 D-Style Motors: Special Functions of I/O Ports 225
I/O Ports 0 and 1 – External Encoder Function Commands 225
I/O Ports 2 and 3 – Travel Limit Inputs 225
I/O Ports 4 and 5 – Communications 225
I/O Port 6 – Go Command, Encoder Index Capture Input 226
Class 5 M-Style Motors: Special Functions of I/O Ports 227
COM Port Pins 4, 5, 6, and 8 – A-quad-B or Step-and-Direction Modes 227

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 12 of 909
I/O Ports 2 and 3 – Travel Limit Inputs 227
I/O Port 5 – Encoder Index Capture Input 227
I/O Port 6 – Go Command 228
Class 6 M-Style Motors: Special Functions of I/O Ports 229
COM Port Pins 4, 5, 6, and 8 – A-quad-B or Step-and-Direction Modes 229
I/O Ports 2 and 3 – Travel Limit Inputs 229
I/O Port 4 and 5 – Encoder Index Capture Input 229
I/O Port 6 – Go Command 230
I/O Brake Output Commands 230
I²C Expansion (D-Style Motors) 230
Tuning and PIDControl 231
Introduction 232
Understanding the PID Control 232
Tuning the PID Control 233
Using F 233
Setting KP 234
Setting KD 234
Setting KI and KL 234
Setting EL=formula 235
Other PID Tuning Parameters 235
KG=formula 235
KV=formula 235
KA=formula 236
Current Limit Control 237
AMPS=formula 237
Part 2: SmartMotor Command Reference 238
(Single Space Character) 240
a...z 241
aa...zz 241
aaa...zzz 241
Ra...Rz 241
Raa...Rzz 241
Raaa...Rzzz 241
ab[index]=formula 245
Rab[index] 245
ABS(value) 248

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 13 of 909
RABS(value) 248
AC 250
RAC 250
ACOS(value) 253
RACOS(value) 253
ADDR=formula 255
RADDR 255
ADT=formula 257
ADTS=formula 259
af[index]=formula 261
Raf[index] 261
Ai(arg) 264
Aij(arg) 266
Aj(arg) 268
Aji(arg) 270
al[index]=formula 272
Ral[index] 272
AMPS=formula 275
RAMPS 275
ASIN(value) 278
RASIN(value) 278
AT=formula 280
RAT 280
ATAN(value) 282
RATAN(value) 282
ATOF(index) 284
RATOF(index) 284
ATS=formula 286
aw[index]=formula 288
Raw[index] 288
B(word,bit) 291
RB(word,bit) 291
Ba 295
RBa 295
BAUD(channel)=formula 297
RBAUD(channel) 297
Be 299

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 14 of 909
RBe 299
Bh 301
RBh 301
Bi(enc) 304
RBi(enc) 304
Bj(enc) 307
RBj(enc) 307
Bk 310
RBk 310
Bl 311
RBl 311
Bls 313
RBls 313
Bm 315
RBm 315
Bms 317
RBms 317
Bo 319
RBo 319
Bp 320
RBp 320
Bps 322
RBps 322
Br 324
RBr 324
BREAK 326
BRKENG 328
BRKRLS 330
BRKSRV 332
BRKTRJ 334
Brs 336
RBrs 336
Bs 338
RBs 338
Bt 340
RBt 340
Bv 342

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 15 of 909
RBv 342
Bw 344
RBw 344
Bx(enc) 346
RBx(enc) 346
C{number} 348
CADDR=formula 350
RCADDR 350
CAN, CAN(arg) 352
RCAN, RCAN(arg) 352
CANCTL(function,value) 354
CASE formula 355
CBAUD=formula 358
RCBAUD 358
CCHN(type,channel) 360
CHN(channel) 361
RCHN(channel) 361
CLK=formula 363
RCLK 363
COMCTL(function,value) 364
COS(value) 366
RCOS(value) 366
CP 368
RCP 368
CTA(points,seglen[,location]) 370
CTE(table) 372
CTR(enc) 374
RCTR(enc) 374
CTT 376
RCTT 376
CTW(pos[,seglen][,user]) 377
DEA 380
RDEA 380
DEFAULT 382
DEL=formula 384
RDEL 384
DELM(arg) 386

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 16 of 909
DFS(value) 387
RDFS(value) 387
DITR(int) 388
DT=formula 390
RDT 390
DTS=formula 392
EA 394
REA 394
ECHO 396
ECHO0 398
ECHO1 399
ECHO_OFF 400
ECHO_OFF0 401
ECHO_OFF1 402
ECS(counts) 403
EIGN(...) 405
EILN 408
EILP 410
EIRE 412
EIRI 414
EISM(6) 416
EITR(int) 417
EL=formula 419
REL 419
ELSE 421
ELSEIF formula 423
ENC0 425
ENC1 426
ENCCTL(function,value) 428
ENCD(in_out) 430
END 431
ENDIF 433
ENDS 435
EOBK(IO) 437
EOIDX(number) 439
EPTR=formula 440
REPTR 440

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 17 of 909
ERRC 441
RERRC 441
ERRW 443
RERRW 443
ETH(arg) 444
RETH(arg) 444
ETHCTL(function,value) 445
F 446
FABS(value) 448
RFABS(value) 448
FSA(cause,action) 450
FSQRT(value) 452
RFSQRT(value) 452
FW 454
RFW 454
G 456
GETCHR 459
RGETCHR 459
GETCHR1 461
RGETCHR1 461
GOSUB(label) 463
GOTO(label) 465
GS 467
HEX(index) 469
RHEX(index) 469
I(enc) 471
RI(enc) 471
IDENT=formula 473
RIDENT 473
IF formula 475
IN(...) 478
RIN(...) 478
INA(...) 481
RINA(...) 481
IPCTL(function,"string") 484
ITR(Int#,StatusWord,Bit#,BitState,Label#) 486
ITRD 489

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 18 of 909
ITRE 491
J(enc) 493
RJ(enc) 493
KA=formula 495
RKA 495
KD=formula 497
RKD 497
KG=formula 499
RKG 499
KI=formula 501
RKI 501
KII=formula 503
RKII 503
KL=formula 504
RKL 504
KP=formula 506
RKP 506
KPI=formula 508
RKPI 508
KS=formula 509
RKS 509
KV=formula 511
RKV 511
LEN 513
RLEN 513
LEN1 514
RLEN1 514
LFS(value) 516
RLFS(value) 516
LOAD 518
LOCKP 521
LOOP 522
MC 524
MCDIV=formula 527
RMCDIV 527
MCE(arg) 528
MCMUL=formula 530

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 19 of 909
RMCMUL 530
MCW(table,point) 532
MDB 534
MDC 536
MDE 538
MDH 540
MDHV 542
MDS 544
MDT 546
MF0 548
MFA(distance[,m/s]) 550
MFCTP(arg1,arg2) 553
MFD(distance[,m/s]) 555
MFDIV=formula 558
MFH(distance[,m/s]) 560
MFHTP=formula 562
MFL(distance[,m/s]) 564
MFLTP=formula 566
MFMUL=formula 568
MFR 570
MFSDC(distance,mode) 573
MFSLEW(distance[,m/s]) 575
MINV(arg) 577
MODE 579
RMODE 579
MP 582
MS0 585
MSR 587
MT 589
MTB 591
MV 593
NMT 595
N/A 595
O=formula, O(trj#)=formula 597
OC(...) 599
ROC(...) 599
OCHN(...) 601

Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 20 of 909
OF(...) 603
ROF(...) 603
OFF 605
OR(value) 607
OS(...) 609
OSH=formula, OSH(trj#)=formula 611
OUT(...)=formula 613
PA 615
RPA 615
PAUSE 617
PC, PC(axis) 619
RPC, RPC(axis) 619
PI 622
RPI 622
PID# 623
PMA 626
RPMA 626
PML=formula 628
RPML 628
PMT=formula 630
RPMT 630
PRA 632
RPRA 632
PRC 635
RPRC 635
PRINT(...) 638
PRINT0(...) 642
PRINT1(...) 646
PRINT8(...) 649
PRT=formula 652
RPRT 652
PRTS(...) 654
PRTSS(...) 656
PT=formula 658
RPT 658
PTS(...) 660
PTSD 663
Table of contents
Other Moog Servo Drive manuals

Moog
Moog MSD C2 User manual

Moog
Moog MSD G393-004 User manual

Moog
Moog Class 5 SmartMotor User manual

Moog
Moog MSD User manual

Moog
Moog DS2020 Mounting instructions

Moog
Moog D633-A Series User manual

Moog
Moog DS2020 Installation manual

Moog
Moog DR2020 Series User manual

Moog
Moog MSD Servo Drive Reference guide

Moog
Moog G394-030 User manual