Home

Language Reference Guide

image

Contents

1. Related Commands Bm In non PLS firmware motors BI is reset to zero under the following condi tions Bp Br 1 When the S status byte is accessed for assignment LIMH 2 or reported via RS PRINT S 13 or PRINT1 S 13 LIML 3 or directly reset with ZI and ZS LIMD 4 or a G command is issued AND the Bm bit is not set LIMN RS In PLS firmware motors BI is reset to zero under the following conditions RPW By issuing either ZI and ZS dad Example code UCI IF Bm UCP PRINT LEFT LIMIT PRESENTLY ACTIVE UCO ELSEIF Bl PRINT LEFT LIMIT PREVIOUSLY CONTACTED UDI ELSE PRINT LEFT LIMIT NEVER REACHED UDM ENDIF UDO SLE SLD SLP SLN ZI ZS Hardware Travel Limit Overview Status Bits Command to kate to cone to i j i Isable nable Pos Neg Plus Minus Left Right Real Time Historical Clear Historical Bit tavel Limit input Travel Limit Input Posive PLus ricHT Br Bp zrorzs uCloruco 51 Related Commands BI Bp Br LIMH LIML LIMD LIMN RS RPW RW UCI UCP UCO UDI UDM UDO SLE SLD SLP SLN ZI ZS Bm Real Time Left Limit Status Bit APPLICATION Monitor left negative switch DESCRIPTION Left limit state EXECUTION Real time sampled each PID update CONDITIONAL TO LIMH LIML UCI UCO UCM LIMITATIONS None REPORT COMMAND RBm RW and RPW bit 10 READ WRITE Read only set reset by pin voltage level LANGUAGE ACCESS Exp
2. PRINT 13 STATUS BYTE VALUE ss IF ss amp 32 PRINT 13 POSITION ERROR ENDIF IF ss amp 16 PRINT 13 WRAP AROUND ENDIF IF ss amp l PRINT 13 TRAJECTORY IN PROGRESS ENDIF RETURN 271 Related Command ADDR SADDR Set Motor Address APPLICATION Serial communication control DESCRIPTION Set motor address EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS Expression and conditional testing via ADDR UNITS Number RANGE OF VALUES 1 to 120 TYPICAL VALUES 1to4 DEFAULT VALUE 0 global address FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The SADDR value command is used to set the unit address of a SmartMotor where value is an integer between 0 and 100 Separate addresses allow multiple SmartMotors to share a common communication channel and still differentiate them selves The SADDR command is typically one of the first commands in a downloaded pro gram In an RS 485 network where all communications go over the same two parallel wires the SADDR command must be in the program whereas in an RS 232 network where communications travel from one motor to the next addressing can be accom plished from a host or master motor The address can be from 0 to 100 If it is zero the motor will have no unique address Address 0 is the global address it is used to talk to all motors on a network at once
3. CAM Motor Motor 1000 1500 2000 2500 3000 3500 Master Motor Position BASE 2000 Cam period SIZE 25 data segments number of data points in table CTR data interval BASE SIZE 2000 25 80 CAM motor will be at Data position every 80 Master encoder counts CTR 0 CTR 80 CTR 160 CTR 1840 CTR 1920 CTR 2000 Now assigning data values beginning with aw 0 aw 0 0 10 20 30 40 50 60 70 80 90 100 aw 20 110 120 120 110 100 90 80 70 60 aw 19 50 40 30 20 10 0 MF4 reset external encoder to zero O 0 reset internal encoder position MC buffer CAM Mode G start following the external encoder using cam data The motor will now begin following the External Master encoder via the defined CAM profile above 277 Related Command SLEEP1 WAKE WAKE1 The SLEEP and WAKE commands are only sent from a host never part of a SmartMotor program SLEEP Ignore Incoming Commands on Primary Port APPLICATION Serial communication control DESCRIPTION Motor prevented from executing channel 0 commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Illegal with a user program REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE WAKE state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The SLEEP command is used to put a SmartMotor into Sleep Mode with respect to channel 0 serial command
4. Rab 0 report ab 0 PRINT ab 1 Rab 1 report ab 1 PRINT ab 2 Rab p report ab 2 PRINT ab 3 Rab q report ab 3 PRINT ab 4 Rab v u report ab 4 PRINT ab 5 Rab v report ab 5 PRINT ab 6 Rab v u report ab 6 END EXAMPLE 2 a 254 assign test values WHILE a lt 258 i a 252 ab i l a assignment truncated to only 8 bits Rab i reported values are 2 1 0 1 and 2 a atl LOOP END EXAMPLE 3 Rab 201 sets Bs fails to report a value but instead emits a syntax error message if syntax reports active EXAMPLE 4 v 605 Rab v sets Bs fails to report a value but instead emits a syntax error message if syntax reports active 207 Related Command N A Ral index Report 32 Bit Array Data Value APPLICATION Report command DESCRIPTION Report user variable al index EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Index range from 0 to 200 REPORT VALUE al index READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Ral index reports the signed value of the variable al index to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT al
5. t t 1 LOOP END output i as index to an array variable j as the number of sequential to store w 334 is Lid 222 333 444 rLLI Related Command Bk EPTR RBk VST VST variable number DATA EEPROM READ WRITE COMMAND APPLICATION User data storage DESCRIPTION Sequentially store user variables to data EPROM EXECUTION Immediate CONDITIONAL TO EPTR variable LIMITATIONS EPTR set from 0 to 7999 REPORT COMMAND N A READ WRITE Sequential write LANGUAGE ACCESS N A UNITS 1 byte 2 byte or 4 byte reads RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE User determined values FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION VST command is used to store data into internal nonvolatile RAM EEPROM To write into this memory space a memory address location must first be specified with the EPTR expression command where expression takes a value between 0 and 32000 use the VST variable number command The first parameter variable specifies the name of the first user variable of a sequence of variables that you wish to write from The second parameter number specifies the number of variables in the sequence of variables that you wish to store The command interpreter will automatically note the size of variable you define either 1 2 or 4 bytes long When using the data EEPROM it is important to note that the only the data val
6. BRKENG BRKRLS BRKTRJ BRKC BRKG BRKI NOTE A position error will terminate both the trajectory in progress state and servo on state In this instance the brake would then be asserted automatically BRKSRV Brake Engage When Not Servoing APPLICATION Hardware brake control DESCRIPTION Release hardware break while motor is on Engage hardware brake while motor is off EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO Hardware BRAKE required LIMITATIONS None REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Power On BRKSRV Power Off brake engaged FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release It is important to turn the servo off when the brake is engaged or the motor could be driving against the break and overheat The BRKSRV command does this for you by releasing the brake automatically whenever the motor is on and engaging it whenever the motor turns off for any reason Another way of looking at this is the brake will be appl
7. PRINT PE and RPE would transmit an identical value if it were possible to execute both commands at the exactly the same time Note As acceleration A is increased a larger value of E will be required E is unsigned but PE may be positive or negative EXAMPLE E 1000 set maximum position error permitted A 100 set buffered acceleration V 3200000 set buffered maximum velocity P 12345678 set buffered target position G move to target WHILE Bt while trajectory in progress IF PE gt 800 PRINT 13 WARNING PRINT 13 Postion error close to limit ENDIF LOOP 16 V Present Trajectory Velocity Related APPLICATION Monitor trajectory eommaness DESCRIPTION Commanded PID Trajectory Velocity K EXECUTION Next PID sample uy CONDITIONAL TO Calculated Trajectory RY LIMITATIONS Expression value P REPORT COMMAND RV PRINT V PE READ WRITE Hardware read only PIDn LANGUAGE ACCESS Expressions and conditional testing UNITS Scaled encoder counts per PID sample 65536 scaled counts 1 count RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 3000000 to 3000000 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The function V returns the present target trajectory velocity Instead of returning the actual velocity it tells you what the velocity is supposed to be For the most part this is the same as the actual velocity for the simple reason that if you are not at the rig
8. 1 Left negative limit has been active DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher firmware motors DETAILED DESCRIPTION BI is the historical left limit flag If the left limit is found to be active during any servo sample BI is set to 1 and remains 1 until reset by the user In addition the motion will stop and the motor will either servo or turn the amplifier OFF depending on the value of the F function The historical left negative limit flag BI provides a latched value in case the limit may have already been reached and overpassed but is not at presently active The real time left negative limit flag is Bm which only remains set to 1 while the signal level on the user pin D is active Whenever Bm is set to 1 BI is set to one The polar ity of the signal that is considered active is determined by commands LIMH Active High To Stop and LIML active Low To_Stop in all non PLS firmware motors PLS firmware motors are always Active High asserted If the pin s function is assigned to being general purpose I O by use of the UDI or UDO commands neither Bm nor BI will be affected by the pin state Changing pin states will not elicit limit behavior from the motor It will be necessary to issue the UDM com mand to assign the pin s function to being a limit switch for the pin to again elicit limit behavior including the setting of BI Continued on next page 50 BI continued Historical Left Limit Status Bit
9. 332 Related Command Bk EPTR RBk VST VLD variable number Data EEPROM READ WRITE COMMAND APPLICATION User data recovery DESCRIPTION Sequentially load user variables from data EPROM EXECUTION Immediate CONDITIONAL TO EPTR variable LIMITATIONS EPTR set from 0 to 32000 REPORT COMMAND N A READ WRITE Sequential read LANGUAGE ACCESS N A UNITS 1 byte 2 byte or 4 byte reads RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE User stored values FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION VST or VLD commands are used to store and load data from internal nonvolatile RAM EEPROM To read or write into this memory space a memory address location must first be specified with the EPTR expression command where expression takes a value between 0 and 32000 and then use the VST or VLD commands to store or retrieve data To Read in a series of values and assign these values to a sequence of user variables use the VLD variable number command The first parameter variable specifies the name of the first user variable of a sequence of variables that you wish to load The second parameter number specifies the number of variables in the sequence of variables that you wish to store The command interpreter will automatically note the size of variable you define either 1 2 or 4 bytes long When using the data EEPROM it is important to note tha
10. APPLICATION Report command DESCRIPTION Report position error EXECUTION Next PID sample CONDITIONAL TO Servo active LIMITATIONS Torque mode has zero position error REPORT VALUE PE READ WRITE N A LANGUAGE ACCESS N A UNITS Encoder counts RANGE OF VALUES EtoE TYPICAL VALUES EtoE DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RPE reports the signed value of the instantaneous position error PE No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT PE 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 256 Related Command E G PE RPE continued Report Real Time Position Error EXAMPLE measure motion settling time O 0 set current shaft position as origin P 20000 set target position V 1000000 set velocity A 100 set acceleration G Go start motion WHILE Bt LOOP wait for trajectory complete a CLK read the clock into variable a Clock measured in servo samples 4069 servo samples lsecond GOSUB5 observe settling motion END c5 subroutine label 5 IF PE GOTO1O
11. CTR data interval BASE SIZE 2000 25 80 CAM motor will be at Data position every 80 Master encoder counts CTR 0 CTR 80 CTR 160 CTR 1840 CTR 1920 CTR 2000 Now assigning data values beginning with aw 0 aw 0 0 10 20 30 40 50 60 70 80 90 100 aw 20 110 120 120 110 100 90 80 70 60 aw 19 50 40 30 20 10 0 MF4 reset external encoder to zero O 0 reset internal encoder position MC buffer CAM Mode G start following th xternal encoder using cam data The motor will now begin following the External Master encoder via the defined CAM profile above 65 Related Commands BRKENG BRKRLS BRKSRV BRKTRJ BRKG BRKI UCO BRKC Brake Control Re Direct to Port C APPLICATION Hardware brake control DESCRIPTION Re Direct Brake Control to Port C user Output EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO BRKI BRKG LIMITATIONS None REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE BRKI Brake Control Default to Internal Bake Pin FIRMWARE VERSIONS 4 15 all PLS firmware Not available on 4 40 DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake w
12. H and Channel 0 63 REPORT COMMAND RDIN Port channel READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE 255 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The DIN Address Channel is used to read the single byte integer value of a given address and channel from a peripheral I O device such as the DIO 100 or OPTO 1 digital I O expansion module The value is received via the AniLink communications channel The address parameter must correspond with hard ware address jumpers on the peripheral expansion card The Addresses are designated as A B C D E F G or H The channel number which may be from 0 to 63 is device specific Typically it is O thru 8 See the specific periph eral user manual for specific details DIN address channel returns an unsigned 8 bit value ranging from 0 to 255 If the specified card or connection is not present the function will return a value of 255 EXAMPLE 1 reading the first 8 inputs of an OPTO 1 on Address A x DINAOQ Assign first 8 inputs to x EXAMPLE 2 reading the second 8 inputs of an OPTO 1 on Address A x DINA1l Assign second 8 inputs to x EXAMPLE 3 reading the third input bit of an OPTO 1 on Address A x DINAO amp 4 Assign second 8 inputs to x 101 Related Command DIN NOTE 8 bit data Logical AND of expression with 255 DOUT
13. Language reference table of contents Language reference introduction exclamation point Single Space Character Direct Binary Mode Control PE V a z aa zzz ab index alfindex aw index A expression ADDR AIN address input AMPS expression AOUT address value Ba Bb Bc Be Bf Bh Bi Bk BI Bm Bo Bp Br Bs Bt Bu Bw Bx BASE BRKC Pause Program Execution Single Space Delimiter and String Terminator Binary Trajectory Data Format Real Time Actual Position Error Present Trajectory Velocity 32 Bit Variables 32 Bit Variables 8 bit Array Variables 32 Bit Array Variables 16 bit Array Variables Set Acceleration Set Motor Address Analog Input from I O Device Set Drive PWM Limit Analog Output to I O Device Peak Over Current Status Bit Parity Error Status Bit Communications Overflow Status Bit Excessive Position Error Status Bit Communications Framing Error Status Bit Overheat RMS Over Current Status Bit Index Position Captured Status Bit User Program Checksum Error Status Bit Historical Left Limit Status Bit Real Time Left Limit Status Bit Motor Off Status Bit Real Time Right Limit Status Bit Historical Right Limit Status Bit Syntax Error Status Bit Trajectory In Progress Status Bit Array Index Error Status Bit Encoder Wrap Around Status Bit Real Time Index Input Status Bit Cam Mode Master Cycle Length Brake Control Re Direct to Port C 10 12 13 16 17 19 21
14. READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Index input presently contacted STATE VALUE 0 Index input not presently contacted FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBx reports the state of the real time index flag Bx It returns a 1 if the current position is coincident with the encoder index 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bx 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE Fast Index Find Report Bx MP set buffered velocity mode A 1000 set fast acceleration V 4000000 set fast velocity D 2100 set relative distance just beyond one shaft turn i I clear and arm index capture O 0 force change to position register G start fast move TWAIT wait till end of trajectory P I go back to index G start motion TWAIT wait until end of trajectory O 0 set origin at index RBx Output will be 1 233 Related Command N A RBy Report Step Direction Change Over Run Status APPLICATION Report command DESCRIPTION Report system state step direction
15. RKD reports the signed value of the buffered PID derivative gain value KD No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KD 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 RKD Report present buffered KD 249 Related Command F KGON KGOFF RKG Report Gravitational Compensation Gain Tuning Value APPLICATION Report command DESCRIPTION Report buffered gravitational gain EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE KD READ WRITE N A LANGUAGE ACCESS NA UNITS PID coefficient RANGE OF VALUES 8388608 to 8388607 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKG reports the signed value of the buffered PID gravity constant KG No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KG 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel
16. Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UFA function FXAMPLE UFO set PIN F to function as a digital output UF 0 set PIN F to logic 0 zero volts UF 1 set PIN F to Logie 1 5 volts Note The I O state can be set prior to assigning as an output UF 0 Pre set PIN F to logic 0 zero volts UFO set PIN F as an output pre initialized to zero 319 Related Command UF UFI UFO UFA Read I O Port F as Analog Input APPLICATION I O control DESCRIPTION Read Pin F analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UFA READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line F can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UFA is read only and can be accessed with the statement variable UFA PRINT UFA 13 or WHILE UFA gt 200 LOOP The analog read occurs once at the time the UFA command is executed Assigning the variable a UFA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor
17. Reset Array Index Error state Flag APPLICATION Program execution control DESCRIPTION Reset user array index read access error latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBu READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Zu resets system flag Bu the index read access violation latch to zero If the Bu flag is set it means that you are improperly using an array and you may be writing data to an unspecified location For safe operation it is vital to find and eliminate the cause if this error flag is ever set EXAMPLE IF Bu Test flag PRINT Array Error Zu Reset flag ENDIF 353 Related Command Bw RBw Zw Reset Encoder Wrap Status Flag APPLICATION Program execution control DESCRIPTION Reset encoder wrap around event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBw READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 RELATED COMMANDS Bw RBw FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Zw resets system flag Bw the encoder wrap around violation latch to zero The SmartMotor tracks its position as 32 bit data so a valid position is between 2147483648 and 2147483648 If the motor moves out of this range the position will
18. The value of the AIN address input function can be reported through the primary serial port with the PRINT AIN address input 13 and AIN address input functions To transmit the value through serial channel 1 use PRINT1 AIN address input 13 EXAMPLE x AINA1 Assign analog value of Port A input 1 to a Please refer to the associated Users Manuals for specifics about each optional Analog I O card 35 Related Commands RAMPS T MT Referencing against a hard stop this way can eliminate an additional switch and cable AMPS torque speed diagram APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE AMPS expression Set Drive PWM Limit Amplifier control Sets maximum allowed PWM to motor windings Next PID sample N A Must not be negative RAMPS Read write Assignment expressions and conditional testing 1 1023 of maximum PWM permitted 0 to 1023 1000 1000 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The AMPS command effectively limits both the continuous torque and speed of the SmartMotor To set the SmartMotor to use maximum available PWM issue the command AMPS 1023 Setting AMPS 0 limits PWM to 0 thereby preventing any output torque To conceptually understand what happens when you use values between 0 and 1023 consider the following torque speed dia
19. UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE BRKI Brake Control Default to Internal Bake Pin FIRMWARE VERSIONS 4 15 all PLS firmware Not available on 4 40 DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release If an External Brake is used instead of the optional internal brake the BRKC com mand allows automatic and interrupt driven control of the external brake via I O port pin G BRKG is a re direction of the same signal that would otherwise control an internal brake As a result Port G will follow the state of the internal brake pin Port G will be active low zero volts when ever the brake should be engaged and at 5VDC when ever the brake should be disengaged The logic state follows the present Brake control method chosen See BRKSRV BRKTRJ BRKENG and BRKRLS for more Example UGO Assign Port G to be used as an output pin BRKG re direct brake control to port G pin BRKRLS will set port G to OVDC BRKENG will set port G to 5VDC 68 Related Commands BRKENG BRKRLS BRKSRV BRKTRJ BRKC BRKG BRKI Brake Control Re Direct to Port APPLICA
20. b GETCHR c GETCHR PRINT 13 Received ASCII a PRINT 13 Received ASCII b PRINT 13 Received ASCII c PRINT 13 Issuing CMD CMD IF a 82 GOTO10 ENDIF check for R IF b 80 GOTO10 ENDIF Voheck for p IF c 32 GOTO10 ENDIF check for space character PRINT 13 Use SMI to send RP command PRINT 13 You should see a motor response 13 END c10 PRINT 13 PROGRAM DID NOT RECEIVE RP COMMAND PRINT 13 PROGRAM ABORTING 13 96 Related Commands CMD CMD1 DAT DAT1 Accept Data Input Only RS 485 APPLICATION Serial communications control DESCRIPTION Set serial communication channel 1 to receive data EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Applies to Com Channel 1 Alternate RS 485 Port REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Command channel FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION By default anything received over the secondary serial port is interpreted as a com mand By configuration however incoming information can be parsed as general data instead of actual command data The DAT1 applies to the secondary Com channel 1 port and will simply store incoming bytes in the 16 character serial buffer without attempting to execute any of that data The characters are read from the buffer with the GETCHR1 command while the LEN1 fu
21. n UFI Store state of I O pin F as digital input into variable name n PRINT 13 REPORT PIN F Input Rn END RUF Directly Report Port F logic State gt 4 76 firmware only n U amp 32 Bitmask Port F to the variable n gt 4 76 firmware only Rn Report Result 321 Related Command UF UFA UFO UFI as input value Read I O Port F Logic State APPLICATION I O input DESCRIPTION Input at Pin F EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UFI READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line F serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input the AniLink clock line and the RS485 B signal While user I O line F defaults to being the AniLink clock line it can be explicitly set up as a digital input with the UFI command If I O line F has been set to an output with the command UFO it can be reset to be an input with the command UFI EXAMPLE UFI Initialize U ser defined I O pin F as I nput PRINT 13 PIN E Input UFI n UFI Store state of I O pin F as digital input into variable name n PRINT 13 REPORT PIN F Input Rn END RUF Directly Report Port F logic State gt 4 76 firmware only n U amp 32 Bitm
22. tion PWM saturation uncontrollable servo behavior The default value is 0 PRINT KG 13 and RKG both report the value of KG through the primary serial port while PRINT1 KG 13 sends it out channel 1 KG is valid with any expression and can be treated as if it were any read write variable The motion and servo characteristics are unaffected until KG is applied by the F function EXAMPLE KG 10000000 Set buffered Gravity Term F Update Filter 141 Related Commands KL KA KD KG KP KS KV Ki expression PID Integral Compensation APPLICATION PID filter control DESCRIPTION Integral gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive total integral limited by KL REPORT COMMAND RKI READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 32767 TYPICAL VALUES 0 to equal that of present KP DEFAULT VALUE Motor size dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The KI term sets the integral gain of the PID filter The integral compensator is not for stability Raising it too far will cause the motor to become unstable The KI command is designed to compensate for friction in the system Since the amount of power sent to the motor is proportional to the distance it is from its target position there comes a time close to the target where the small position error is creating too small of
23. 23 26 29 32 34 35 36 37 38 39 40 43 44 45 47 49 50 52 53 54 55 57 58 60 61 63 64 66 Language reference table of contents continued BRKENG BRKG BRKI BRKRLS BRKSRV BRKTRJ BREAK C statement_label_number CCHN type channel CHN CHNO CHN1 CLK CMD CMD1 CTR D expression DAT DAT1 DEFAULT DIN port channel DOUT port channel expression E expression ECHO ECHO_OFF ECHO1 ECHO_OFF1 ELSE ELSEIF ENCO ENC1 END ENDIF ENDS EPTR expression Brake Engage Brake Control Re Direct to Port G Brake Control Re Direct to Port Brake Release Brake Engage When Not Servoing Brake Engage With No Active Trajectory Program Flow Loop Exit Control Program Subroutine Label Close Communications Channel Combined Communications Error Flag Communications Error Flag RS 232 Communications Error Flag RS 485 Hardware Clock Variable Accept Command Input RS 232 Accept Command Input RS 485 Second Encoder Step and Direction Counter Set R elative Distance Accept Data Input Only RS 232 Accept Data Input Only RS 485 Switch Case Structure Element Input Byte From I O Device Output Byte to I O Device Set Allowable Position Error Echo Incoming RS 232 Data Turn RS 232 Echo Off Echo Incoming RS 485 Data Turn RS 485 Echo Off IF Structure command flow element IF structure command flow element Set Restore Internal Encoder for Servo Select External Encoder for Servo End Program Code E
24. EXAMPLE SADDR1 Set address to 1 When given a non zero address a SmartMotor begins to listen to commands after it receives its own unique address or the global address byte from the network There is no need to repeat the address byte with subsequent commands intended for the same motor The particular SmartMotor will continue to listen to commands until it receives a different address byte after which commands are ignored The echo func tion of the SmartMotor is not affected by the addressed state That is if told to echo a SmartMotor will continue to echo regardless of whether it is listening to commands Continued n next page 272 Related Command ADDR SADDR continued Set Motor Address EXAMPLE Example Auto Addressing for 4 SmartMotors via SADDR command on an RS 232 Daisy chain This program code would be run at the same time in all motors on the chain at power up ECHO Enable ECHO mode a 1 User variable a to set address WAIT 2000 Wait about 1 2 second to allow power up to each motor PRINT 128 a atl 13 Print downstream to each motor WAIT 2000 Wait about 1 2 second for each motor to ECHO through the same string to the next motor Note At this point each motor will have run the exact same code causing successive motors downstream to receive the same command string from the number of motors upstream
25. Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Although its default function is to be the left limit input user I O line D can function as a TTL output The command UDO specifies the I O pin D as an output while UD value sets the voltage I O pin D will be a logic high voltage if UD 1 and a logic low voltage if UD 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UDA function In order for the output voltage to reflect the state of UD both UDO and UD value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UDO and UD 0 have been issued You only have to issue UDO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE UDO define PIN D output UD 1 set output latch value PRINT UDO recall the latch value response is 1 UD 0 set output latch value PRINT UDO recall the latch value response is 0 313 Related Command UEA UEI UEO UE expression Set I O Port E Output Logic State APPLICATION I O control DESCRIPTION Set Pin E output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT V
26. KA READ WRITE N A LANGUAGE ACCESS N A UNITS PID coefficient RANGE OF VALUES 0 to 32767 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKA reports the signed value of the buffered PID acceleration feed forward gain value KA No leading Zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KA 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 The KA gain factor is only applied in position MP and velocity MV moves Unlike the KV gain the effectiveness of KA is difficult to verify Future implementation will most likely be modified The buffered KA value is not effective until a load filter command F is issued RKA Report present buffered KA 248 Related Command F KI KL KP RKD Report Derivative Gain Tuning Value APPLICATION Report command DESCRIPTION Report buffered differential gain EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE KD READ WRITE N A LANGUAGE ACCESS N A UNITS PID coefficient RANGE OF VALUES 0 to 32767 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION
27. N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION END terminates execution of a user program if running END may be issued via serial communications channels or from within the user program itself Each program must have a minimum of at least one END statement The windows interface SMI scanner will not compile a source file without at least one END present END only terminates the user program and internally resets the program pointer to the begin ning of the program no other state variable mode or trajectory is affected The SMI program provides a speed bar button to send END This is especially useful when something prevents the user from fully typing END at the terminal screen EXAMPLE IF Be END ENDIF terminate user program upon position error Note All PLS firmware Motors automatically issue END upon receiving any of the following error conditions Be Position Error BI Left Travel Lmit Br Right Travel Limit Bh Over Temperature RMS Over Current Please consult PLS firmware documentation for more details and options around this 114 Related Command IF exp ELSE ELSEIF exp Every IF structure must be terminated with an ENDIF ENDIF End IF Statement APPLICATION Program execution control DESCRIPTION IF expression ENDIF control block terminator EXECUTION N A CONDITIONAL TO There must exist a correspondin
28. N A REPORT COMMAND RBb READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Zb resets system flag Bb the parity error violation latch to zero A parity error indi cates that the communications has failed at a fundamental level For safe operation it is vital to find and eliminate the cause if this error flag is ever set EXAMPLE IF Bb PRINT Parity Zb ENDIF Test flag Error Reset flag 345 Related Command Be RBc APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LANGUAGE ACCESS LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES RESET VALUE FIRMWARE VERSIONS Zc Reset Comms Buffer Overflow Flag Program execution control Reset communications buffer overflow latch Immediate N A N A N A RBc N A N A N A N A N A 0 4 00 and higher DETAILED DESCRIPTION Zc resets system flag Bc the serial communication receive buffer overflow violation latch to zero If the communication buffer overflows the SmartMotor may receive a garbled or partial data byte For safe operation it is vital to find and eliminate the cause if this error flag is ever set EXAMPLE IF Be Test flag PRINT Buffer Overflow ZC ENDIF Reset flag 346 Related Command Bd RBd
29. Non zero FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION RCS1 reports the accumulated channel 1 checksum value to the primary serial channel No leading zeros are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return There is no equivalent PRINT command There is no CS1 command or function You cannot print or assign a variable to CS1 The RCS1 checksum value is the simple 8 bit sum of all the ASCII bytes received by the channel 1 serial channel RCS1 resets the channel 1 checksum to zero after reporting the current value See the ASCII Table appendice to map character to ASCII value In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis ifthe report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE see example RCS for additional explanation 2 RCS1 response is 8 Mod 8 82 67 83 32 264 256 8 A 112 RCS response is 58 Mod 8 654 614 49 494 504 32 82 67 83 32 570 512 58 A 113 RCS1 response is 59 which is as expected one more than before 241 Related Command CTR ENCO ENC1 MC MFO MFR MSO MSR RCTR Report Secondary Encoder Counter APPLICATION Report command DESCRIPTION Report external encoder counter valu
30. RETURN Then from terminal type RKK GOSUB5 237 Related Command CCHN OCHN RCHNO RCHN1 RCHN1 Report Secondary Serial Port Status APPLICATION Report command DESCRIPTION Report serial communications channel 1 status flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE CHN1 READ WRITE N A LANGUAGE ACCESS N A UNITS Binary states RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 to 15 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION RCHN71 returns the value of the historical communications function CHN1 The read only function CHN1 holds binary coded historical error information about the two serial channels on the SmartMotor It gives the 4 bit status of either serial port channels 0 or 1 broken down as follows CHN1 bit 0 1 if either receive buffer has overflowed CHN 1 bit 1 1 if a framing error occurred on either channel CHN1 bit 2 1 if a scan error occurred on either channel CHN 1 bit 3 1 if a parity error occurred on either channel No leading zeros are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return The equivalent PRINT command is PRINT CHN1 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response
31. SWITCH a Check he value of a CASE 1 SADDR1 Set Address to 1 GOSUB10 BREAK CASE 2 SADDR2 Set Address to 2 GOSUB20 BREAK CASE 3 SADDR3 Set Address to 3 GOSUB30 BREAK CASE 4 SADDR4 Set Address to 4 GOSUB40 BREAK ENDS END 273 Related Command TALK TALK1 SILENT1 These commands are almost always sent from a host rather than existing within a program SILENT Silence Primary Port Outgoing Communications APPLICATION Serial communication control DESCRIPTION Motor prevented from sending channel 0 responses to commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE TALKO state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The SILENT command causes the SmartMotor to suppress all internally originating serial communication messages intended for the channel O primary port It does not prevent the SmartMotor from sending messages in response to incoming serial report commands from the host and it does not interfere with ECHOing received serial communication over channel 0 This command is most commonly used when sending a new program to an individual SmartMotor mounted in a networked system In order to guarantee that the program arrives as sent it is required that all other motors in the array be silent during download The TALK c
32. WAIT w Wait time 8 seconds 337 Related Command SLEEP SLEEP1 WAKE1 The SLEEP and WAKE commands are only sent from a host never part of a SmartMotor program WAKE Enable Open Communications on Primary Port APPLICATION Serial communication control DESCRIPTION Motor to execute all communications channel 0 commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE WAKE state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION WAKE clears the SLEEP condition of a SmartMotor A SmartMotor that has been put to SLEEP rejects all commands received through the primary port but WAKE WAKE is intended to be used from the host terminal while programs are being down loaded to other motors but is is perfectly valid from within a user program 338 Related Command SLEEP SLEEP1 WAKE1 WAKE1 Enable Open Communications on Secondary Port APPLICATION Serial communication control DESCRIPTION Motor to execute all communications channel 1 commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE WAKE state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION WAKE1 clears the SLEEP1 condition of a SmartMotor A
33. abf al and aw aa ZZZ 32 Bit Variables APPLICATION General purpose data control DESCRIPTION User signed 32 variables EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS This data space is shared with ab aw alf arrays and coordinated motion see mode MD REPORT COMMAND Raa Rzzz READ WRITE Read Write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Signed 32 bit Integer RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor has three groups of pre defined user variables The second and third group consists of the variables aa through zz and aaa through zzz They are general purpose Read Write 32 bit signed integer variables that can be reported and used on either side of an equal sign in an equation All variables aa thru zzz are stored in Dynamic RAM meaning Their values are lost when power is lost The value of any variable aa through zzz variable is reported with the R PRINT or PRINT1 functions EXAMPLE Rgg Report the value of gg to the primary serial port PRINT gg gg 13 Print to the primary serial port PRINTI gg gg 13 Print to the secondary serial port Unlike the variables set a through z the variables aa through zz and aaa through zzz are overlaid with the variable arrays ab aw and al As signe
34. c10 IF CHNO PRINT PRINT PRINT PRINT ENDIF RETURN communication status check subroutine check both serial channel simultaneously return immediately if no errors found PARITY ERROR STATE RBb BUFFER OVERFLOW STATE RBc FRAMING ERROR STATE RBE SYNTAX ERROR STATE j RBS 217 Related Command Z Zd ZS RBd Report Math Overflow Status Bit APPLICATION Report command DESCRIPTION Report system state flag math overflow event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bd READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Math overflow during product calculation or MFMUL MFDIV division has occurred STATE VALUE 0 No math overflow has occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBd reports the value of the MFMUL MFDIV math overflow error flag Bd It returns a 1 if any math overflow error was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bd 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response
35. check for R IF b 80 GOTO10 ENDIF check for Pp IF c 32 GOTO10 ENDIF check for space character PRINT1 13 Use SMI to send RP command PRINTI 13 You should see a motor response 13 END c10 PRINT1 13 PROGRAM DID NOT RECEIVE RP COMMAND TU RINT1 13 PROGRAM ABORTING 13 ND m 98 Related Commands BREAK CASE ENDS SWITCH DEFAULT Switch Case Structure Element APPLICATION Program execution control DESCRIPTION Default for SWITCH program control block EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Must reside within a SWITCH and ENDS structure REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION DEFAULT allows controlled code execution in a SWITCH structure for non CASE evaluated results In the following example DEFAULT is used when no VASE can be executed for the value of x EXAMPLE 1 SWITCH x CASE 1 PRINT x 1 13 BREAK CASE 2 PRINT x 2 13 BREAK CASE 3 PRINT x 3 13 BREAK DEFAULT PRINT x does not equal 1 2 or 3 13 BREAK ENDS The first line SWITCH x lets the SmartMotor know that it is checking the value of the variable x The second line CASE 1 begins the section of code that tells the SmartMotor what to do if x is equal to 1 Simi
36. open RS485 channel 1 IF Bb PRINT SERIAL PARITY ERROR Zb clear Parity Error status bit ENDIF 39 Related Commands CHN CHNO CHN1 Z Zc ZS OCHN RCHNO RCHN1 Bc Communications Overflow Status Bit APPLICATION Monitor Serial Communications DESCRIPTION Serial Communications Receive Buffer overflow occurred EXECUTION Historical latched by Buffer Overflow detection CONDITIONAL TO Serial port buffer overflow LIMITATIONS None REPORT COMMAND RBc RCHN bit0 RCHNO bit0 RCHN1 bit0 READ WRITE Read only To reset to zero issue Ze command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 3 00 and higher DETAILED DESCRIPTION Version 4 00 and higher motors have a software serial receive buffer maintained by the firmware The buffer length is 16 characters If a motor receives serial characters faster than the command interpreter can read them the buffer will eventually overflow and Bc is set to 1 An error routine can be written to recover from such a failure In any serial daisy chain link if characters are transmitted to the motors with no inter mission between characters the motors can get behind eventually overflowing the motors input buffer The generally accepted solution is to put a delay between char acters between commands or between long blocks of characters In the case of the S
37. process incoming data maintain reference index will be equal to LEN 148 Related Command LIMH LIML LIMN LIMD Enable Directional Travel Limits APPLICATION Travel Limit switch controL DESCRIPTION Limit switches have directional property EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT PROPERTY Limits are non directional FIRMWARE VERSIONS 4 15 and 4 40 non PLS firmware only DETAILED DESCRIPTION LIMD Limit Directional specifies the way the SmartMotor responds to a G com mand while any limit input is active LIMD prevents motion further into or past the detected limit LIMD can be cancelled by LIMN Limit non directional which allows movement further into the limit Neither of these commands change the response of the motor when it encounters a limit after already in motion Basic Effects of LIMD are as follows If the Positive Limit is active and the motor is commanded in the positive direction it will fail to move If the negative limit is active and the motor is commanded in the negative direction the motor will fail to move In both cases above LIMD has prevented further motion beyond the detected travel limit In contrast if the negative limit is active and motion is commanded in the positive direction motion will be allowed If the positive limi
38. the default Off State mode when OFF is issued Please see MTB command for more details 188 Related Command P PE A P expression Set Commanded Absolute Position APPLICATION Trajectory control DESCRIPTION Set trajectory target position EXECUTION Buffered pending a G command CONDITIONAL TO A E G MP and V LIMITATIONS A V and E all non zero for real time position to change REPORT COMMAND RP READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION To specify an absolute target position to the SmartMotor s positional origin set P target position positive or negative and then follow with a G command P expression sets the target position in Position Mode Unless a subsequent D expression is issued and as long as the appropriate tra jectory parameters A and V the motor will move to position specified by the last requested P value when the G command is issued The Mode of operation will be Absolute Positon Mode The RMODE command will respond with P RP will report the actual position but if you set a variable equal to P such as a P that variable will be loaded with the last entered target position rather than the actual position If you want to use the actual position in your program
39. the trajectory flag Bt is reset to 0 and the position error flag Be is reset to 0 The motion is not restricted by the present E value Issuing E 0 would have no effect upon the present motion The drive stage is still subject to the currently defined activity of the limit switches In all firmware gt 476 any prior faults must be cleared prior to accepting the MT command Continued on next page 284 Related Command MT RT T expression continued Set Open Loop Commanded Torque Value Amplifier mode MD50 DOES EFFECT the value of T To change from mode MD50 to mode MT issue the sequence OFF T value MT EXAMPLE UAI Set I O A as Input T 0 Initialize T 0 MT Enter Mode Torque ci Label 1 Loop Forever a UAA 512 Read User defined I O pin 10 bit analog reading range is 0 to 1023 from 0 t SVDE 2 5 V 0 Torque T 2 a Result 1023 to 1023 values from 0 to 5VDC GOTO1 GOTO LABEL 1 END The above example will track an incoming analog signal from 0 to 5 Volts UAA 0 to 1023 and assign it to the T torque value of 1023 to 1023 285 Related Command SILENT SILENT1 TALK1 These commands are almost always sent from a host rather than existing within a program TALK Enable Outgoing Messages on Primary Port APPLICATION Serial communication control DESCRIPTION Normal channel 0 communications mode EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT
40. 0 If it less than or equal to zero PRINT position is lt to zero 13 R isk PRINT position is between zero and 100 13 ENDIF Continued on next page 137 Related Commands ELSE ELSEIF ENDIF Every IF struc ture must be terminated with an ENDIF IF expression continued Example 5 Binary Bit Mask Comparison a 10 binary b 5 binary c 7 binary d 1 binary e 0 binary ENDIF IF a d ENDIF IF alb ENDIF IF dle ENDIF b c ty NDIF m m Z o 1010 0101 0111 0001 0000 PRINT This is true t 13 even though e is zero PRINT This will prin t 13 13 Are any bits in common with PRINT This will never PRINT 13 Are there any bits that are PRINT This will prin dis Conditional Program Code Execution Compare a and 2 as binary numbers bit for it PRINT This is true because 2 is 0010 13 a AND d 1 in either number Nnon Zero 138 Related Commands F RKA KD KG KI KL KP KS KV KA expression PID Acceleration Feed Forward APPLICATION PID filter control DESCRIPTION Acceleration feed forward gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKA READ WRITE Read write LANGUAGE ACCESS Expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 65535 TYPICAL VALUES 0 to 3000 DEF
41. 100000 Set Velocity A 100 Set Acceleration MV Set to Velocity Mode G Start Moving END C2 This routine gets called automatically when Port G goes low PRINT Port G grounded when 13 PRINT position P 13 RETURNI SAMPLE TERMINAL SCREEN OUTPUT FROM ABOVE CODE Port G repeatedly grounded Port G grounded when position 226076 Port G grounded when position 257022 Port G grounded when position 271849 Port G grounded when position 279430 Port G grounded when position 295069 48 Related Commands RCKS RW RPW LOAD UPLOAD VST Bk User Program Checksum Error Status Bit APPLICATION EEPROM data validation DESCRIPTION EEPROM Checksum Failure State EXECUTION Historical set on eeprom data check CONDITIONAL TO RCKS VST or RES calibration data check LIMITATIONS Stored EEPROM program is SMX formatted REPORT COMMAND RBk RW bit 15 RPW bit 15 READ WRITE Read only reset by RCKS and first post reset RES command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE DEFAULT VALUE 0 valid EEPROM user program checksum and valid VST 1 Invalid EEPROM user program checksum or invalid VST 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Bk indicates whether a user program checksum write error has been detected If Bk is 1 either the user program and or program header has been cor
42. 333 returns the value 444 212 Related Command AOUT DIN DOUT RAIN port input Report Expanded Analog Input Value APPLICATION Report command DESCRIPTION Fetch and report Anilink peripheral analog input byte EXECUTION Immediate IIC byte read followed by transmit character CONDITIONAL TO Port and input must exist LIMITATIONS Port A H and Input 1 2 3 or 4 REPORT VALUE AIN port input READ WRITE N A LANGUAGE ACCESS N A UNITS Unsigned numerical value RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE If requested input does not exist the value 255 is returned FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RAIN address channel fetches the unsigned 8 bit data value from the AlO 100 AniLink and reports it to the primary serial channel The parameters address and channel refer to address and input channel respectively of the expansion card No leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT AIN address channel 13 Address may beA B C D E F G or H which is defined by jumper settings on the corresponding peripheral The range of valid channels is 1 through 4 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is t
43. 43 and another if it isn t EXAMPLE IF g 43 PRINT Gee 43 13 ELSE PRINT No 43 for me 13 ENDIF The first line checks to see if g is equal to 43 If so the string Gee 43 is sent out the primary serial port The ELSE in line 3 tells the SmartMotor what to do otherwise An IF control block can only have at most one ELSE If such an ELSE exists and the language interpreter evaluates the IF expression to be false zero and there are no ELSEIF statements then program will branch immediately to the statement following the ELSE If there are ELSEIF expression clauses within the control block all the ELSEIF clauses must precede the ELSE clause In these cases the ELSE clause is only executed in if both the IF expression is false zero and all the ELSEIF expressions are false zero 108 Related Commands ELSEIF exp ENDIF IF exp ELSE continued IF Structure command flow element ELSE is analogous to the DEFAULT case for a SWITCH control block ELSE is not a valid terminal command it is only valid within a user program EXAMPLE a 1 PRINT FALSE is always executed IF a PRINT TRUE ELSE PRINT FALSE ENDIF EXAMPLE IF a only af a is NOT ly 2 or 3 will GOSUB5 be executed GOSUB2 ELSEIF a 2 GOSUB3 ELSEIF a 3 GOSUB4 SE GOSUB5 ENDIF 109 Related Commands ELSE ENDIF IF exp ELSEIF I
44. A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A PARAMETERS Type RS2 RS4 Channel 0 or 1 RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION CCHN type channel closes the specified communications channel where type is the communications mode and channel is the comm port you want to close This command flushes the serial port buffer and any characters still in the buffer will be lost The channel 0 comm port can only be RS 232 or RS 485 while channel 1 can only be RS 485 Valid CCHN commands CCHN RS2 0 Close the channel 0 RS232 port CCHN RS4 1 Close the channel 1 RS485 port After power up or Z reset command channel 0 is opened as RS232 by default 78 Related Commands Bb Bc Bf Bs CHNO CHN1 Zs CHN Combined Communications Error Flag APPLICATION Serial communications control DESCRIPTION Fetch combined serial communications error event flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Cannot assign value of CHN REPORT COMMAND RCHN READ WRITE Report value only LANGUAGE ACCESS Report via RCHN only UNITS Set of 4 binary state flags PARAMETERS Type RS2 RS4 or IIC Channel 0 or 1 RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The read only function CHN holds binary coded historical err
45. COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE TALK state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION TALK restores the motor s ability to print messages to the serial communication channel O if that ability was previously suppressed with the SILENT command This command is most commonly used following the download a user program to a SmartMotor within a daisy chain It could also be used to un silence a debug routine TALK may be issued from the terminal or within a user program 286 Related Command SILENT S ILENT1 TALK TALK Enable Outgoing Messages on Secondary Port APPLICATION Serial communication control DESCRIPTION Normal channel 1 communications mode EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE TALK1 state FIRMWARE VERSIONS ALL DETAILED DESCRIPTION TALK 1 restores the motor s ability to print messages to the serial communication channel 1 if that ability was previously suppressed with the SILENT1 command This command is most commonly used following the download a user program to a SmartMotor within a daisy chain It could also be used to un silence a debug routine TALK1 may be issued from the terminal or within a user program 287 Related Command
46. Camming Mode CAM 2X Multiplier Mode CAM 4X Multiplier Mode CAM 8X Multiplier Enable Direct Analog Input Drive Mode Enable Quadrature Input Counter Mode Enable Mode Follow Raw Resolution Enable Mode Follow Half Quadrature 118 120 122 123 126 129 130 131 133 134 136 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 155 156 158 160 161 162 163 164 166 167 Language reference table of contents continued MF4 MFDIV MFMUL MFR MP MS MSO MT MTB MV O expression OCHN OFF P expression PID PRINT PRINT1 PRINTA PRINTH Q Ra Rz Raa Rzz Raaa Rzzz Rabf index Ral index Rall index continued Raw index RA RAIN port input RAMPS RBa RBb RBc RBd RBe RBf Enable Mode Follow Full Quadrature Set Mode Follow Divisor Set Mode Follow Multiplier Calculate Enable Mode Follow Ratio Enable Position Mode Enable Mode Step Enable Step Direction Counter Mode Enable Torque Mode Enable Mode Torque Brake Enable Velocity Mode Set Main Position Counter Open Set up Communications Channel Turn Off Drive Stage Set Commanded Absolute Position P I D Tuning Filter Control Print to Primary Communications Port Print to Secondary Communications Port Print to External LCD Display Report Host Mode Status Report 32 Bit Variable Data Value Report 32 Bit Variable Data Value Report 32 Bit Variable Data Value Report 8 Bit Array Data Value Report 3
47. END GOSUB RUN RUN STACK continued Clear Stack Pointer Register EXAMPLE co GOTO1 C7 PRINT 13 NO PROGRAM CRASH RETURN END GOSUB1 C1 GOSUB2 C2 GOSUB3 C3 GOSUB4 C4 GOSUB5 C5 GOSUB6 sixth GOSUB without return c6 STACK reset internal stack GOSUB7 allowing a seventh GOSUB PRINT 13 RETURN FROM GOSUB7 OK END The example above is not a good way to write code It is just a means to explain where the STACK command would be used to prevent program crashes Often times the STACK command is used after an error or motor protection fault is detected Then immediately after the STACK command either RUN END or GOTO location near top of program is issued to recover 281 Related Command BREAK CASE number DEFAULT ENDS SWITCH expression Selectable Program Flow Control APPLICATION Program execution control DESCRIPTION Multiple choice branch for program execution EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Can only be executed from within user program REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SWITCH command allows program flow control based on specific integer values of an expression or specific parameter or variable At execution runtime the program interpreter evaluates the SWITCH expression value
48. ENDIF de bounce position error IF PE GOTO10 ENDIF IF PE GOTO10O ENDIF IF PE GOTO10 ENDIF t CLK a Store clock into variable t measure settling time PRINT 13 DECLARED AS SETTLED PRINT 13 SETTLING TIME GOSUB20 PRINT GOSUB20 PRINT seconds RETURN C10 subroutine label 10 PRINT 13 POSITION ERROR RPE report position error GOTOS C20 Subroutine label 20 perform long divide s t 4069 PRINT s p s 4069 r t p t 10 r RETURN fel Z lem 257 Related Command RPW RW APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS RS Report 8 Bit System Status Byte Report command Report motor status bits Immediate N A N A S N A N A 8 motor status bits 0 to 255 0 to 255 128 Motor OFF ALL DETAILED DESCRIPTION RS reports the unsigned value of the present SmartMotor status byte S No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT S 13 As does RW RS resets the Bh BI and Br flag values to zero A summary of S the motor status byte is Bo Motor OFF Bh Excessive temperature Be Excessive position error Bw Encoder wrap around Bi Index report available BI Historical negative limit Br Historical positive limit Bt Trajectory i
49. LIMITATIONS Requires external encoder signal source MC2 REPORT COMMAND RMODE MC4 READ WRITE N A MF1 LANGUAGE ACCESS N A MF2 UNITS N A MF4 RANGE OF VALUES N A MS TYPICAL VALUES N A SIZE DEFAULT MODE MP FIRMWARE VERSIONS Version 4 10 and higher DETAILED DESCRIPTION Same as mode MC in all regards with exception that all data points in the CAM table are multiplied by 8 Suppose the following CAM table aw 0 0 10 20 30 40 50 40 30 20 10 0 The CAM motor would normally move through points 0 10 20 30 etc But if MC is replaced with MC8 the CAM motor would instead mover though points 0 80 160 240 320 400 320 240 160 80 and back to zero See the MC command for full details on CAM mode 162 Related Command N A MD50 Enable Direct Analog Input Drive Mode APPLICATION Motion mode control DESCRIPTION Request MODE ANALOG AMPLIFIER EXECUTION Immediate CONDITIONAL TO Analog signal input available LIMITATIONS N A REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS 4 15 and 4 40 series only DETAILED DESCRIPTION MD50 converts the SmartMotor into a simple analog amplifier with motor It accepts a 0 to 5V analog signal from I O Port A pin with a 10 Bit A D resolution It is center weighted such that 2 5VDC gives zero PWM 5VDC gives full positive PWM and OVDC gives full negative PWM S
50. LINE Print starting from character block 148 18 character 374 line Four line LCD4X20 only PRINTA 212 4th TEXT LINE Print starting from character block 212 18 character fourth line Four line LCDX20 only 198 Q Report Host Mode Status Related Command APPLICATION Report command MD DESCRIPTION Request HOST MODE status packet EXECUTION Immediate CONDITIONAL TO MD host mode LIMITATIONS REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS Data packet see detailed description RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 15 and later DETAILED DESCRIPTION SEE SMI DOCUMENTATION FOR HOST UTILITY Host Position Status Request Command Q Returns BINARY data only To track host positioning mode progress the Q command returns status clock and space available in the dedicated circular buffer The response to Q takes two forms one while the mode not running and another while a trajectory is progress and no error has occurred Both response conform to the overall byte format of OxF9 byte1 byte2 byte3 byte 4 in binary See diagram below ENGNG CONC CT o T 0 1 if In MD Mode prior to filling buffers slot or G received 1 if In MD Mode and Running Either G received or 16 slots were filled 1 if Invalid Time Delta 16 bit value received 1 if Invalid Position Delta 23 Bit value received 1 if Internal
51. Logic State APPLICATION I O input DESCRIPTION Input at Pin A EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UAI READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0or1 DEFAULT VALUE I O dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line A serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input secondary encoder input A or the step input in Step and Direction Mode User I O line A defaults to being a general purpose TTL input It can be accessed with the statement variable UAI PRINT UAI 13 or WHILE UAI LOOP The digital read occurs once at the time the UAI command is executed Assigning the variable a UAI will perform the digital read once and store it into the variable a If I O line A has been set to an output with the command UAO it can be reset to be an input with the command UAI EXAMPLE UAI Initialize U ser defined I O pin A as I nput PRINT 13 PIN A Input UAT n UAI Store state of I O pin A as digital input into variable name n PRINT 13 REPORT PIN A Input Rn END RUA Directly Report Port A logic State gt 4 76 firmware only n U amp l Bitmask Port A to the variable n gt 4 76 firmware only Rn Report Result 295 Related Command UA UAA UAI UAO as command Set I O Port A to Output APPLICAT
52. N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS DETAILED DESCRIPTION 4 00 and higher Each SWITCH expression must have a corresponding ENDS block exit statement Any program statement immediately following ENDS is the common exit point branched to upon processing the SWITCH ENDS control block regardless of execution path through the control block at run time There can only be one ENDS statement for each SWITCH statement The common exit point following ENDS is branched to upon the following 1 Upon encountering a BREAK 2 Upon encountering ENDS 3 The SWITCH expression value is not equal to any CASE number value and there is no DEFAULT statement label for the control block ENDS is not a valid terminal command it is only valid within a user program EXAMPLE SWITCH x CASE CASE CASE ENDS This is E O A N the PRINT x 1 13 PRINT x 2 13 PRINT x 3 13 BRI BRI BRI EAK EAK EAK exit point for SWITCH ENDS code block 116 Related Command VST VLD APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE EPTR expression Set Data EEPROM Pointer EEPROM Data storage control Set user data EEPROM pointer Immediate N A N A None Write only EPTR auto incriminated as used Assignment
53. O 12345 present position set to 12345 GOSUB5 D 5000 0 3000 present position set to 3000 GOSUB5 CH iw RINT 13 Move origin is P HILE Bt LOOP AIT 4000 RINT 13 Position is p SS Go QO Kogel RETURN Program output is Move origin is 1000 Position is 5000 Move origin is 12345 Position is 5000 Move origin is 3000 Position is 8000 186 Related Command CCHN RCHN RCHNO RCHN1 APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS OCHN Open Set up Communications Channel Communication control Open a communications channel Immediate External communication i o connections Hardware capabilities RCHN RCHNO RCHN 1 report status conditions N A N A N A See detailed description See detailed description OCHN RS2 0 N 9600 1 8 C 4 00 and higher DETAILED DESCRIPTION OCHN TYPE CHANNEL PARITY RATE STOP BITS DATA BITS SPECIFICATION opens a serial channel with the following specifications TYPE CHANNEL PARITY Serial baud RATE AniLink bit RATE STOP BITS DATA BITS RS2 RS4 or IIC 0 for host 1 O odd E even N none I ignore 2400 4800 9600 19200 38400 bps 100 khz 400 khz 1 8 Serial SPECIFICATION C cmd D data AniLink SPECIFICATION M master S slave Opening channel 0 as a RS4
54. O Port C to Output APPLICATION I O control DESCRIPTION Set Pin C to be an output EXECUTION Immediate CONDITIONAL TO UC 0 or UC 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Although its default function is to be the right limit input user I O line C can function as a TTLoutput The command UCO specifies the I O pin C as an output while UC value sets the voltage I O pin C will be a logic high voltage if UC 1 and a logic low voltage if UC 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UCA function In order for the output voltage to reflect the state of UC both UCO and UC value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UCO and UC 0 have been issued You only have to issue UCO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE UCO define PIN C output UC 1 set output latch value PRINT UCO recall the latch value response is 1 uc 0 set output latch value PRINT UCO recall the latch value response is 0 306 Related Command LIMD LIMH LIML LIMN UC UCA UCI UCP Set I O Port
55. Position Error no matter what check for loss of drive power increased load or locked load 43 Related Commands CHN CHNO CHN1 Z Zf ZS APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Bf Communications Framing Error Status Bit Monitor serial communications Serial communication framing error detected Historical latched by serial communication receive Hardware detection None RBf RCHN bit 1 RCHNO bit 1 RCHN1 bit 1 Read only Reset to zero using command Expressions and conditional testing Binary bit 0or1 0 0 Bf indicates whether a framing error has been detected Every serial byte received by the SmartMotor is checked to see if it has the correct start and stop bits or frame If not Bf is set to 1 If such an error occurs the error recov ery routine is at the discretion of the user In practice unless the environment is electrically noisy this error is unlikely Any data error or syntax error due to noise is potentially dangerous in a motion control environment please take appropriate precautions Note A framing error can occur with slightly mismatched baud rates between two devices as well SmartMotors meet the IEEE specification of baud rate 10 If baud rates exceed that range between tw
56. RCHNO returns the value of the historical communications function CHNO The read only function CHNO holds binary coded historical error information about the two serial channels on the SmartMotor It gives the 4 bit status of either serial port channels 0 or 1 broken down as follows CHNO bit 0 1 if either receive buffer has overflowed CHNO bit 1 1 if a framing error occurred on either channel CHNO bit 2 1 if a scan error occurred on either channel CHNO bit 3 1 if a parity error occurred on either channel No leading zeros are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return The equivalent PRINT command is PRINT CHNO 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 236 Related Command CCHN OCHN RCHN RCHN1 RCHNO continued Report Primary Serial Port Status EXAMPLE download and run the following END c5 test individual flags IF CHNO amp 4 PRINT CHANNEL O scan error occurred ELSEIF CHNO amp 1 PRINT CHANNEL O buffer overflow ENDIF PRINT 13 RETURN c10 test all flags IF CHNO PRINT CHANNEL O SERIAL ERROR ENDIF PRINT 13
57. SmartMotor that has been put to SLEEP1 rejects all commands received through the channel 1 serial port but WAKE 1 WAKE is intended to be used from the host terminal while programs are being downloaded to other motors but is is perfectly valid from within a user program 339 Related Command BREAK LOOP IF SWITCH WHILE expression Conditional Program Loop Flow Control APPLICATION Program execution control DESCRIPTION Defines block of code repeatable while expression is true EXECUTION Immediate CONDITIONAL TO Value of expression LIMITATIONS 6 Deep WHILE loop nesting lt v4 0 firmware No limit gt v4 0 firmware REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES expression values 2147483648 to 2147483647 TYPICAL VALUES expression values 2147483648 to 2147483647 DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The WHILE loop creates a program loop that repeatedly executes as long as a cer tain condition is true or non zero EXAMPLE WHILE expression is true execute program command here LOOP The expression is evaluated the first time WHILE is encountered and each time program execution is sent back to the WHILE by its corresponding LOOP statement If the expression value is zero or false program execution re directs to the code just below the LOOP command Any valid standard Animatics expression can be used In particular WHILE 1 LOO
58. T O B to be active for entire move profile Suppress T O B until Slew Velocity has been reached Enables Port G to Index trigger latch function only in SM2316D DT gt 4 93 firmware Note Only Applies to gt v4 77 only Warning C1 has priority over C2 Ci can be activated when in C2 The F value can be changed on the fly while in an Interrupt subroutine to change its effect An example would be turning off the G interrupt once in C2 to prevent any subsequent calls F Command is Binary Bit flag additive Example F 21 would break down to F 16 4 1 Motor would run CAM Mode relative redirect print statements to port 1 and decelerate on limits 124 Related Command None F expression continued Motor Function Control Example using F 32 for Interrupt driven Fault routine F 32 Enable Cl Fault routine MV Set to Velocity Mode V 10000 Set Speed A 100 Set Acceleration G Start moving in Velocity Mode END C1 Fault Routine Gets called on any of the following Faults IF Be Checking for error status bits PRINT Position Error 13 ENDIF IF Bh PRINT Over Temp Error 13 ENDIF Le Bi PRINT Over Current Error 13 ENDIF IF Bl PRINT Left Positive Travel Limit Error 13 ENDIF IF Br PRINT Right Negative Travel Limit Error 13 ENDIF WHILE 1 Wait for Motor Reset IF r If host sends r 1 via serial port ZS Reset the motor
59. The equivalent PRINT command is PRINT a 13 Use similar PRINT commands for Rb Rc through Rx Ry Rz In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Ra is received through channel 0 the response is sent through channel 0 If Ra is received through channel 1 the response goes out channel 1 In SmartMotors so equipped if F 4 has been commanded this report is redi rected to serial channel 1 and the reported value is not be seen output the primary or currently active serial channel Following F 4 the equivalent to Ra is PRINT1 a 13 F 0 resets report commands to again be sent out the primary or currently active serial port 200 Related Command PRINT EXAMPLE ll oO RINT 13 F 0 OSUBS RINT 13 F 4 OSUBS aie eae atl ws l 0 oO c5 a 123 b 456 c 789 PRINT a b c Ra Rb RC END F 0 123456789123 456 789 Ra Rz continued Report 32 Bit Variable Data Value use HOST channel redirect report output reset to default Host terminal only sees the following program output Take note of the carriage returns not explicitly shown here 201 Related Command N A Raa Rzz Report 32 Bit Variable Data Value APPLICATION Report command DESCRIPTION Report user variable aa EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Not valid
60. To describe the relationship between user assigned variables aa thru zzz and variable arrays ab J al and aw 8 bit Array Variables APPLICATION General purpose data control DESCRIPTION User signed 8 bit variables EXECUTION Immediate CONDITIONAL TO Index values 0 to 203 LIMITATIONS Index limited to number or sum or difference of any a z This data space is shared with variables aa zz aaa zzz arrays aw and al and coordinated motion MD REPORT COMMAND Rab index READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Signed 8 bit number RANGE OF VALUES 128 to 127 TYPICAL VALUES 128 to 127 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor has 8 16 and 32 bit array variable access The 8 bit array takes the form of the variables ab index These are general purpose 8 bit signed integer variables that can be reported used on either side of an equation and used with variables other than 8 bit Like all user variables they are always lower case can be sequentially loaded and are automatically initialized to zero at power up or reset All arrays share memory space with the variables aa through zz and aaa through zzz The syntax of the 8 bit array is ab index which stands for array byte and accepts an index value between 0 and 203 This index can be specified explicitly or though another variable For exam
61. UE expression UEA UEI as command UEI as input value UEO as command UF expression UFA UFI as command UFI as input value UFO as command UG UG expression UGA as input value UGI as input value UGI as command UGO as command UP UPLOAD V VLD variable number VST variable number WAIT expression WAKE WAKE 1 WHILE expression X Z Read I O Port C to Input Set I O Port C to Output Set I O Port C as Positive Over Travel Limit Set I O Port D Output Logic State Read I O Port D as Analog Input Set I O Port D to Input Read I O Port D to Input Set I O Port D as Negative Over Travel Limit Set I O Port D to Output Set I O Port E Output Logic State Read I O Port E as Analog Input Set I O Port E to Input Set I O Port E to Input Set I O Port E to Input Set I O Port F Output Logic State Read I O Port F as Analog Input Set I O Port F to Input Read I O Port F Logic State Set I O Port F to Output Enable Re Enable Port G Sync Functionality Set I O Port G Output Logic State Read I O Port G As Analog Input Read I O Port G Logic Level State Set I O Port G to Input Set I O Port G to Output Complied User Program and Header Upload Standard User Program Upload Commanded Velocity Data EEPROM READ WRITE COMMAND DATA EEPROM READ WRITE COMMAND Pause Program Flow for pre determined time Enable Open Communications on Primary Port Enable Open Communications on Secondary Port Conditional Program Loop F
62. WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 65535 TYPICAL VALUES 400 to 2000 DEFAULT VALUE Motor size dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION KD sets the value of the derivative gain of the PID filter If the PID filter gives stable performance KD is usually the vibration absorbing or damping term For any stable KP value there is an optimum KD value prior to and beyond which the motor will be unstable An effective way to tune the filter therefore is to repetitively raise the KP value and then run the KD term up and down to find the local optimum The point at which the KD term cannot stabilize the servo is the point where KP has gone too far To test each setting twist the shaft of the motor and let it go while looking for abrupt and resolute response The host level tuning utility can be useful in finding the optimum The F command must be issued for a new buffered KD parameter to take effect Typically a KD of 10x KP is a good starting point for any given KP lt 300 PRINT KD 13 and RKD both report the value of KD through the primary serial port while PRINT1 KD 13 sends it out channel 1 KD is valid with any expression and can be treated as if it were any read write variable The motion and servo character istics are unaffected until KD is applied by the F function EXAMPLE KD 2000 set buffered derivative gain F update PID fil
63. a torque for the motor to reach the final target The integral term of the PID filter is generated by taking the sum of the position error of every sample and then multiplying by KI As such it creates a force that is a function of error and time As time passes a few milliseconds and the control sees that a correction is not being made it boosts the signal This boost occurs at a rate set by the KI parameter While you are tuning your motor for stability it is probably a good idea to set KI to zero and then later bring it up until you see that it reliably compensates for the friction of your system The F command must be issued for a new buffered KI parameter to take effect and KL the protective upper limit must be high enough to allow KI to do its job PRINT KI 13 and RKI both report the value of KI through the primary serial port while PRINT1 KI 13 sends it out channel 1 KI is valid with any expression and can be treated as if it were any read write variable The motion and servo character istics are unaffected until KI is applied by the F function EXAMPLE KI 250 Set buffered integral gain F Update Filter 142 Related Command KA KD KG KI KP KS KV KL expression PID Integral Limit APPLICATION PID filter control DESCRIPTION Integral limit EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKL READ WRITE Read write LANGUAGE ACCESS Ass
64. any data received GOSUB5 if so process data ENDIF END c5 ab i GETCHR read and store in data process incoming data i itl maintain reference index RETURN From the above example i will be equal to LEN 147 Related Command GETCHAR GETCHAR1 LEN APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALU ES DEFAULT VALUE FIRMWARE VERSIONS DETAILED DESCRIPTION LEN1 RS 485 data buffer fill level Communication control Number of characters in channel 1 serial receive buffer Immediate Host communication channel open Maximum buffer length is 16 characters None Read only Expressions and conditional testing Number of available characters 0 to 16 0 to 16 0 4 00 and higher LEN1 returns the number of characters placed in the serial communications channel 1 receive buffer which are still awaiting to be processed A serial channel in COMMAND mode will typically return LEN1 as 0 but a serial chan nel in DATA mode may well return a non zero value Testing the value of LEN1 is a good way to see if there is any character for GETCHR to fetch EXAMPLE DAT1 i 0 IF LEN1 GOSUB5 ENDIF END c5 ab i G 1 it1 RETURN From the above example ETCHR1 make serial channel 1 DATA mode any data received if so process data read and store in data
65. but the PID loop is off and the motor is not servoing or running a trajectory For any given torque and no applied load there will be a velocity at which the back EMF of the motor will cause the acceleration to stop and the velocity to hold more or less constant Under the no load condition therefore the T command will control velocity As the delivered torque increases the velocity decreases Note that this means that MT does not regulate torque Instead it delivers a fixed amount of power to the motor coils As motor power is the product of torque and RPM velocity decreases as the delivered torque increases and vice versa MT will immediately turn on the servo and reset any position error The servo off flag Bo is set to 0 the trajectory flag Bt is reset to 0 and the position error flag Be is reset to 0 The motion is not restricted by the present E value Issuing E 0 would have no effect upon the present motion The motion is subject to the currently defined activity of the limit switches 180 MT continued Enable Torque Mode Related Amplifier mode MD50 effects the internal value of T Command ae The Reported value of T will not reflect the effect if switching from MD50 to T exp MT mode To change from mode MD50 to mode MT issue the sequence OFF T value MT TORQUE MODE EXAMPLE UAA will range from 0 to 1023 over an input voltage of 0 to 5VDC UAI Set I O A as Input T 0 Initialize T 0 MT Enter Mode Torque C
66. can be treated as if it were any read write variable The motion and servo character istics are unaffected until KS is applied by the F function EXAMPLE KS 5 Set buffered differential sample rate F Update Filter 145 Related Command KA KD KG KI KL KP KS KV expression PID Velocity Feed Forward APPLICATION PID filter control DESCRIPTION Velocity feed forward gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKV READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 32767 TYPICAL VALUES O to 400 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION KV sets the gain for the velocity feed forward element of the extended PID filter The velocity feed forward element can be thought of as a dynamically proportional adjustment to the PID filter required by the latency of the digital filter with respect to time A zero value for KV disables the term within the filter If you put the SmartMotor into at a relatively high speed velocity move and moni tor the position error with the Status Monitor you will see a constant position error Issue a series of successively larger KV parameters followed by F commands and watch the error reduce to zero The default value for KV is zero acceptable values range from 0 to 65 535 Typically useful values range from 0 to 2000 Cur
67. control DESCRIPTION Load buffered PID filter values into PID filter EXECUTION Next PID sample CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The servo tuning parameters KA KD KG KI KL KP KS and KV are all buffered parameters These parameters once requested take effect only when the F com mand is issued This allows several parameters to be change at one time without intermediate tuning states causing disruptions Tuning parameters can be changed during a move profile although caution is urged A default set of tuning parameters is in effect at power up or reset but are optimized for an unloaded shaft Different motor sizes have different optimal PID default gain values EXAMPLE KP 100 initialize KP to a some value F load into present PID filter G start motion WAIT 40000 KP KP 10 increment the present KP gain value F change into filter END 122 Related Command None F expression Motor Function Control APPLICATION Motor Function control DESCRIPTION Miscellaneous commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RF READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Number RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and
68. data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UEA is read only and can be accessed with the state ment variable UCE PRINT UEA 13 or WHILE UEA gt 200 LOOP The analog read occurs once at the time the UEA command is executed Assigning the variable a UEA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UEA UEA b UEA PRINT 13 REPORT UEA Rb RUEA Directly Report Port E Analog Value gt 4 76 firmware only 315 Related Command UE UEA UEO Set Pin E to be an input APPLICATION I O control DESCRIPTION EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION UEI as command Set I O Port E to Input User I O line E serves many functions It can be a
69. error declared EXECUTION Historical immediate CONDITIONAL TO Position error exceeded E value during trajectory move LIMITATIONS Torque modes have no position error REPORT COMMAND RBe RS bit 5 RW bit 5 RPW bit 5 READ WRITE Read only Reset to issuing a G command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The Be status bit indicates the detection of a position error Each and every PID sample the magnitude of the measured position error is compared to the allowable following error E value set by the user If this value is exceeded the servo will be immediately turned off The Bo bit will be set to 1 The Bt bit will be set to 0 and Be will be set to 1 all at the same time If issued RMODE will return an E This condition is reset by Issuing a G in non PLS Issuing Ze or ZS PLS firmware only EXAMPLE sub component move monitor routine TWAIT wait for trajectory in progress to complete IF Be unsuccessful position error PRINT POSITION ERROR inform host ENDIF Note an extended period of peak over current may result in a position error due to the fact that an over current condition will cause a reduction in power to the motor thereby causing it to fall behind possibly enough to exceed E maxi mum allowable position error If a motor continuously gets a
70. fragment SWITCH v CASE 1 w A zal D AN CASE 2 CASE Won Wt DEFAULT BREAK ENDS The first line SWITCH v lets the SmartMotor know that it is checking the value of the variable v Each following CASE begins the section of code that v 1 v 2 v 23 PRINT v IS NOT ae 13 We 13 ee 13 1 2 OR 23 13 tells the SmartMotor what to do if v is equal to that case EXAMPLE a 3 WHILE a lt 4 PRINT 13 a a SWITCH a CASE 3 BREAK CASE 1 CASE 2 CASE 3 PRINT N BREAK CASE 0 PRINT Z DEFAULT BREAK ENDS a atl LOOP END The output is a 3 NEGATIVE a 2 NEGATIVE a 1 NEGATIVE a 0 ZERO a 1 NO MATCH VALUE a 2 NO MATCH VALUE a 3 MAX VALUE negative test values are valid no EGATIVE no zero test value is valid ERO eh ne test value test expression PRINT MAX VALUE 13 te no BREAK here my te use of BREAK note order is random e default case PRINT NO MATCH VALUE ed not be numerical 283 Related Command MT RT T expression Set Open Loop Commanded Torque Value APPLICATION Motion mode control DESCRIPTION Torque value for MODE TORQUE EXECUTION Immediate CONDITIONAL TO MT issued LIMITATIONS N A REPORT COMMAND RT READ WRITE Read write LANGUAGE ACCESS Assignment expressions and condi
71. in The most common use of BREAK is to end each CASE of a SWITCH control struc ture Without the BREAK statement the program would continue to execute into the next CASE even if it is not true EXAMPLE SWITCH a CASE 1 PRINT Hiya 13 CASE 2 PRINT Lo there 13 PRINT Me here 13 PRINT Urp 13 ENDS If a 2 the SmartMotor will print Lo there If a 1 however the SmartMotor will print both Hiya and Lo there There is no BREAK statement to stop the program from running into case 2 74 Related Commands CASE DEFAULT ENDS LOOP SWITCH WHILE BREAK continued Program Flow Loop Exit Control BREAK could always be replaced by GOTO and this is how it is actually executed using the precompiled program location BREAK has the advantages of not requiring a statement label to define the program branch location and conforming to structured programming methodology BREAK is not a valid terminal command it is only valid from within a user program If you want to be able to break out of a control block by remote terminal commands you will need to use GOTO or GOSUB and appropriate statement labels The exam ple illustrates this concept EXAMPLE a 1 WHILE a PRINT I am still here 13 WAIT 12000 IF a 100 BREAK a 100 could be sent via serial command ENDIF LOOP GOTO20 c10 PRINT EXITED with a 100 13 END C20 PRINT EXITED with
72. is transmitted through channel 1 EXAMPLE 1 Zd RBd returns 0 a 1111111 b 2222222 c a b Re returns 470886558 RBd returns 1 EXAMPLE 2 zd reset Bd MFMUL 257 initialize Mode Follow with Ratio MFDIV 1 MFR RBd returns 1 gt MFR gain too large If a standard 32 bit hand held calculator in decimal mode is used it would also report an error 218 Related Command G RS RW RPW RBe Report Position Error Status Bit APPLICATION Report command DESCRIPTION Report system state flag position error occurred latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Be READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Position error during trajectory motion occurred STATE VALUE 0 No position error during trajectory has occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBe reports the value of the position error flag Be It returns a 1 if a position error was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Be 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response is
73. logic State gt 4 76 firmware n U amp 8 Bitmask Port D to the variable n gt 4 76 firmware Report Result I nput only only 311 Related Command LIMH LIML LIMN UD UDA UDI UDM Set I O Port D as Negative Over Travel Limit APPLICATION I O control DESCRIPTION Set Pin D to be left negative limit input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Limit switch FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line D can be a TTL 0 to 5V input TTL output 10 bit input or act as the negative limit input which is the default state UDM explicitly defines I O pin D to be the negative limit while commands UDI and UDO make it into a TTL input or output respectively disabling the limit behavior EXAMPLE UDI Initialize PIN D as a general purpose input suppress limit behavior a UDI read the input value as a digital value Ra report input value UDM restore default negative limit behavior to PIN D 312 Related Command UD UDA UDI UDO as command Set I O Port D to Output APPLICATION I O control DESCRIPTION Set Pin D to be an output EXECUTION Immediate CONDITIONAL TO UD 0 or UD 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE
74. only EEPROM Address pointer 0 to 7999 lt v4 13 0 32000 gt v4 15 0 to 32000 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION EPTR sets the address location pointer within the Nonvolatile used data EEPROM for the data retrieval read VLD variable number function and data storage write VST variable number function The EPTR value is write only once it is set EPTR auto increments by 1 2 or 4 with each read or write access to the physical EEPROM device according to the present data type EXAMPLE EPTR 4000 Wet hh 1 VST ab 7 VST aw 7 VST x 3 VST x 4 set E MS MNS Ms COre core Core PTR 4000 a 32 bit value EPTR is now 4004 an 8 bit value EPTR is now 4005 a 16 bit value EPTR is now 4007 Store 3 consecutive variables x y z EPTR is now 4007 3 4 or 4019 INVALID EPTR remains 4019 Note You cannot store consecutive variables past their group range In other words you can store any consecutive variables a z or aa zz or aaa zzz within their groups only VST aa 26 VST aa 27 Perfectly Valid INVALID 117 Related Command ES1000 ES400 Set EPROM Read Write Speed APPLICATION EEPROM Read write Control DESCRIPTION Set EEPROM read write rate to 400kz EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND None READ WRITE None LANGUAGE ACCESS N A UNITS Bits pe
75. overflow or wrap around It is therefore advisable to not operate any following mode cam mode absolute position move or relative position move such that wrap around may occur Reset the origin to avoid operating in this region EXAMPLE IF Bw Test flag PRINT Wraparound Occurred Zw Reset flag ENDIF 354 Related Command Za Zb Zc Zd Zf ZI Zr Zs Zu Zw APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE ZS Global Reset System State Flags Program execution control Reset software system latches to power up state Immediate N A None N A N A LANGUAGE ACCESS N A UNITS RANGE OF VALUES TYPICAL VALUES RESET VALUES N A N A N A N A FIRMWARE VERSIONS 4 00 and higher 4 76 and higher see below DETAILED DESCRIPTION Almost any event that occurs within a SmartMotor gets recorded in system flags These flags can be read as part of a program or a host inquiry Once read it is nec essary to reset the flag that records the particular event in order to record the next occurrence ZS resets all of the latched bits in the S status byte and the W status word as well as the th Bs Bu and Bw ree communication status bits Ba Bb Bc Bd Be Bf BI Br ZS performs the following flag resets Za Zb Zc Zd Ze Zf Zl Zr Zs Zu Zw Reset hardware current limit violation Reset serial data parity error Reset communications buffer ove
76. port channel expression Output Byte to I O Device APPLICATION Input control DESCRIPTION Output byte to Anilink digital peripheral EXECUTION Immediate byte write to IIC link CONDITIONAL TO Peripheral output attached to motor LIMITATIONS Port A H and Channel 0 63 REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment to output peripheral only UNITS Number RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE 255 RELATED COMMANDS DIN FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The DOUT Address channel expression command allows eight bits of data to be written to a peripheral I O device such as the DIO 100 or OPTO 1 digital I O expan sion module The value is transmitted via the AniLink communications channel The address parameter must correspond with hardware address jumpers on the periph eral expansion card The Addresses are designated as A B C D E F G or H The channel number which may be from 0 to 63 is device specific Typically it is O thru 8 See the specific peripheral user manual for specific details DIN address channel returns an unsigned 8 bit value ranging from 0 to 255 If the specified card or connection is not present the function will return a value of 255 EXAMPLE 1 sending data to the first 8 outputs of an OPTO 1 on Address A DOUTA0 255 Sets first 8 outputs to 1 DOUTAO 0 Sets first 8 outputs to 0 EXAMPLE 2 setting value to specific bit ou
77. read whenever the SmartMotor powers up or is reset This means that the SmartMotor knows how to jump to any label location even if the 76 Related Commands GOSUBnnn GOTOnnn C statement_label_number continued Program Subroutine Label program has never been run and start executing the program from there This is a common means of making a single program that contains several routines that can be invoked on demand from a host EXAMPLE END CO PRINT Routine 0 13 END Cl PRINT Routine 1 13 END Ce PRINT Routine 2 13 END To run routine 1 the host simply issues GOTO1 to the SmartMotor If the host issues GOTO3 routine 3 is run You can use a similar technique to allow the host to control where the program starts Using GOTOnnn to jump to a location within a SWITCH block may be syntacti cally valid but yield unexpected runtime program execution when CASE number is encountered It is also possible to use IF WHILE and SWITCH to provide such multiple choice program start points EXAMPLES IF ass co G ENDIF GOTO5 valid syntax SWITCH a CASE 1 PRINT 1 c5 CASE 2 PRINT 2 at runtime 2 will be ENDS transmitted END 77 Related Commands OCHN Z CCHN type channel Close Communications Channel APPLICATION Communications control DESCRIPTION Close a communications channel EXECUTION Immediate CONDITIONAL TO N
78. received over the primary serial port is interpreted as a com mand By configuration however both the primary and channel 1 serial ports can treat incoming information as either commands or data The CMD function tells the SmartMotor to interpret information coming into the primary port as standard com mands The alternate to CMD is DAT which causes the SmartMotor to simply store incoming bytes in the 16 character serial buffer The characters are read from the buffer with the GETCHR command while the LEN function holds the number of characters in the buffer WARINING Issuing DAT at the command line will prevent the motor from responding to any further commands via Com 0 RS 232 Port and will essen tially lock you out of the motor It is a good idea to devise a means of invoking CMD via I O or specific serial data if you use data mode See next Page for Examples 87 CMD continued Accept Command Input RS 232 Related EXAMPLE using the default host channel Commands PRINT 13 Default mode is CMD PRINT 13 Issuing DAT CMD1 DAT PRINT 13 Issuing a GETCHR DAT PRINT 13 Use SMI to send RP command 13 DAT1 a GETCHR b GETCHR OCHN c GETCHR PRINT 13 Received ASCII a PRINT 13 Received ASCII b PRINT 13 Received ASCII c PRINT 13 Issuing CMD CMD IF a 82 GOTO1O ENDIF validate user command IF b 80 GOTO1O ENDIF sent via SMI IF c 32 GOTO1O ENDIF PRINT 13 Use SM
79. 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 Animatics Corporation Animatics the Animatics logo SmartMotor and the SmartMotor logo are all trademarks ofAnimatics Corporation Windows Windows 95 98 Windows 2000 Windows NT and Windows XP are all trademarks of Microsoft Corporation Related Commands GETCHR GETCHR1 exclamation point Pause Program Execution APPLICATION Program flow control DESCRIPTION Pauses Program Execution EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Use ENTER key from host terminal REPORT COMMAND None READ WRITE N A LANGUAGE ACCESS Use only within a user program UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS All DETAILED DESCRIPTION The command suspends the user program until a properly terminated character or string is received through the SmartMotor serial port As long as the SmartMotor is in command mode the character or string received will be interpreted as a command The command is useful when debugging new programs and stopping output streams from the motor at runtime The command doesn t affect the trajectory generator or a move in progress See sample code on next page 10 Related Commands GETCHR GETCHR1 exclamation point continued Pause Program Execution EXAMPLE u
80. the move was properly completed EXAMPLE C100 Motion Subroutine MP Mode Position A 100 Set acceleration V 10000 Set velocity P 2000 Set first position G Start Motion TWAIT wait till trajectory is done P 4000 Set next position G Start Motion WHILE Bt While moving similar to TWAIT IF UA GOSUB200 ENDIF LOOP wait till trajectory is done RETURN Return to GOSUB 291 Related Command UAA UAI UAO With this function you could actu ally check if your output is shorted UA expression Set I O Port A Out t Logi c State APPLICATION I O control DESCRIPTION Set Pin A output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0or1 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line A can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN Aas an output set the value of the pin A output latch UA to either 0 or 1 Issue the command UAO if this has not already been issued I O pin A will be a logic high voltage if UA 1 and a logic low voltage if UA 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UAA function EXAMPLE UAO set PIN A to function as a digital ou
81. the shaft position forward or backwards Suppose the motor is set on Mode follow and is following a conveyor at a continuous speed of 1000RPM If the shaft needs to be moved forward 2000 counts you can enter D 2000 V speed relative to machine base and G and the motor will move forward in it s gearing trajectory by 2000 counts This method may be used for printing alignment on electronic line shafts It may also be used for tension control between two motors feeding a product through nip rollers Phase offset moves allow for anti backlash where two motors drive the same gear or load from the same point It may also be used for adjustment and alignment of wide gantries where there may be two X or two Y motors Related Commands CMD CMD1 DAT1 DAT Accept Data Input Only RS 232 APPLICATION Serial communications control DESCRIPTION Set serial communication channel 0 to receive data EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Applies to Com Channel 0 main RS 232 Port REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Command channel See CMD FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION By default anything received over the primary serial port is interpreted as a com mand By configuration however incoming information can be parsed as general data instead of actual command data The DAT applies to the primary Co
82. the trajectory in progress flag Bt It returns a 1 if aa trajectory is in progress and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bt 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE OFF RBt A 555 V 777777 MV G RBt WAIT 8000 T 7 MT RBt WAIT 8000 GOFF WAIT 8000 MF4 RBt END free shaft no trajectory calculation mo Se tor responds with 0 t to Mode Velocity Start trajectory calculation tor responds with 1 t to Mode Torque no trajectory tor responds with 0 Mode Follow starts trajectory calculation motor responds with 1 230 Related Command Z Zu ZS RBu Report Array Index Error Status Bit APPLICATION Report command DESCRIPTION Report write array access error latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bu READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Illegal report array value event occurred STATE VALUE 0 Illegal report array value event has not occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRI
83. then use the P vari able such as a P CONTINUED ON NEXT PAGE 189 Related Command P PE A m MP EXAMPLE MP P 1000 A 100 V 32212 50 G TWAIT P 2000 G TWAIT P 2000 G TWAIT P 1000 G TWAIT P 0 G Ch Se Se Se VS Wa se S P expression continued Set Commanded Absolute Position ange to position mode default power up mode t buffered position to 1000 encoder counts t acceleration t velocity art Motion it for move to be performed t a new buffered absolute target position t a new negative buffered target position 190 Related Command A V WAIT CLK PID P I D Tuning Filter Control APPLICATION PID sample rate control DESCRIPTION Set PID sample rate to basic rate EXECUTION Next PID update CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS PID Modulo samples RANGE OF VALUES 1 2 4 and 8 only TYPICAL VALUES N A DEFAULT RATE PID1 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The PID parameter sets the PID sample rate Valid values are PID1 PID2 PID4 and PID8 PID1 is the default See the RSP Report Sample Period detailed description for determining the actual default sample rate frequency of your SmartMotor The default rate is close to 4000 samples second Each PID sample period the motor firmware scans and updates encoder position trajectory
84. to 0x7FFFFFFF 0x80000000 to Ox7FFFFFFF N A FIRMWARE VERSIONS Version 3 2 firmware version G3 and higher DETAILED DESCRIPTION Direct Mode commands always have the following five byte format a single command byte followed by four data bytes There are three command bytes presently available in hex format OxFE Commanded Position Header Bit OxFD Commanded Velocity Header Bit OxFC Commanded Acceleration Header Bit Note Binary strings set Buffered Values To have them take effect they must also be followed by a G command and a Null Terminator Carriage Return or Space Character EXAMPLE Set Buffered target position to 100 P 100 OxFE 0x00 0x00 0x00 0x64 Set Buffered target position to 2 P 2 OxFE OxFF OxFF OxFF OxFE 13 Related Commands P V A Direct Binary Mode Control continued Binary Trajectory Data Format Set Buffered target velocity to 10000 V 10000 0xFD 0x00 0x00 0x27 0x10 Set Buffered target velocity to 10000 V 10000 OxFE OxFF OxFF 0xD8 0xF0 Set Buffered target acceleration to 1024 A 1024 OxFD 0x00 0x00 0x04 0x00 Note A lt 0 is not valid Since a direct mode command is always in a fixed format it doesn t require an end of line character However to have the buffered values take effect the G character may be directly appended to the end of any direct mode command EXAMPLE Set Buffered target position to 100 and Go P 100 G OxFE 0x00 0x00 0x00 0x64 0x47 0x20 Set Buf
85. to 23 binary places this means that if the exter nal encoder displacement during the motion exceeds 256 256 64 or 4 000 000 counts the G command should be reissued Within this limitation the calculated requested trajectory position is to within one count of mathematical precision 171 Related Command CTR D G MF1 MF2 MF4 MFDIV MFMUL Phase Offset Adjust MFR continued Calculate Enable Mode Follow Ratio In some applications it may be necessary to introduce a phase shift to achieve proper alignment during MFR following To perform this shift parameters D and V are employed to superimpose the corrective phase During a phase shift RD will report the remaining phase dif ference EXAMPLE Aa MFO MFDIV 10 MFMUL 21 MFR D 0 IF Bd GOTO12 ENDIF G D 500 V 5000 RMODE END C12 END reset Bd system flag reset CTR Denominator 10 Numerator 21 Calculate Ratio input 21 external counts resulting motion 10 counts No phase shift gain too large Start Following Implementing Phase Adjust Set Relative Distance Set Relative Velocity Start Phase Adjust Response is X Stop Motion 172 Related Command Oo mo xs For a standard position mode move the SmartMotor requires at a minimum a Position Velocity and an Acceleration MP Enable Position Mode APPLICATION Motion mode control DESCRIPTION Request MODE POSITION
86. to default EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE RS 232 FIRMWARE VERSIONS 3 4x and higher DETAILED DESCRIPTION The RS2 puts the SmartMotor primary serial port into its default operating mode RS232 The command is commonly used to put the primary serial port into RS232 mode after being previously put into RS485 mode with RS4 Among other things RS4 dedicates the I O pin G to make the primary full duplex RS232 channel a half duplex RS485 channel RS2 frees the I O G pin for general purpose use RS2 is also an argument in the OCHN command used to put the target serial port in RS232 mode 260 Related Command CCHN ECHO ECHO_OFF OCCHN RS2 RS4 Set Port G to RS 485 R W Control Pin APPLICATION I O Control DESCRIPTION PIN G is set to support RS485 EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS ECHO_OFF REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE RS232 FIRMWARE VERSIONS 3 4x and higher DETAILED DESCRIPTION The RS4 command puts the primary serial port into RS485 mode This allows you to use a RS232 to RS485 adapter like the Animatics RS485 or RS485 ISO on the primary serial port As RS485 is half duplex and RS232 is full duplex RS4 dedicates the I O pin G to control the direct
87. units prior to year 2000 If you get an F or failure response to the RCKS command report program check sum following a program download you may wish to issue an ES400 command from the terminal and try again If RCKS now passes you may have a slow EEPROM In some cases you may need to make ES400 the first program statement within a program but as the command controls the speed at which the memory is read the command really has little value in a program and you may wish to consider upgrading the EEPROM 120 Related Command ES400 EXAMPLE ES1000 continued Set EPROM Read Write Speed The following simple test program may well abort if ES1000 is unreliable PRINT TEST ES400 amp 1000 HILE a a 1 400 Wee Ss v Il SUB5 1000 Fg Eel A ia O EN G O iO 0 B5 pD RINT 13 ES400 RINT 13 ES1000 PRINT 13 TI WAIT 100 c a b a IF c l b ES1000 slower data rate a faster data rate a EST RAN TO COMPLETION PRINT 13 NO DATA ERROR DETECTED PRINT DATA PROBLEM ABORT TEST ENDIF RETURN GOTO10 C10 END add many GOTO10 statements here to fill up your program EEPROM PRINT 13 PROGRAM POINTER ERROR ABORT TEST 121 Related Command HA KD KG KI KL KP KS KV F Load PID Filter APPLICATION Amplifier
88. voltage reference inputs are set to full scale zero and 5 VDC such as for the AlO 100 EXAMPLES AOUTC128 Output 2 5V Mod C Use a comma when using a variable a 128 Set any variable AOUTC a Output to port See the appendix for information about the use of the Ani Link AlO 100 analog I O expansion module and associated AniLink chip set The syntax of the command is AOUT address value sends a byte value to the associated AniLink peripheral card The address of the AlO 100 card is a character between A and H and is set on the card by three jumpers The value is a number between 0 and 255 If the value is 0 the output voltage is the minimum value If it is 255 the voltage is maximum Please refer to the associated Users Manuals for specifics about each optional Analog I O card 37 Related Commands RW RPW Za ZS Ba Peak Over Current Status Bit APPLICATION Monitor Motor status DESCRIPTION Over current detected state EXECUTION Historical latched by PID sample CONDITIONAL TO Hardware Detection LIMITATIONS None REPORT COMMAND Rba RW bit 14 RPW bit14 READ WRITE Read only To reset issue Za or ZS LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor 1 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor firmware checks each PID Sample to see whether or not a Peak Over current condition exi
89. 0 If the report command is received through channel 1 the response goes out channel 1 RKG Report present buffered KG 250 Related Command F KD KI KL KP APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE RKI Report Integral Gain Tuning Value Report command Report buffered integral gain Immediate Integral limited by KL term N A KI N A N A PID coefficient 0 to 32767 0 to 20 Motor size dependant FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKI reports the signed value of the buffered PID integral gain value KI No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KI 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 RKI Report present buffered KI 251 Related Command F KD KI KL KP RKP Report Proportional Gain Tuning Value APPLICATION Report command DESCRIPTION Report buffered proportional gain EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE KP READ WRITE N A LANGUAGE
90. 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bi 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 Example Notice PRINT outputs from the following program A 10 V 4000 MV G WHILE LOOP END E 100 an BE RBi Le Be ELSE ENDIF RI WAIT 400 buffer a slow velocity mode move small error band go PRINT NEW INDEX VALUE PRINT OLD INDEX VALUE 222 Related Command RCKS RW Z APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 error STATE VALUE 0 error FIRMWARE VERSIONS RBk Report EEPROM Checksum Status Bit Report command Report EEPROM state flag I O error event latch Immediate RCKS N A Bk N A N A Binary state 0to1 RCKS reported Program EEPROM checksum VST reported Write Data EEPROM error RCKS reported Program EEPROM checksum Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBk reports the state of the checksum error flag Bk It returns a 1 if a check
91. 10 MSO Reset CTR to Zero no motion will result This also sets up Port A and B for step and direction input mode RMODE RESPONSE will be from previous mode MFMUL 10 Multiply incoming pulses by 10 MFDIV 100 Divide incoming pulses by 100 MSR Calculate Mode Step Ratio G motor will now begin following a 1 10 RMODE RESPONSE is YX 176 Related Command CTR RCTR MS MSR MFMUL MFDIV MSO Enable Step Direction Counter Mode APPLICATION Counter mode control DESCRIPTION Request step and direction counter mode EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Step and direction input available REPORT COMMAND RCTR READ WRITE step and direction counter CTR is read only LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE MSO resets CTR to zero FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The command MSO Mode Step Zero allows the user to zero the second encoder register CTR without changing the mode status of the SmartMotor Following MSO incoming step and direction signals using I O pins A and B will be fully decoded and presented in the form of the CTR variable no gearing relationship is active unless you write one yourself If the you are running in MS MF MSR MFR MC or other encoder follow modes be careful issuing MSO as the value of CTR is immediately zeroed The SmartMotor will interpret this to be a sudden chang
92. 100 D 4000 MP G 3 Initiate a Velocity in Mode Velocity MV V 10000 A 100 MV G 4 Change to a new Velocity in Mode Position MP or Mode Velocity MV V 10000 A 100 MV G WAIT 1000 V V 2 G 5 Change to a new Acceleration in Mode Position MP or Mode Velocity MV V 10000 A 100 MV G WAIT 1000 A A 2 G 6 Initiate Change an Electronic Gear Ratio in Mode Follow with Ratio MFR MFO MFMUL 1 MFDIV 10 MFR G 7 Initiate Change an Electronic Gear Ratio in Mode Step with Ratio MSR MFO MFMUL 1 MFDIV 10 MSR G 8 Initiate Cam Mode MC MFO MC1 G 126 Related Command A D E MC MD MFR MP MV UG UGI UGO G continued Start Motion GO 9 Begin Host Mode MD motion prior to filling all buffered data slots See Users Guide for Host Mode 10 Initiate a phase Offset Move while in Electronic Gear Ratio in either Mode Follow or Mode Step MFO MFMUL 1 MFDIV 10 MFR G WAIT 2000 D 2000 V 100 G On Power Up the Motor defaults to the Off state with MP Mode Position buffered in with no Velocity or Acceleration values As a result if G is issued the motor will immediately servo in place Mode Follow MS1 MF1 MF2 and MF4 Mode Step MS Mode Torque MT and Amplifier Mode MD50 are immediately active they do not wait for any G com mand If a G command is transmitted and no motion results any of the following may be the cause e E 0 or too small e A 0 or 1 e V 0 or so small motion is not visible to naked ey
93. 2 Bit Array Data Value Report 32 Bit Array Data Value Report 16 Bit Array Data Value Report Commanded Acceleration Report Expanded Analog Input Value Report Allowable PWM Limit Report PEAK Over current Status Bit Report Communications Parity Error Status Bit Report Communications Overflow Status Bit Report Math Overflow Status Bit Report Position Error Status Bit Report Communications Framing Error Status Bit 168 169 170 171 173 175 177 180 182 183 185 187 188 189 191 193 195 197 199 200 202 204 206 208 209 210 212 213 214 215 216 217 218 219 220 Language reference table of contents continued RBh RBi RBk RBI RBm RBo RBp RBr RBs RBt RBu RBw RBx RCHN RCHNO RCHN1 RCS RCS1 RCTR RD RDIN port channel RE RETURN RI RKA RKD RKG RKI RKP RKS RKV RP RPE RS RS2 Report Over Heat RMS Over Current Status Bit Report Index Captured Status Bit Report EEPROM Checksum Status Bit Report Real Time Left Over Travel Limit State Report Historical Left Over Travel Limit Status Bit Report Motor Off Status Bit Report Historical Right Over Travel Limit Logic State Report Real Time Right Over Travel Limit State Report Syntax Error Status Bit Report Busy Trajectory Status Bit Report Array Index Error Status Bit Report Encoder Wrap Status Bit Report Real Time Index Pulse Logic State Report Serial Communications Status Flags Report Primary Serial Port Status Report Secondary Serial P
94. 23 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line B can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UBA is read only and can be accessed with the state ment variable UBA PRINT UBA 13 or WHILE UBA gt 200 LOOP The analog read occurs once at the time the UBA command is executed Assigning the variable a UBA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UBA UBA b UBA PRINT 13 REPORT UBA Rb RUBA Directly Report Port B Analog Value gt 4 76 firmware only 298 Related Command UB UBA UBO UBI as command Set I O Port B to Input APPLICATION I O control DESCRIPTION Set Pin B to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANG
95. 5 Port and will essen tially lock you out of the motor It is a good idea to devise a means of invoking CMD1 via I O or specific serial data if you use data mode See next page for example 89 Related Commands CMD DAT DAT1 OCHN CMD1 continued Accept Command Input RS 485 EXAMPLE using the default channel 1 PRINT1 13 Default mode is CMD PRINTI 13 Issuing DAT DAT PRINTI 13 Issuing a GETCHR PRINT1 13 Use a GETCHR b GETCHR c GETCHR SMI to send RP command 13 PRINT1 13 Received ASCII a PRINTI 13 Received ASCII b PRINT1 13 Received ASCII c PRINTI 13 Issuing CMD CMD1 IF a 82 GOTO10 IF b 80 GOTO10 IF c 32 GOTO10 PRINT1 13 Use RINTI 13 You ND 10 ar wW Q m U m ND ENDIF validate user command ENDIF sent via SMI ENDIF SMI to send RP command should see a motor response 13 RINT1 13 PROGRAM DID NOT RECEIVE RP COMMAND RINT1 13 PROGRAM ABORTING 13 90 Related Commands ENCO ENC1 MC MF MFO MF1 MF2 MF4 MFR MS MSO MSR Some low cost SmartMotors do not have second encoder input capa bility CTR Second Encoder Step and Direction Counter APPLICATION External Encoder DESCRIPTION External encoder counter reading EXECUTION Updated once each PID sample CONDITIONAL TO External encoder input signal available ENCO and ENC1 commands
96. 7 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RD reports the value of the buffered relative move distance D No leading zeroes are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return The equivalent PRINT command is PRINT D 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE O 0 set up a move MP A 222 V 44444 D 7777 first buffered D value to be used G D 2266 buffered D value RD response is 2266 243 Related Command DOUT RDIN port channel Report Expanded Input Logic Status APPLICATION Report command DESCRIPTION Fetch and report Anilink digital peripheral input byte EXECUTION Immediate byte read from IIC link CONDITIONAL TO Peripheral input attached to motor LIMITATIONS Returns 255 if port and channel does not exist REPORT VALUE DIN port channel READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE 255 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RDIN address channel Report the unsigned 8 bit data value from the specified Anilink digital peripheral and re
97. 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 RKS Report present buffered KS 253 Related Command F KA KV RKV Report Velocity Feed Forward Tuning Value APPLICATION Report command DESCRIPTION Report buffered velocity feed forward gain EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE KV READ WRITE N A LANGUAGE ACCESS N A UNITS PID coefficient RANGE OF VALUES 0 to 32767 TYPICAL VALUES 0 to 400 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKV reports the signed value of the buffered PID velocity feed forward value KV No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KV 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 KV is very useful to fine tune long constant velocity trajectory profiles Changes in KV are not updated until the load PID filter F command is i
98. 85 port dedicates I O G to the RS485 control function which is required for use with Animatics RS232 to RS485 converters like the RS485 and RS485 ISO When using one of these adapters you must ensure that the I O G pin is configured as a TTL output with the UGO command before the channel is opened EXAMPLE OCHN RS2 0 N 9600 1 8 C performed at reset 187 Related Command G MD50 MF1 MF2 MF4 MS MT MTB OFF Turn Off Drive Stage APPLICATION Motor control DESCRIPTION Turn servo off EXECUTION Next PID sample update CONDITIONAL TO N A LIMITATIONS N A REPORT COMMANDS RS and RBo READ WRITE Read only associated status flag Bo LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE OFF FIRMWARE VERSIONS ALL DETAILED DESCRIPTION OFF turns the power to the motor coils off and terminates the activity of the current motion mode The system flag for Motor Off Bo will be set to 1 The shaft will be free to coast to a stop or to be rotated by other external means The response to RMODE is O for off The system flag Bt for trajectory in progress will be set to zero The system position error flag Be to zero The motor will still track any shaft movement and continue to update the present encoder position Note In all firmware 4 76 the OFF command may result in switching to MTB Mode Torque Brake depending on settings If the otor is in default settings MTB would be
99. A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The Z command will totally reset the SmartMotor just as if power were taken away and later restored Consequently if there is a stored program it will be run from the beginning All modes of operation variables and status bits will be restored back to their defaults Subsequent to a power up or reset the SmartMotor will 1 initialize the motion mode status bits and variables 2 hold the serial port closed for approximately second 3 open and initialize the serial port 4 delay for 2 second At the end of this time the SmartMotor will examine the communications buffer In versions 4 0 through 4 12 if any character is in the buffer the stored program will not be executed In versions 4 15 and later the stored program will be aborted only if the specific characters EE are found 5 The stored program will now run unless aborted as described above After a program download using the Z command is a very good way to evaluate how your SmartMotor will operate when powered on The RUN command will execute the stored program but it will not clear the motor to its default condition so the sub sequent operation will not necessarily mimic what would happen at power up WARNING The Z command should not be used at or near the top of program code In doing so it may cause a contin
100. A RS Read only Expressions and conditional testing Status byte 0 to 255 0 to 255 128 Motor OFF S is the value of the primary motor status byte composed of 8 system flags states The individual meaning of each flag is as follows Bo Bh Be Bw Bi BI Br Bt Motor OFF bit 7 Excessive temperature bit6 reset by access S Excessive position error bit 5 Encoder wrap around bit 4 Index report available bit3 reset by access Historical negative limit bit2 reset by access S Historical positive limit bit1 reset by access S Trajectory in progress bit O If S is reported accessed or assigned the historical bits BI and Br are reset after the requested operation is completed S may be monitored or periodically tested to check for unexpected conditions If you are going to test S for various flag values read S into a variable to avoid losing historical data and states Since S reflects sys tem states it is read only S expression is invalid it will be ignored but it will cause a syntax error and set the extended system flag Bs 270 Related Command RPW RS RW S as status byte continued 8 Bit System Status Byte EXAMPLE 0 10000 set up move P 0 A 222 V 33333 MP G go WHILE Bt GOSUB5 monitor for status change LOOP PRINT 13 FINAL REPORT 13 GOSUB5 final report END c5 ss S READ VALUE ONCE to record historical latches before reset
101. ACCESS N A UNITS PID coefficient RANGE OF VALUES 0 to 32767 TYPICAL VALUES 40 to 400 DEFAULT VALUE Motor size dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKP reports the signed value of the buffered PID proportional gain value KP No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KP 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 RKP Report present buffered KP 252 Related Command F KD KI KL KP RKS Report Inertial Time Constant Tuning Value APPLICATION Report command DESCRIPTION Report buffered inertial constant EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE KS READ WRITE N A LANGUAGE ACCESS N A UNITS PID coefficient RANGE OF VALUES 0 to 255 TYPICAL VALUES 1 DEFAULT VALUE 1 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RKS reports the signed value of the buffered PID sample rate modifier KS No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT KS 13 A value of KS 0 is functionally equivalent to a KS 1 In versions 4 15 4
102. ALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line E can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN E as an output set the value of the pin E output latch UE to either 0 or 1 Issue the command UEO if this has not already been issued O pin E will be a logic high voltage if UE 1 and a logic low voltage if UE 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UEA function EXAMPLE UEO set PIN E to function as a digital output UE 0 set PIN E to logic 0 zero volts UE 1 set PIN E to Logie 1 5 volts Note The I O state can be set prior to assigning as an output e E 0 Pre set PIN E to logic 0 zero volts EO set PIN E as an output pre initialized to zero 314 Related Command UE UEI UEO UEA Read I O Port E as Analog Input APPLICATION I O control DESCRIPTION Read Pin E analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UEA READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line E can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned
103. APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LANGUAGE ACCESS LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES RESET VALUE FIRMWARE VERSIONS Zd Reset Math Overflow Error Flag Program execution control Reset math overflow violation latch Immediate N A N A N A RBd N A N A N A N A N A 0 4 00 and higher DETAILED DESCRIPTION Zd resets the math overflow violation flag Bd to zero For safe operation it is vital to find and eliminate the cause if this error flag is ever set EXAMPLE IF BA Test flag PRINT Math Overflow za ENDIF Reset flag 347 Related Command Bd RBd APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LANGUAGE ACCESS LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES RESET VALUE FIRMWARE VERSIONS Ze Reset Position Error Flag Program execution control Reset Position Error Status Bit Be Immediate N A N A N A RBd N A N A N A N A N A 0 4 46 and higher DETAILED DESCRIPTION Ze resets the Be Following error or position error flag to zero This only works with PLS PS2 and 4 76 firmware EXAMPLE IF Be Test flag PRINT Following Error Ze ENDIF Reset flag 348 Related Command Bf RBf Zf Reset Comms Framing Error Flag APPLICATION Program execution control DE
104. AULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION KA sets the buffered acceleration feed forward gain The acceleration feed forward term helps the PID filter to cope with the predictable effects of acceleration and inertia The KA gain factor is only applied in position MP and velocity MV moves Issuing a new KA parameter is not effective until it is loaded into the present PID filter by the F command The default value for KA is 0 and acceptable values range from 0 to 65 535 It is difficult or impossible to tune KA in low inertia systems Even in high inertia systems it can be a challenge to observe the benefit during very short acceleration periods It is best to rely on the host tuning utility for assistance if it is thought that KA could be useful PRINT KA 13 and RKA both report the value of KA through the primary serial port while PRINT1 KA 13 sends it out channel 1 KA is valid with any expres sion and can be treated as if it were any read write variable The motion or servo characteristics are unaffected until KA is applied by the F function EXAMPLE KA 200 set buffered acceleration feed forward F update PID filter 139 Related Commands KA KG KI KL KP KS KV KD expression PID Derivative Compensation APPLICATION PID filter control DESCRIPTION Derivative gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKD READ
105. B5 F 0 reset to default END c5 rr 123 ss 456 tt 789 PRINT rr ss tt Rrr RSs Rtt END Host terminal only sees the following program output Take note of the carriage returns not explicitly shown here F 0 123456789123 456 789 203 Related Command N A Raaa Rzzz Report 32 Bit Variable Data Value APPLICATION Report command DESCRIPTION Report user variable aaa EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Not valid for pre 4 00 firmware REPORT VALUE aaa READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Raaa reports the signed value of the variable aaa to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT aaa 13 Use similar PRINT commands for Rbbb Reccc through Rxxx Ryyy Rzzz In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Raaa is received through channel 0 the response is sent through channel 0 If Raaa is received through channel 1 the response goes out channel 1 In SmartMotors so equipped if F 4 has been commanded this report
106. BH RBh TH THD TEMP Read Motor Temperature APPLICATION Temperature control DESCRIPTION Read motor temperature EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Read Only LANGUAGE ACCESS N A UNITS Degrees Centigrade RANGE OF VALUES 128 to 127 TYPICAL VALUES 20 to 60 DEFAULT VALUE Room temperature FIRMWARE VERSIONS 4 11 and higher DETAILED DESCRIPTION The present temperature of the motor can be determined by assigning TEMP to a user variable or issuing PRINT TEMP The units are degrees Centigrade EXAMPLE t TEMP Rt response 30 PRINT TEMP response 31 the motor is warming up Motors with version 4 11 and higher permit the user to set the overheat temperature trip point with the command TH expression and to set the time THD expression for which the overheat condition must exist before the servo is shut off A motor in the overheat condition will not turn on the servo even if commanded to do so If the motor were operating in Torque Mode at TEMP gt TH for 4 seconds the motor would shut off It would not restart until both the condition TH TEMP gt 5 were true and then MT command reissued a 5 WHILE a lt 10 TH TEMPt a WAIT 4000 G WAIT 4000 if B BREAK ENDIF a atl LOOP PRINT MOTOR RESTARTED WHEN TH TEMP a END Restart announced at TH TEMP 6 288 Related Command Bh RBh TEMP THD TH Set
107. Binary state RANGE OF VALUES 0 to1 STATE VALUE 1 Encoder wrap around occurred during a position move STATE VALUE 0 Encoder wrap around event not recorded FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBw reports the state of the position wrap around flag Bw In any motion mode other than MV MT or MD50 it returns a 1 if the encoder position wrapped and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bw 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE try the follow Bw test program at no instance is Bw set Lo 0O 2147480000 place close to wrap around at 2147483647 T 33 MT PRINT 13 VALUE OF RP PRINT 13 VALUE OF Bw RBw WATT 20000 IF P lt 0 PRINT 13 VALUE OF RP ENDIF if Bt PRINT 13 STILL GOING OK ENDIF PRINT 13 VALUE OF Bw RBw END 232 Related Command Bi Z RBx Report Real Time Index Pulse Logic State APPLICATION Report command DESCRIPTION Report real time index input state EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bx
108. C as Positive Over Travel Limit APPLICATION I O control DESCRIPTION Set PIN C to be right positive limit input EXECUTION Immediate CONDITIONAL TO UC 0 or UC 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Limit switch FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line C can be a TTL 0 to 5V input TTL output 10 bit input or act as the positive limit input which is the default state UCP explicitly defines I O pin C to be the positive limit while commands UCI and UCO make it into a TTL input or output respectively disabling the limit behavior EXAMPLE UCI use PIN C as a general purpose input suppress limit behavior a UCI read the input value as digital input Ra report input value ULP restore default positive limit behavior to PIN C 307 Related Command UDA UDI UDO UD expression Set I O Port D Output Logic State APPLICATION I O control DESCRIPTION Set Pin D output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0or1 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line D can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN D as an out
109. C4 MC8 MF1 MF2 MF4 MS SIZE MC continued Enable Mode CAM Electronic Camming Example CAM MODE Setup BASE 2000 Cam period SIZE 25 data segments number of data points in table CTR data interval BASE SIZE 2000 25 80 CAM motor will be at Data position every 80 Master encoder counts CTR 0 CTR 80 CTR 160 CTR 1840 CTR 1920 CTR 2000 Now assigning data values beginning with aw 0 aw 0 0 10 20 30 40 50 60 70 80 90 100 aw 20 110 120 120 110 100 90 80 70 60 aw 19 50 40 30 20 10 0 MF4 reset external encoder to zero O 0 reset internal encoder position MC buffer CAM Mode G start following th xternal encoder using cam data The motor will now begin following the External Master encoder via the defined CAM profile above The SmartMotor performs a practical cam application by partitioning the required cam trajectory definition into a number of linearly interpolated segments The variable SIZE stores the number of segments The segments are required to partition the BASE into a set of equally spaced intervals The set of required positions must always use the 16 Bit array values beginning at aw 0 and ending with aw SIZE aw 0 thru 99 While this appears to limit the size of the cam table to 100 entries no larger than 32678 this is not the case You can continually load new values into the aw array as the values get used be sure you load the new values into
110. CONDITIONAL TO N A LIMITATIONS Step and direction input available REPORT COMMAND RMODE READ WRITE Associated step and direction counter CTR is read only LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE MS resets CTR to zero FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The MS command enables mode step and direction In the step and direction mode the SmartMotor emulates a 2 000 or 4000 depending on model step per revo lution stepping motor and driver package where I O pins A and B are used to receive the step and direction inputs respectively In Step and Direction mode the SmartMotor is still operating in a closed loop fashion with the PID loop executing the servo functions so tuning is still important The MS command is immediate and concurrently resets the external encoder CTR value to zero For each external step pulse received by the SmartMotor the motor will be requested to move one internal encoder count in the same direction as the direction input For other ratios and fractional relationships see Mode Follow with Ratio MSR Velocity and acceleration parameters have no meaning in this mode Issuing any other mode such as MT or MP followed by G will take the SmartMotor out of this following behavior Under MS a logic level high on the DIRECTION input causes motion in the posi tive direction That is the shaft will move such that the internal encoder value will incr
111. CUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bo READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0 to1 STATE VALUE 1 Motor PWM signal is off STATE VALUE 0 Motor PWM signal is on motor coils are powered FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBo reports the state of the motor off flag Bo It returns a 1 if an active left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bo 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE OFF RBO motor responds with a 1 T 100 MT servo on no PID loop RBo motor responds with a 0 MP G change mode servo on with PID loop RBO motor still responds with a 0 OFF RBO motor responds with a 1 END 226 Related Command Z RBp Report Historical Right Over Travel Limit Logic State APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 Report command Report Historical Right Limit State Updated e
112. D UP UPLOAD RCKS READ WRITE EEPROM is read write unless locked LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION LOAD is used by a terminal to download a compiled program file and store it within the USER PROGRAM EEPROM of the SmartMotor The LOAD command causes a SmartMotor to load all incoming host communications into program memory up to the first occurrence of the ASCII character 255 Program sizes can be as great as 32k This command is mainly used by host utilities which also compiles the program before download LOAD does not terminate the present motion mode or trajectory change motion parameters such as E A V KP etc or alter the present value of the user variables If the motor does not receive the ASCII 255 byte sometime after the LOAD com mand the motor will continue to store incoming serial bytes directly to the Program EEPROM During this time you are likely to be confused by the motor s apparent lack of response to your commands The only way to terminate this condition is to transmit ASCII 255s or to reset the power Note The SMI SmartMotor Interface software package is adjusted to take care of this automatically By using the LOAD command you can download from any controller HMI PLC or PC based program capable of storing an ASCI text file For any given motor that is actively addressed i e you are talking to
113. DETAILED DESCRIPTION The UPLOAD command will upload only the text portion of the SmartMotor s program as it appeared in your original source file In contrast the UP command will upload the text along with all of the binary information created by the compiler that allows the program to run faster UPLOAD immediately terminates any running user program The program counter is lost UPLOAD does not terminate the present motion mode or trajectory or change motion parameters such as E A V KP etc or alter the present value of the users variables When communicating over a terminal use the UPLOAD command to verify the program is the expected one The comments in your original source code do not appear when you UP or UPLOAD a program The comments were removed by the compiler as is usual for any compiled computer program When uploading a program from a SmartMotor in a daisy chain prevent the other SmartMotors in the chain from issuing unexpected characters by using the SILENCE and SLEEP commands After the upload is complete you can re enable normal communications with WAKE and TALK EXAMPLE try the following program down load it and then RUN PRINT PERFORM UPLOAD CMD UPLOAD PRINT ANY MORE END Output is PERFORM UPLOAD CMD Related Command P PE V A D E G MP MV v V Commanded Velocity APPLICATION Trajectory control DESCRIPTION Maximum velocity EXECUTION Buffered CONDIT
114. E FIRMWARE VERSIONS RI Report Last Captured Index Pulse Location Report command Report latched index position Immediate Index capture N A l N A N A Encoder counts 2147483648 to 2147483647 2147483648 to 2147483647 0 ALL DETAILED DESCRIPTION RI reports the signed value of the latest captured index No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT I 13 If system flag Bi is 1 a new Index value is available Issuing RI will reset Bi to zero In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 Example Notice PRINT outputs from the following program A 10 V 4000 MV E 100 G WHILE Bt RBi LE Bi ELSE ENDIF RI WAIT 400 LOOP END buffer a slow velocity mode move small error band go PRINT NEW INDEX VALUE PRINT OLD INDEX VALUE 247 Related Command F KA KV RKA Report Acceleration Feed Forward Gain Tuning Value APPLICATION Report command DESCRIPTION Report buffered acceleration feed forward gain EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE
115. E N A LANGUAGE ACCESS N A UNITS Encoder counts RANGE OF VALUES 32768 to 32767 TYPICAL VALUES 32768 to 32767 DEFAULT VALUE 1000 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RE reports the value of the allowable following error E No leading Zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT E 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 For normal operation E is greater than or equal to zero If E is assigned a negative value a position error is immediately generated EXAMPLE A 554 set up a buffered velocity move V 666666 MV E 300 G go WATT 4000 R response is 1000 Aol amp R response is NOT 1000 245 Related Command Cc END GOSUB RUN RUN Subroutines present a great opportunity to partition and organize your code RETURN Return From Subroutine Program Flow Control APPLICATION Program execution control DESCRIPTION Return subroutine execution to next program statement following present subroutine call EXECUTION Immediate CONDITIONAL TO A prior program statement GOSUBn was performed LIMITATIONS Prior
116. E Bt LOOP A 20 V 222000 P 20000 G EXAMPLE 3 MV A 10 v 440000 G WHILE Bt LOOP Bt continued Trajectory In Progress Status Bit buffer a position move request start the first buffered move wait for first trajectory to be done Note TWAIT could have been used buffer another move now begin the second move Set to Velocity Mode start moving Bt will remain 1 until commanded otherwise or the motor errors out for some reason 59 Related Commands ZS Zu APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES VALUE BY STATE DEFAULT VALUE Bu Array Index Error Status Bit Monitor array index error Out of range array index state flag Latched high upon illegal array access attempted User command attempted to access an array using an illegal index None RBu Read only Reset to zero using Zu command Expressions and conditional testing Binary bit Oor1 0 no illegal array index has occured 0 FIRMWARE VERSIONS 4 00 or higher DETAILED DESCRIPTION The index for each of the ab index aw index and al index arrays has a valid range If you go outside the valid range the system flag Bu is set to 1 The syntax error bit Bs will also be set to 1 Bu is more explicit EXAMPLE Zu t 0 WHILE t lt 60 al t t t t 1 LOOP RBu reset illegal index flag initiali
117. E OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line B serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input secondary encoder input B or the direction input in Step and Direction Mode While user I O line B defaults to being a general purpose TTL input it can be explicitly set up as a digital input with the UBI command If I O line B has been set to an output with the command UBO it can be reset to be an input with the command UBI EXAMPLE UBI Initialize U ser defined I O pin B as I nput PRINT 13 PIN B Input UBI n UBI Store state of I O pin B as digital input into variable name n PRINT 13 REPORT PIN B Input Rn END 299 Related Command UB UBA UBO UBI as input value Read I O Port B Logic State APPLICATION I O input DESCRIPTION Input at Pin B EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UBI READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT VALUE I O dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line B serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input secondary encoder input B or the direction input in Step and Direction Mode User I O line B defaults to being a general purpose TTL input I
118. EIF clause exists and the language interpreter evaluates the IF expression to be false zero the program will branch immediately to first ELSEIF expression 110 Related Commands ELSE ENDIF IF exp ELSEIF continued IF structure command flow element If the associated expression is true then the following clause is exe cuted until an ELSEIF ELSE or ENDIF is encountered and then execu tion branches to the ENDIF of the present IF control block If the first ELSIF clause is not executed then program execution continues at the next ELSEIF expression and so on until all the ELSEIF expressions have been tested In the case all ELSEIFs have false expressions and an ELSE clause exists that clause will be executed The ELSEIF statement is similar to the CASE number case for a SWITCH control block Note the difference ELSEIF handles expres sions CASE only handle a fixed number ELSEIF is not a valid terminal command it is only valid within a user program EXAMPLE a 3 IF a 2 expression will be found false PRINT 222 ELSEIF a expression will be found true PRINT 333 so 3333 will be printed ENDIF EXAMPLE IF a only if a is NOT 1 2p o 3 will GOSUB5 be executed GOSUB2 ELSEIF a 2 GOSUB3 ELSEIF a 3 GOSUB4 hoor GOSUB5 ENDIF 111 Related Commands CTR ENC1 ENCO Set Restore Internal Encoder for Servo APPLICATION Encoder control D
119. ENDIF IF UAI If Input A gets rounded ZS Reset the motor ENDIF LOOP RETURNF Return form Fault routine Example using F 64 for Port G C2 interrupt subroutine call F 64 Enable Port G interrupt routine END C2 Port G interrupt Routine PRINT Port G was grounded 13 RETURNI Return from Input Trigger Example using F 64 for C2 subroutine call and F 1024 Index Re direct for posi tion capture F 64 1024 Re direct END C2 Port G interrupt Routine PRINT Port G was grounded 13 PRINT Position captured at 1I 13 RETURNI Return from Input Trigger Enable Port G interrupt routine and Index Capture 125 Related Command A D E MC MD MFR MP MV UG UGI UGO G Start Motion GO APPLICATION Trajectory control Parameter Update DESCRIPTION Initiate or change trajectory parameters EXECUTION Next PID sample CONDITIONAL TO Clearing of prior errors in PLS firmware only LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The G command stands for Go and is used to start motion or update buffered val ues such as Speed or acceleration A G command is required in each of the following cases 1 Initiate an Absolute Move in Mode Position MP V 10000 A 100 P 1234 MP G 2 Initiate a Relative Move in Mode Position MP V 10000 A
120. ERFLOW STATE RBc PRINT FRAMING ERROR STATE RBE Zero PRINT SYNTAX ERROR STATE RBs ENDIF RETURN 216 Related Command RCHN RCHNO RCHN1 Z Zc ZS Note A syntax error from the terminal causes RCHN to respond with value 4 but the value CHN assigned to an expression is still Zero RBc Report Communications Overflow Status Bit APPLICATION Report command DESCRIPTION Report system state flag communication buffer overflow event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bc READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 0to1 Communication buffer overflow event occurred Communications buffer overflow has not occured FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBc reports the state of the serial communications overflow error flag Be It returns a 1 if any overflow error has been detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bc 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response is transmitted through channel 1 EXAMPLE
121. ESCRIPTION Use internal encoder as the primary encoder EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE ENCO FIRMWARE VERSIONS 4 11 and higher DETAILED DESCRIPTION The SmartMotor can accept inputs from either the internal integrated encoder or an external source ENCO will cause the SmartMotor to read its position from the internal encoder while ENC1 uses the secondary external encoder When ENCO is active the external encoder input will be tracked by the CTR variable and P will track the internal encoder EXAMPLE ENCI Servo from external encoder ENCO restore default encoder behavior ENC1 Servo from external encoder ENCO restore default encoder behavior 112 Related Commands ENCO WARNING If the ENC1 command is issued without an external encoder connected both electrically to the A and B inputs and physically to the shaft and connected properly the shaft will run away with full speed and torque APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT STATE ENC1 Select External Encoder for Servo Encoder selection control Swap internal and external encoder functions Use external encoder as the primary encoder The
122. EXECUTION Buffered pending a G CONDITIONAL TO A D E G P V PID loop LIMITATIONS Motor power sufficient to deliver acceleration A and velocity V REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE Default motion mode at power up FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The position mode is the default mode of the motor If you ever change modes you can return to position mode by issuing the MP command The mode request is buffered until a G command is issued For a standard position mode move the SmartMotor requires at a minimum a position non zero trajectory velocity V and an non zero positive acceleration A Position mode calculates the trajectory to the target position at the time the G command is issued The preceding P expression or D expression determines if the move is to be absolute destination target set equal to buffered P value or relative destination target set equal to current trajectory position plus the buffered D offset value The G command may be issued at any time and may be repeated particularly in the case of relative modes with D offset MP followed by G will immediately turn on the servo and reset any position error The servo off flag Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 would immediately cause a
123. Error Flag RS 485 EXAMPLE Host transmitted A 100 but the serial port actually received K 100 then tried to execute K 100 PRINT CHN1 responds to host with 4 since K is invalid EXAMPLE test individual flags IF CHN1 amp 4 PRINT CHANNEL 1 scan error occurred ELSEIF CHN1 amp 1 PRINT CHANNEL 1 buffer overflow ENDIF EXAMPLE test all flags IF CHN1 PRINT CHANNEL 1 SERIAL ERROR ENDIF 84 Related Commands RCLK WAIT CLK Hardware Clock Variable APPLICATION Hardware clock access DESCRIPTION Value of free running firmware clock EXECUTION Incremented once each PID sample CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RCLK READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 to 2147483647 TYPICAL VALUES Sequential DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION CLK is an independent free running read write counter It is reset to zero upon a hardware or software reset and it increments once per PID cycle The default PID rate produces 4069 samples per second so there are roughly four CLK ticks per millisecond at PID1 If the PID sample is modified by PID2 PID4 or PID8 the amount of time associated with one CLK tick will increase by 2x 4x or 8x respectively The user may also assign a value to this counter at any time CLK is 31 bits in size and wil
124. F To use MFR you will need to define the specific relationship ratio of the encoder count input to outgoing requested encoder counts of motion The command MFR must be issued after both MFMUL and MFDIV have been set Both MFMUL and MFDIV may positive or negative use this fact to control the direction of shaft motion Overly large ratio gains are flagged by the firmware setting the system flag Bd and may be unstable The error flag Bd will be set by MFR if the magnitude of MFMUL MFDIV is 256 or greater MFR does NOT reset Bd if already set by a prior procedure EXAMPLE Zd reset Bd system flag MFO reset CTR MFDIV 10 Denominator 10 MFMUL 21 Numerator 21 MFR Calculate Ratio input 21 external counts resulting motion 10 counts D 0 No phase shift IF Bd GOTO12 ENDIF gain too large G Start Following Implementing Phase Adjust D 500 Set Relative Distance V 5000 Set Relative Velocity G Start Phase Adjust END C12 S END 170 MFR Calculate Enable Mode Follow Ratio Related APPLICATION Motion mode control command DESCRIPTION Request MODE FOLLOW WITH RATIO SIR EXECUTION Buffered pending a G CONDITIONAL TO Ratio MFMUL MFDIV D and V j LIMITATIONS Magnitude of ratio MFMUL MFDIV must be less than MF1 256 MF2 REPORT COMMAND Ratio Cannot be reported MF4 READ WRITE N A MFDIV LANGUAGE ACCESS N A MFMUL UNITS N A V RANGE OF VALUES N A TYPICAL VALUES 5 lt MFMUL MFDIV lt 5 non repo
125. F command See F in this programmers guide for more detail 135 Related Commands ELSE ELSEIF ENDIF Every IF struc ture must be terminated with an ENDIF IF expression Conditional Program Code Execution APPLICATION Program execution control DESCRIPTION Conditional run time program execution EXECUTION Test expression and take action as coded CONDITIONAL TO Program execution branch if expression is zero or false LIMITATIONS Requires corresponding ENDIF Can be executed only from within user program REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The IF statement is the basic means by which an executing program can make a choice between alternative execution paths at runtime In its simplest form the IF control block consists of IF expression evaluates as non zero Run the code below the IF command ENDIF Expression is a test condition Both mathematical comparisons and boolean logic bit wise comparisons can be used Each must evaluate to be true IF a b IF a lt b If a equals b IF al b If a does not equal b If a is less than b IF a lt b If ais less than or equal to b IF a amp b Ifa AND b bit wise IF alb Ifa OR b bit wise comparison IF a gt b If a is greater than b IF a gt b If ais greater than or equal to b IF a If a does no
126. F structure command flow element APPLICATION Program execution control DESCRIPTION Alternate Evaluation of IF ENDIF control block EXECUTION Immediate if exercised CONDITIONAL TO Value of associated ELSEIF expression LIMITATIONS Must reside with IF expression ENDIF program control block REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION An IF expression ENDIF control block may optionally include any number of ELSEIF expressions to perform multiple evaluations in a specified order Sup pose that you want the SmartMotor to do one thing if the variable g 43 another if g 43000 and another if g 2 EXAMPLE IF g 43 PRINT Gee 43 13 ELSEIF g 43000 PRINT 43 grand for me 13 ELSEIF g 2 PRINT 2 13 ENDIF The first line checks to see if g is equal to 43 If so the string Gee 43 is sent out the primary serial port and the IF control block terminates If g is not 43 the program goes on to test if g is 43000 If it is 43 grand for me is sent out the primary serial port and the IF control block terminates Similarly if g is not 43000 the program goes on to test if g is 2 If it is 2 is sent out the primary serial port and the IF control block terminates An IF control block can have multiple ELSEIF statements If such an ELS
127. FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION STACK empties the queue of pending GOSUB RETURN addresses In order to execute the RETURN program statement the processor needs to be able to recall the program address point to which it should return These addresses are stored within a region called a stack A maximum of six address locations can be stored within the stack This means that if a seventh GOSUB is called prior to any intervening RETURN statements the stack will overflow and the program execution may fail The stack region is managed using a pointer to the presently effective return address storage location The STACK command directly resets this pointer to its initial condition So the STACK command clears all RETURN addresses in the stack queue Note Since Issuing STACK will cause any RETURN command to follow to be ignored proper program flow via GOTO commands or otherwise should be used to prevent a memory mapping error Care should be taken when the STACK command is used Since GOSUB command may be issued serially to the Smartmotor it may be possible to overflow the stack regardless of the downloaded program code The STACK can be issued via serial communications as well to permit the program execution to continue without concern for how did we get here However it is not recommended since full knowledge of what lin of code the motor may be running at the time wuuld not be known 280 Related Command
128. GA PRINT UGA 13 or WHILE UGA gt 200 LOOP The analog read occurs once at the time the UGA command is executed Assigning the variable a UGA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UGA UGA b UGA PRINT 13 REPORT UGA Rb RUGA Directly Report Port G Analog Value gt 4 76 firmware only 326 Related Command UG UGI UGO UGI as input value Read I O Port G Logic Level State APPLICATION I O control DESCRIPTION Read Pin G Logicinput EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UGI READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line G serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input the hardware go line and the primary port RS485 con
129. HILE expression The WHILE expression LOOP control block creates a program loop that repeat edly executes for as long as the expression value is true or non zero The expression is evaluated at the time WHILE is first encountered and each time program execution is sent back to the WHILE by the corresponding terminating LOOP statement If the expression value is zero or false program execution continues on the line of code just below the LOOP command For version 4 00 and higher the SMI compiler encodes the LOOP corresponding WHILE program address location within the executable file No WHILE GOSUB return stack is used to carry out the proper execution of the LOOP statement Thus LOOP executes the function equivalent of a GOTO without the need for declaring a program statement label Simply restated WHILE expression LOOP is function ally encoded as Cx WHILE expression GOTOx This means that it is legal to jump into a WHILE control loop directly from an external program location LOOP is not a valid terminal command It is only valid within a user program Continued on next page 156 Related Command BREAK WHILE LOOP continued Return to WHILE Program Flow Control EXAMPLE b 1 WHILE b lt 5 PRINT 13 b b b b 1 LOOP PRINT 13 Exit Loop END Output will be b 1 b 2 b 3 b 4 b 5 Exit Loop 157 Related Command BASE CTR G MC2 MC4 MF1 MF2 MF4 MS SIZE MC Enable Mode CA
130. I to send RP command PRINT 13 You should see a motor response 13 END c10 PRINT 13 PROGRAM DID NOT RECEIVE RP COMMAND U RINT 13 PROGRAM ABORTING 13 ND m 88 Related Commands CMD DAT DAT1 OCHN CMD Accept Command Input RS 485 APPLICATION Serial communications control DESCRIPTION Set serial communication channel 1 to receive commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Command channel FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION By default anything received over the secondary serial port is interpreted as a com mand By configuration however channel 1 serial port can treat incoming information as either commands or data The CMD1 function tells the SmartMotor to interpret information coming into the channel 1 port as commands The alternate to CMD1 is DAT1 which causes the SmartMotor to simply store incom ing bytes in the 16 character serial buffer The characters are read from the buffer with the GETCHR1 command while the LEN1 function holds the number of charac ters in the buffer For details about the use of data mode please refer to the DAT1 command WARINING Issuing DAT1 at the command line will prevent the motor from responding to any further commands via Com 1 RS 48
131. ION I O control DESCRIPTION Set Pin A to be an output EXECUTION Immediate CONDITIONAL TO UA 0 or UA 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line A can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input The command UAO specifies the I O pin A as an output while UA value sets the voltage I O pin A will be a logic high voltage if UA 1 and a logic low voltage if UA 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UAA function In order for the output voltage to reflect the state of UA both UAO and UA value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UAO and UA 0 have been issued You only have to issue UAO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE UAO define PIN A output UA 1 set output latch value PRINT UAO recall the latch value response is 1 UA 0 set output latch value PRINT UAO recall the latch value response is 0 296 Related UBA UBI UBO UB expression Set I O Port B Output Logic State APPLICATION I O control DESCRIPTI
132. IONAL TO MP MV LIMITATIONS N A REPORT COMMAND PRINT V READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Scaled encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 23200000 to 3200000 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Use the V expression to set the slew rate used by the velocity and position mode moves In the SmartMotor a point to point move is determined by P expression the target position V expression the target travelling velocity and A expression the acceleration at which to reach the target velocity In a velocity mode move you only need V expression the target travelling velocity and A expression the accel eration at which to reach the target velocity V is always positive in position mode but can be positive or negative in velocity mode The value of V defaults to zero so it must be given a value before any motion can take place The new value does not take effect until the next G command is executed MP Set Position Mode P 10000 Set Position V 10000 Set Velocity A 1000 Set Acceleration G Start Motion TWAIT pause program execution during move P 0 Set new position G Start Motion again Velocity is held to 32 bits 16 bits integer and 16 bits fractional The units are counts per sample period shifted by the 16 bits 65 536 32 212 2 000counts revolution 65 536 4 069samples second
133. ITIONAL TO No effect if no EEPROM program exists LIMITATIONS Valid EEPROM stored program commands REPORT COMMAND UP and UPLOAD READ WRITE EEPROM source LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT RUN at power recycle or software reset FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The RUN command will start a stored downloaded user EEPROM program Issuing a RUN command does not reset any motion variable or I O states It does reset the program execution pointer Stack Pointer to zero and resets the internal GOSUB stack To test your program with a truly fresh start use the Z command to completely reset the motor as if it were newly powered up If a program exists within the SmartMotor user EEPROM it will automatically be run every time the motor is turned on To prevent this make RUN the first program statement of your user program or if you wish place RUN anywhere in your program Upon encountering a RUN the program interpreter execution machine recalls whether or not the RUN command was previously issued and if RUN was not issued program execution ceases This is similar to to encountering an END statement except that a subsequent RUN com mand causes the program to take up after the RUN statement Version 4 SmartMotors provide an abort facility to prevent auto execution of stored program In version 4 0 4 10 through 4 13 and 4 2 SmartMotors the stored program
134. LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION LOCKP modifies the contents of the header file portion of the downloaded Program in the motor s EEPROM to prevent the contents from being uploaded That is the commands UP and UPLOAD will not actually be able to upload the program body or contents This does not prevent the downloading of another program It is suggested that the LOCKP command is used after program development and testing is complete LOCKP is intended as a serial command only It should be issued from the terminal screen It should not be in the actual downloaded code Once LOCKP is issued issuing UP or UPLOAD will no longer produce results 155 Related Command BREAK WHILE LOOP Return to WHILE Program Flow Control APPLICATION Program execution control DESCRIPTION Terminator for WHILE expression EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION LOOP is the statement terminator for the WHILE control block Each WHILE must have one and only one corresponding LOOP Each time LOOP is encountered pro gram execution branches back to re evaluate the W
135. M Electronic Camming APPLICATION Motion mode control DESCRIPTION Request CAM mode EXECUTION Buffered pending a G CONDITIONAL TO BASE expression and SIZE expression LIMITATIONS Requires external encoder signal source REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS ALL DETAILED DESCRIPTION MC puts the SmartMotor into CAM Mode which causes the SmartMotor to follow a predetermined profile in accordance with an external encoder source To set up a cam operation you must also specify BASE SIZE aw 0 aw SIZE position data and initialize to the external encoder counter Start the camming motion by issuing a G command The example below is a complete command sequence In CAM Mode each value of the external encoder defines a required corresponding SmartMotor position cams typically define a periodic motion profile or trajectory BASE defines the number of encoder counts through which the external Cam moves before the required position mapping or required motion is exactly repeated EXAMPLE This is a saw tooth CAM with periodic motion of BASE 2000 external encoder counts and the motion interpolation divided into 25 equal segments CAM Profile zZ Z E o T T T 1500 2000 2500 3000 Master Motor Position Continued on next page 158 Related Command BASE CTR G LOAD MC2 M
136. Maximum Allowable Temperature APPLICATION Temperature control DESCRIPTION Set maximum allowable temperature limit EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Read write LANGUAGE ACCESS N A UNITS Degrees Centigrade RANGE OF VALUES 0 to 70 TYPICAL VALUES 20 to 60 DEFAULT VALUE 70 or 85 model number dependant FIRMWARE VERSIONS 4 11 and higher DETAILED DESCRIPTION TH expression sets the maximum allowable temperature at which the SmartMotor is permitted to continually servo The amount of time that the SmartMotor can still servo at or above this temperature is set by the THD function If the temperature stays at or above the TH value for longer than THD servo samples the amplifier will turn off Bh will be set to 1 the motor off bit Bo set to 1 and the trajectory bit cleared to 0 If issued RMODE will return O The SmartMotor will reject any command to start motion until the temperature has fallen 5 Celsius There is no direct report command for TH but variable TH and PRINT TH are both valid EXAMPLE demonstrates relationship between TEMP TH and Bh GOSUB10 report TEMP TH and Bh a 5 WHILE a gt 5 vary TH about the present TEMP TH TEMP a WATT 2000 GOSUB10 observe Bh flag change from o to 1 a a 1 as TH is reduced to TEMP value and less LOOP END c10 PRINT 13 Read the temperatur TEMP PRINT 13 Read TH overh
137. Motor does NOT echo received serial 1 characters ECHO EXECUTION Immediate ECHO_OFF CONDITIONAL TO N A ECHO_OFF1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE ECHO is off FIRMWARE VERSIONS ALL DETAILED DESCRIPTION ECHO_OFF1 causes the SmartMotor channel 1 serial port to stop echoing No incoming channel 1 characters are retransmitted The command can be issued to control a single motor communicating with a host terminal or any another serial device as well as control groups of motors sharing series or parallel serial communication I O lines 107 Related Commands ELSEIF exp ENDIF IF exp ELSE IF Structure command flow element APPLICATION Program execution control DESCRIPTION Component of IF expression ELSE ENDIF control block EXECUTION Immediate if exercised CONDITIONAL TO Value of associated IF expression LIMITATIONS Must reside with IF expression ENDIF program control block REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION An IF expression ENDIF control block may optionally include an ELSE state ment to control execution when none of the test conditions are true Sup pose that you want the SmartMotor to do one thing if the variable g
138. ON Communications output control DESCRIPTION Serial communications channel 0 PRINT function EXECUTION Immediate at present baud rate CONDITIONAL TO Host or channel 0 serial port open LIMITATIONS Output is not buffered each character transmitted must wait for previous character to be finished Next command not executed until entire PRINT function is done REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES Values passed to PRINT string must be in the range of 2147483648 to 2147483647 TYPICAL VALUES Any of the ASCII character set DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION PRINT ASCII string ascii_code expression The PRINT command is used to transmit output data to the serial communica tions channel 0 RS232 TX and RS232 RX pins otherwise known as the primary host channel PRINT commands may be used to send output to a terminal for display communicate with third party devices or used to send commands to other motors All items to be printed reside within the parentheses and are separated by commas ASCII Text strings must be within double quotation marks Variables are referenced by name and their ASCII string vales are printed Simple math expressions are allowed Raw ASCII code values are prefixed by the sign The SPACE character is 32 TAB is 9 CARRIAGE RETURN is 13 and LINE FEED is 10 PRINT commands pause other code execution until t
139. ON Set Pin B output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0or1 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line B can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN B as an output set the value of the pin B output latch UB to either 0 or 1 Issue the command UBO if this has not already been issued I O pin A will be a logic high voltage if UB 1 and a logic low voltage if UB 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UBA function EXAMPLE UBO set PIN B to function as a digital output UB 0 set PIN B to logic 0 zero volts UB 1 set PIN B to logic 1 5 volts Note The I O state can be set prior to assigning as an output UB 0 Pre set PIN B to logic 0 zero volts UBO set PIN B as an output pre initialized to zero 297 Related Command UB UBI UBO UBA Read I O Port B as Analog Input APPLICATION I O input DESCRIPTION Read Pin B analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UBA READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 10
140. ONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKP READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 32767 TYPICAL VALUES 40 to 300 DEFAULT VALUE Motor size dependant FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The KP command is used to set the gain of the proportional parameter of the PID filter Any new value of KP is held in a buffer until an F command is issued The higher the KP the stiffer the motor will be At some point the added stiffness will cause the motor to become unstable If moving the KD value up and down cannot stabilize the servo then the KP value is too high and must be reduced PRINT KP 13 and RKP both report the value of KP through the primary serial port while PRINT1 KP 13 sends it out channel 1 KP is valid with any expres sion and can be treated as if it were any read write variable The motion and servo characteristics are unaffected until KP is applied by the F function EXAMPLE KP 250 Set buffered proportional gain E Update Filter 144 Related Command KA KD KG KI KL KP KV KS expression PID Derivative Term Sample Rate APPLICATION PID filter control DESCRIPTION Inertial load gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS Must be positive REPORT COMMAND RKS READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional
141. OTION A 222 V 44444 MV G THD 32000 THD default 12000 PID samples or 3 seconds TH TEMP 5 Force an over heat condition Units are degrees Centigrade a CLK WHILE Bh Q LOOP WHILE Bt LOOP b CLK PRINT 13 Servo OFF after b a PID samples END 290 Related Command WAIT exp TWAIT Pause Program Execution During Active Trajectory APPLICATION Program execution control DESCRIPTION Suspend command execution while in trajectory EXECUTION Immediate CONDITIONAL TO Bt state LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The TWAIT command will pause program execution until the Busy Trajectory status bit clears Normally program execution and trajectory generation are completely inde pendent Regardless of what the motion is doing the processor executed ode form the top down If there were three consecutive motion commands they would all exe cute sequentially Before the motor could even start to move last motion command would dominate Using the TWAIT command however allows the move commands to occur and complete end to end An alternative to TWAIT is WHILE Bt LOOP Both TWAIT and the WHILE Bt construction terminate when the trajectory ends regardless of the cause Depending on the application you may wish to perform error checking to ensure that
142. Off Status Bit APPLICATION Monitor Motor Off State DESCRIPTION Motor OFF state EXECUTION Sampled each PID sample CONDITIONAL TO Motor is off LIMITATIONS None REPORT COMMAND RBo READ WRITE Read only Set by G LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE 1 Motor is off DEFAULT VALUE 0 Motor is on 1 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Simply stated Bo 0 drive stage is on Bo 1 dirve stage is off The Red Drive LED on the motor direclty follows the Bo bit and is therfore a direct indication of the Bo bit If Bo 1 the Red LED is on If Bo 0 the Red LED is off There are only three reasons that Bo 1 1 Upon first power up of a SmartMotor and prior to any command that would turn on the drive stage 2 Any time the OFF command is issued 3 Any Motor Fault resulting in the OFF command being issued at firmware level a Position Error Be 1 b Overheat RMS Over Current Bh 1 c Exceeding enabled travel limits Br or BI detected even briefly A motor reset via the Z command will also have Bo set to one only beacuce it is the same as a Power up in 1 above If BRKTRJ has been issued when a trajectory is not in progress Bt is 0 the brake is engaged and power is not applied to the motor coils In this state Bo will not be 0 even though the amplifier is actually off This may seem confusing but it is because the brake is h
143. P is a standard loop forever control block Each WHILE expression control block must be terminated with a corresponding LOOP exit statement WHILE control blocks may be nested If BREAK is encountered while executing a WHILE control block program execution unconditionally takes up after the LOOP statement WHILE is not a valid terminal command it is only valid within a user program SEE EXAMPLES ON NEXT PAGE 340 Related Command BREAK LOOP IF SWITCH EXAMPLE WHIL Ezi LOOP EXAMPLE a 0 WHILI til LOOP END WHILE expression continued program flow structures Bt While trajectory still in progress More efficient than Bt UB 1 Set output high UB 0 Set output low Loop back to While a lt 7 b a lt 3 this is valid syntax IF b PRINT T true ELSE PRINT F false ENDIF a atl increment loop index output is T TT FF FP EXAMPLE OF NESTED WHILE LOOPS D 20000 A 100 V 1000000 MP WHIL ial LOOP PRINT Port C was grounded 13 END WHILI wal len WHIL I Gl LOOP WHILE wait if UCL ENDIF Set Relative Move Distance Set Acceleration Set Velocity Set to Position Mode While Forever UAI 1 LOOP for Port A to be grounded Start Relative Move Bt While Moving IF UBI Tf Port B is grounded X Stop motion ENDIF UAI 0 LOOP for Port A to reset If
144. PTION RBu reports the state of the array index error flag Bu It returns a 1 if there was any attempt to use an invalid index for an array variable and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bu 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 Bu is reset by Z ZS and Zu Note illegal array indexes always set Bs flag EXAMPLE if the following is executed by a user program ZS m 44444 Raw m PRINT 13 Issued Raw illegal 13 PRINT Bu Rbu Bu 1 array index range error occurred PRINT Bs RBs Bs is 1 syntax occurred PRINT 13 Issue ZS 13 AS PRINT Bu RBu PRINT Bs Bs RBs n 44444 s aw n Illegal assignment behaves differently PRINT 13 Assigned aw illegal 13 expression value is simply not assigned PRINT Bu Rbu Bir ass Q PRINT Bs RBs Bs ast 1 END 231 Related Command G Z RBw Report Encoder Wrap Status Bit APPLICATION Report command DESCRIPTION Report system state flag EXECUTION Immediate CONDITIONAL TO Current motion mode LIMITATIONS N A REPORT VALUE Bw READ WRITE N A LANGUAGE ACCESS N A UNITS
145. Port C was grounded BREAK exit the WHILE 1 LOOP 341 X Decelerate Shaft to a Relative Position Related APPLICATION Trajectory control ARRA DESCRIPTION Slow motor motion to stop j EXECUTION Immediate j CONDITIONAL TO A non zero LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A RELATED COMMANDS G S FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The X command immediately abandons the current trajectory mode and causes the motor to slow to a stop using the current acceleration value A This is different from the S command which stops the motor a soon as possible without regard to the cur rent acceleration Regardless of the motion mode prior to the command X leaves the motor position mode The response to RMODE will be an R EXAMPLE MP Select Position Mode A 200 Set Acceleration V 50000 Set Velocity P 1000000 Set Position G Start Motion WHILE Bt Loop while Trajectory IF UAI I input goes high X Decelerate now ENDIF RMODE response is R LOOP 342 Related Command RUN RUN This command should not be used in a stored SmartMotor program Z Total CPU Reset APPLICATION Reset motor DESCRIPTION Software reset motor to power up condition EXECUTION Immediate CONDITIONAL TO Serial character transmit completion LIMITATIONS None REPORT COMMAND N A READ WRITE N
146. Program Data space error 1 if Buffer Overflow to much data received 1 if Buffer Underflow to little data received 1 if If in Host Mode 0 if not in Host Mode Atrajectory terminates if an unacceptable position error occurs if invalid data received if data overflow or if data underflow The host should send data pairs only when at least 3 empty data slots are available MD responds to limit switches trajectory will be aborted MD mode uses KV feed forward for improved performance 199 Related Command PRINT It is recommended that you use the alternative PRINT command when printing from your embedded programs because of its greater completeness and versitility Ra Rz Report 32 Bit Variable Data Value APPLICATION Report command DESCRIPTION Report user variablea zZ EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Pre 4 00 only variables defined are a b c d e f g and h REPORT VALUE a through z READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 RELATED COMMANDS N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Ra reports the signed value of the variable a to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value
147. R Set Motor Address APPLICATION Serial communications control DESCRIPTION Motor address EXECUTION N A CONDITIONAL TO Firmware gt 4 15 Use SADDR for lt 4 15 LIMITATIONS N A REPORT COMMAND _ PRINT ADDR variable ADDR R variable READ WRITE Read Write above version 4 15 LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Address RANGE OF VALUES 0 to 100 TYPICAL VALUES 1 to 100 DEFAULT VALUE 0 on power up until assigned FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION SmartMotors are designed to be used as much in multiple axis systems as in single axis ones For that reason they have been afforded the ability to be uniquely addressed This is done with the ADDR expression command not available in ver sions below 4 15 Use the SADDR command For example ADDR 5 or SADDR5 both set the motor s address to be 5 ADDR is a read write function so it can also be used to access the address of the current SmartMotor Using ADDR within a program permits an identical program stored in different motors to differentiate between motors and provide individual runtime controls SWITCH ADDR CASE 1 motors 1 2 and 3 GO CASE 2 CASE 3G BREAK CASE 4 S motor 4 STOP ENDS Start motion or stop Note ADDR syntax DOES NOT work with v4 40 SM2315 series motors SADDR syntax must be used to assign the address 34 Related Commands AOUT DIN DOUT UAA All seven
148. RT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Power On BRKSRV Power Off brake is engaged FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release When BRKENG is issued the brake is de energized allowing the magnetic brake to lock the shaft in place BRKENG terminates the brake control modes BRKSRV BRKTRJ and BRKRLS NOTE BRKENG is a manual over ride to the BRKSRV and BRKTRJ commands You must subsequently issue either BRKSRV BRKTRJ or BRKRLS to allow any further shaft movement EXAMPLE OFF turn motor off WHILE V wait for zero velocity LOOP before BRKENG applying the brake shaft locked 67 Related Commands BRKENG BRKRLS BRKSRV BRKTRJ BRKC BRKI UGO BRKG Brake Control Re Direct to Port G APPLICATION Hardware brake control DESCRIPTION Re Direct Brake Control to Port G user Output EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO BRKI BRKC LIMITATIONS None REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A
149. S Expressions and conditional testing UNITS Set of 4 binary state bits RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION CHNO holds binary coded historical error information regarding the channel 0 com munications channel It gives the 4 bit status of the primary or channel 0 serial port broken down as follows CHNO bit 0 1 if the primary receive buffer has overflowed CHNO bit 1 1 if a framing error occurred on channel 0 CHNO bit 2 1 if a scan error occurred on channel 0 CHNO bit 3 1 if a parity error occurred on channel 0 If RCHNO returns a 4 it means that a scan error was detected on channel 0 If CHNO equals zero no error has been detected since opening the channel CHNO is read only but cannot be assigned to a variable It can be reported through RCHNO as already seen and PRINT CHNO 13 and PRINT1 CHNO 13 as well SEE EXAMPLES ON FOLLOWING PAGE 81 Related Commands CHN CHN1 RCHN RCHNO RCHN1 CHNO continued Communications Error Flag RS 232 EXAMPLE The host transmitted A 100 but the serial port actually received K 100 then tried to execute K 100 PRINT CHNO responds to host with 4 since K is invalid EXAMPLE test individual flags IF CHNO amp 4 PRINT HOST CHANNE ELSEIF CHNO amp 1 PRINT HOST CHANNEL buffer overflow scan error occurred ENDIF EXAMPLE test
150. S 4 or a G command is issued AND the Bp bit is not set RPW RW In PLS firmware motors Br is reset to zero under the following conditions By issuing either Zr and ZS UCI UCP Example code UCO IF Br UDI PRINT Right LIMIT PRESENTLY ACTIVE UDM ELSEIF Bp PRINT Right LIMIT PREVIOUSLY CONTACTED UDO ELSE PRINT Right LIMIT NEVER REACHED SLE ENDIF SLD SLP SLN ZI ZS Hardware Travel Limit Overview Status Bits Command to kate to cone to i j i Isable nable Pos Neg Plus Minus Left Right Real Time Historical Clear Historical Bit tavel Limit input Travel Limit Input Posive PLus ricHT Br Bp zrorzs uCloruco 56 Related Commands RCS RCS1 RCKS RBk RUN Z ZS Bs Syntax Error Status Bit APPLICATION Monitor Command Syntax Errors DESCRIPTION Command syntax error occurred state EXECUTION Immediate CONDITIONAL TO Syntax error found while executing commands LIMITATIONS None REPORT COMMAND RBs READ WRITE Read only Reset to zero using Zs command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE DEFAULT VALUE 0 no syntax error occurred 1 syntax error detected 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION If a syntax error is encountered in either a serial command or user program the Bs flag is set to 1 This flag only indicates that a syntax error was encountered The most common syntax errors are mi
151. SCRIPTION Reset serial communication framing error latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBf READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Zf resets system flag Bf the serial communications framing error violation latch to zero A framing error means that the serial communications has failed at a fundamen tal level For safe operation it is vital to find and eliminate the cause if this error flag is ever set EXAMPLE IF BE PRINT Framing Zf ENDIF Test flag Error Reset flag 349 Related Command BI RBI APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES RESET VALUE Zli Reset Historical Left Limit Flag Flag Program execution control Reset historical left limit latch Immediate N A N A RBI N A N A N A N A N A 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION ZI resets system flag BI the left limit latch to zero If you use BI to detect the activation of the left limit take care to reset it with ZI before scanning for the bit again EXAMPLE IF B1 Test flag PRINT Left Limit Latched AL ENDIF Reset flag 350 Related Command Br RBr Zr Reset Historical Righ
152. Set origin to 1234 i Demonstration 13 E i a a PRINT 1 and b b 13 1 atb a b 13 Sean 1 Position P 13 WAIT 10 Allow time for serial buffer processing PRINT1 KP KP 13 PRINT1 Hello World 13 13 RINT1 Run Subroutines 13 AIT 10 RINT1 128 GOSUB5 13 tell all motors to run ubroutine 5 AIT 10 RINT1 129 GOSUB10 13 Tell Motor 1 to run subroutine RINT1 130 GOSUB20 13 Tell Motor 2 to run subroutine RINT1 131 GOSUB30 13 Tell Motor 3 to run subroutine ll ES No Ww a See oor owes eee H T mn fo RINT1 132 GOSUB x 13 Tell Motor 4 to run subroutine j N W v 100000 a 100 p 2000 PRINT1 130 A a V v 13 Set speed and accel in etor 2 AIT 10 RINT1 130 MP P p G 13 Command Motor 2 to osition 2000 AIT 10 RINT1 13 13 End of Demonstration 13 Ayvst vas a iw OUTPUT Demonstration a 1 and b 2 atb 3 Position 1234 KP 100 Hello World Run Subroutines GOSUB5 GOSUB10 GOSUB20 GOSUB30 GOSUB123 A 100 V 100000 MP P 2000 G End of Demonstration 196 Related Command BAUD CCHN CMD DAT OCHN PRINT PRINT1 PRINTA PRINTH Print to External LCD Display APPLICATION Anilink communications output control DESCRIPTION Anilink communications PRINT function EXECUTION Immediate at present baudr
153. SmartMotor I O points also serve as direct Analog inputs AIN address input Analog Input from I O Device APPLICATION Input command use with Anilink device DESCRIPTION Fetch 8 bit analog input byte EXECUTION Immediate AniLink byte read CONDITIONAL TO N A LIMITATIONS Port A H and Input 1 2 3 or 4 REPORT COMMAND RAIN address input READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Numerical value RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE 255 in absence of peripheral device FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The SmartMotor communicates with optional expansion cards such as the AlO 100 and AlO110 AniLink cards through the AIN address input command where address refers to the address of the Anilnk card and input refers to the input channel of the Anilink card The address is given as a character between A and H while the input is between 1 and 4 See the AlO 100 User Manual for specific details The AIN address input returns an unsigned 8 bit value ranging from 0 to 255 lin early corresponding to the analog voltage on the specified input channel A return of 0 corresponds to 0 volts and 255 to 5 volts If the specified card is not present or the connected is not present the function will return a value of 255 The AIN address input function is read only It cannot be used on the left side of an equation but only on the right
154. TION Hardware brake control DESCRIPTION Re Direct Brake Control to Internal Brake Pin EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO BRKG BRKC LIMITATIONS None REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE BRKI Brake Control Default to Internal Bake Pin FIRMWARE VERSIONS 4 15 all PLS firmware Not available on 4 40 DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release If an External Brake is used instead of the optional internal brake the BRKC or BRKG commands allow automatic and interrupt driven control of the external brake via I O port pin C or G respectively BRKI allows the control of the internal brake The logic state follows the present Brake control method chosen See BRKSRV BRKTRJ BRKENG and BRKRLS for more Example UGO Assign Port G to be used as an output pin BRKG t Direct brake control to port G pin BRKI Re Direct brake control back to internal brake 69 Related Commands BRKENG BRKSRV BRKTRJ BRKC BRKG BRKI It is important to turn the ser
155. TO Present encoder count LIMITATIONS SmartMotor s axis must be at rest REPORT COMMAND RP READ WRITE Write only LANGUAGE ACCESS Assignment UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The O expression allows the current position to be set to any value desired You may declare the current position to be zero by entering O 0 the letter O the number zero Similarly you may declare the current position to be 1234 by entering O 1234 Using the O expression does not modify previously entered P and D registers The O expression avoids position drift and accumulated error by changing the SmartMotor s commanded position for the sample in which the command is executed regardless of the real time position error and whether or not the shaft is moving This command is useful in homing routines to set an origin or home position In firmware versions 4 12 4 40 and later The SmartMotor explicitly performs the O expression operation before checking for excessive position error O 0 is often used to avert a 32 bit roll over condition Continued on next page 185 Related Command RP MSO MFO O expression continued Set Main Position Counter EXAMPLE reassigning origin does not destroy P and P buffered values A 20 V 100000 P 5000 MP O 1000 present position set to negative 10000 GOSUB5
156. TTL 0 to 5V input TTL output 10 bit analog input the AniLink data line and the RS485 A signal While user I O line E defaults to being the AniLink data line it can be explicitly set up as a digital input with the UEI command If O line E has been set to an output with the command UEO it can be reset to be an input with the command UEI U ser defined I O pin E as I nput T F hat input into variable name n EXAMPLE UEI Ini bialisg PRINT 13 PIN E Input UET n UEI Store state of I O pin as digital PRINT 13 REPORT PIN E Input Rn END RUE Directly Report Port E logic State n U amp amp 16 Bitmask Port E to the variable n Rn Report Result gt 4 76 firmware only gt 4 76 firmware only 316 Related Command UE UEA UEO APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS DETAILED DESCRIPTION UEI as input value Set I O Port E to Input I O input Input at Pin E Immediate N A N A PRINT UEI Read only Expression and conditional testing Binary bit Oor1 Oor1 I O dependent 4 00 and higher User I O line E serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input the AniLink data line and the RS485 A signal While user I O line E defaults to be
157. To describe the relationship between user assigned variables aa thru zzz and variable arrays abf al and aw a z continued 32 Bit Variables The following are other restrictions e If a b exceeds 32 signed bits the operation c a b will produce a wrong result No error flag is set e If a b exceeds 32 signed bits the operation c a b will produce a wrong result No error flag is set If a b exceeds 32 signed bits the operation c a b will produce a wrong result The system flag Bd will bet set If one of these variables is used with a variable of another type it will be appropri ately converted In technical jargon the variable will be type cast For example in the equation where the variable on the left of the equal sign is a 16 bit one like aw 4 all variables will be converted to 16 bit values and then operated on Assigning the variable aw 27 y directly stores the 16 least significant bits of y into aw 27 The higher bits of the variable y are lost Similarly if the right hand variable is an 8 bit one like ab 167 all variables will be converted to 8 bit values before being operated on Conversely if the left hand value is a 32 bit variable and the right hand side contains 16 bit variables the 16 bit variables will be temporarily upgraded to 32 bits In the equation c ab 4 aw 7 both ab 4 and aw 7 are converted into 32 bit numbers before the subtraction occurs In the SmartMotor language all use
158. a lt 0 13 END 75 Related Commands GOSUBnnn GOTOnnn C statement_label_ number Program Subroutine Label APPLICATION Program execution flow control DESCRIPTION Program statement label EXECUTION N A CONDITIONAL TO N A LIMITATIONS Pre 4 00 firmware only permits labels C0 C9 Firmware 4 00 and higher permits labels C0 C999 REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION C number is a statement label where number is a value between 0 and 999 Statement labels mainly provide the internal addressing required to support the GOSUB number and GOTO number language commands For example GOTO1 directs the program to label C1 while GOSUB37 directs the program to the subrou tine that starts at label C37 You can also use labels to simply enhance program clar ity Statement labels may be placed anywhere within a program except in the middle of an expressions The program labels work via a jump table in the header of the compiled program The header contains the location of every label from 0 up to the highest label value used EXAMPLES consider these two programs co END and c999 END The first compiled program CO END will be much smaller than the second C999 END even though they behave exactly the same The program header is
159. ab 4 and aw 7 are converted into 32 bit numbers before the subtraction occurs In the SmartMotor language all user variables are written as lower case variables while functions and commands have at least one upper case character The term al i is a general purpose variable while A is the Acceleration function Any user variable can be assigned a value with an equation as discussed above but can also be sequentially loaded by specifying the starting variable and the series of values to be loaded Continued on following page 27 Related Commands a z aa 2ZzZ aaa ZZZ ab index aw index VST VLD SEE APPENDIX C To describe the relationship between user assigned variables aa thru zzz and variable arrays abf al and aw al index continued 32 Bit Array Variables Continued from preceding page EXAMPLE al 6 123 345 567 346 678678 The above loads sets al 6 equal to 123 al 7 to 345 and so forth ending with 678678 loaded into al 10 The command syntax requires a space between the leading vari able and each subsequent value The function is terminated by a period All user variables are initialized to the value of 0 at power up or upon execution of the system reset command Z Other than by direct assignment this is the only way that the SmartMotor sets all of the user variables to 0 Issuing a RUN command does not perform this automatic initialization For this reason it is usually pref
160. ace with the variables aa through zz and aaa through zzz The syntax of the 32 bit array is al index al stands for array long and accepts an index value between 0 and 49 This index can be specified explic itly or though another variable EXAMPLE al 4 refers to the fifth element count begins with zero in the 32 bit array The value of any array element al is reported with the R PRINT or PRINT1 functions For example to send the value of variable al 47 out the primary serial port u se the command Ral 47 or PRINT al 47 13 To send the value of the variable al 37 out serial port 1 use PRINT1 al 37 13 The alf array is classified as read write meaning that they can be assigned a 26 Related Commands a z aa zz aaa ZZZ ab index aw index VST al index continued 32 Bit Array Variables value or can be assigned to some other variable or function Another way of saying this though more cryptically technocratic is that these variables can be left or right hand values EXAMPLE al 24 a1 43 a1 7 is a valid equation combining al 43 and al 7 and sending the total into al 24 As signed 32 bit variables they are subject to the usual restrictions of signed digital words and values The first bit is always a sign bit They are limited to integer val ues between 2147483648 to 2147483647 Math operations that result in decimal values are truncated or rounded down If you assign or p
161. ach PID sample LIMH LIML UCI UCP UCO N A Bp N A N A Binary state 0to1 Right limit switch active Right limit switch not active FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBp reports the value of the Historical right limit flag Bp It returns a 1 if an active left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bp 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 227 Related Command Z RBr Report Real Time Right Over Travel Limit State APPLICATION DESCRIPTION EXECUTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 Report command Report Right Limit Active State Latch Updated each PID sample Updated each PID sample LIMH LIMH UCP N A Br N A N A Binary state 0to1 Right limit switch active Right limit switch not active FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBr reports the value of the real time right limit flag Br It returns a 1 if an activ
162. ad from locatio RX Report result wil the 8 bit array byte 0 to 100 EPTR incremental to 101 automatically again n 100 into the variable x l be 126 Storing and retrieving a 5 consecutive 32 bit standard variables a 10 11 12 13 14 assign EPTR 100 Set Eprom pointer VST a 5 EPTR will increme 4 bytes x 5 sto EPTR 100 Set Eprom to 100 VLD v 5 Load from locatio RV will report 1 Rw will report 1 RX will report 1 Ry Will report 1 RZ will report 1 Storing 7 16 bit numbers into EEPROM i 10 Using the variable 3 7 Using the variable variables you wish Example 16 bit array data Data aw i 1111 2222 3333 4444 EPTR 3200 Set EPR VST aw i j Store beginni into EP values to the variables a thru f to 100 nt to 100 4 5 120 red again n 100 into the variable b 0 1 2 3 4 i as index to an array variable j as the number of sequential co store 1111 2222 3333 OM memory pointer location to 3200 j or 7 sequential variables ng with aw il ROM starting at address 3200 Note The EEPROM value will automatically increment for each value stored EPTR value after above execution will be set to 3200 7 variable 2 bytes each or 3214 Retrieving Same data into other variables for later use EPTR 3200 i 10 Using the variable j 7 Using the variable variables you wish VLD aw r s WHILE t lt 5 PRINT 13 aw ttr
163. all flags IF CHNO PRINT SERIAL ERROR ENDIF 82 Related Commands CHN CHNO RCHN RCHNO RCHN1 CHN1 Communications Error Flag RS 485 APPLICATION Serial communications control DESCRIPTION Fetch serial communications channel 1 error event flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RCHN1 READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Set of 4 binary state bits RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION CHN1 holds binary coded historical error information regarding the channel 1 com munications channel It gives the 4 bit status of the channel 1 serial port broken down as follows CHN1 bit 0 1 if the primary receive buffer has overflow CHN1 bit 1 1 if a framing error occurred on channel 0 CHN1 bit 2 1 if a scan error occurred on channel 0 CHN1 bit 3 1 if a parity error occurred on channel 0 If RCHN1 returns a 4 it means that a scan error was detected on channel 1 If CHN1 equals zero no error has been detected since opening the channel CHN 1 is read only but cannot be assigned to a variable It can be reported through RCHN 1 as already seen and PRINT CHN1 13 and PRINT1 CHN1 13 as well SEE EXAMPLES ON FOLLOWING PAGE 83 Related Commands CHN CHNO RCHN RCHNO RCHN1 CHN1 continued Communications
164. an happen in very tight loops that don t allow the G command to fully process with each cycle such as the following EXAMPLE c10 Place a label P CTR Set position equal to CTR G Issue GO command GOTO10 Loop back to label This type of code practice is not recommended because it forces a re calculation over and over again and will cause abrupt jerks or small glitches in the move profile 128 Related Command GETCHR1 LEN LEN1 OCHN WARNING The OCHN command will cause the SmartMotor to ignore incomming commands and can lock you out It is a good idea to use the RUN command during development If you get locked out you can recover by sending two capitol E s during the first 1 2 second after power up This will cause the motor to abort its program and give you a chance to download a better one The terminal software has utilites to do this APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE GETCHR Get Character from main RS 232 Serial communications control Fetch next character in channel 0 serial input buffer Immediate Requires that a character is in the buffer Must check if LEN gt 0 before using N A Read only Expressions and conditional testing N A N A N A N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION GETCHR reads and removes the next
165. an output with the command UDO it can be reset to be an input with the command UDI EXAMPLE UDI Initialize U ser defined I O pin D as I nput PRINT 13 PIN D Input UDT n UDI Store state of I O pin D as digital input into variable name n PRINT 13 REPORT PIN D Input Rn END 310 Related Command UD UDA UDM UDO UDI as input value Read I O Port D to Input APPLICATION I O input DESCRIPTION Input at Pin D EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UDI RUDI gt v4 76 READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line D serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input and Defaults to being the negative travel limit input It can be accessed with the statement variable UDI PRINT UDI 13 or WHILE UDI LOOP The digital read occurs once at the time the UDI command is executed Assigning the variable a UDI will perform the digital read once and store it into the variable a EXAMPLE UDI Initialize U ser defined I O pin D as PRINT 13 PIN D Input UDT n UDI Store state of I O pin D as digital input into variable name n PRINT 13 REPORT PIN D Input Rn END RUD Directly Report Port D
166. and then tests the CASE numbers for a equal value in the order written in the program If the expression value does not equal the CASE number the next CASE statement is evaluated If the expression value does equal the CASE number program execution continues with the command immediately after The execution time is similar to the equivalent IF expression control block This means placing the most likely CASE values at the top of the CASE list will yield the faster average program execution time The DEFAULT entry point is used if no CASE number is equals the expression value it is executed last If no CASE number equals the value of the SWITCH expression and there is no DEFAULT case program execution passes through the SWITCH to the ENDS without performing any commands If a BREAK is encountered program execution branches to the instruction or label following the ENDS of the SWITCH control block BREAK can be used to isolate CASEs Without BREAK the CASE number syntax is transparent and program execution continues at the next instruction That is you will run into the next CASE number code sequence Each SWITCH control block must have at least one CASE number defined plus one and only one ENDS statement SWITCH is not a valid terminal command it is only valid within a user program 282 Related Command BREAK CASE number DEFAULT ENDS SWITCH expression continued Selectable Program Flow Control Consider the following code
167. ant bits of al m into aw 27 The higher bits of the variable al m are lost Conversely if the left value is a 32 bit variable and the right side contains 16 bit variables the 16 bit variables will tempo rarily revert to 32 bits In the equation al 3 ab 4 aw 7 both ab 4 and aw 7 are converted into 32 bit numbers before the subtraction occurs In the SmartMotor language all user variables are written as lower case variables while functions and commands have at least one upper case character The term awl i is a general purpose variable while A is the Acceleration function Any user variable can be assigned a value with an equation as discussed above but can also be sequentially loaded by specifying the starting variable and the series of values to be loaded Continued on following page 30 Related Commands a z aa zz aaa ZZZ alfindex ab index VST VLD APPENDIX C Page uses tables to describe the relationship between user assigned variables aa thru zzz and variable arrays abf al and aw aw index continued 16 Bit Array Variable Continued from preceding page EXAMPLE aw 6 123 345 567 346 31868 The above loads sets aw 6 equal to 123 aw 7 to 345 and so forth ending with 31868 loaded into aw 10 The command syntax requires a space between the lead ing variable and each subsequent value The function is terminated by a period All user variables are initia
168. as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UCA UFA b UFA PRINT 13 REPORT UFA Rb RUFA Directly Report Port F Analog Value gt 4 76 firmware only 320 Related Command UF UFA UFO UFI as command Set I O Port F to Input APPLICATION I O control DESCRIPTION Set Pin F to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line F serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input the AniLink clock line and the RS485 B signal While user I O line F defaults to being the AniLink clock line it can be explicitly set up as a digital input with the UFI command If I O line F has been set to an output with the command UFO it can be reset to be an input with the command UFI EXAMPLE UFI Initialize U ser defined I O pin F as I nput PRINT 13 PIN F Input UFI
169. ask Port F to the variable n gt 4 76 firmware only Rn Report Result 322 Related Command UF UFA UFI UFO as command Set I O Port F to Output APPLICATION I O control DESCRIPTION Set Pin F to be an output EXECUTION Immediate CONDITIONAL TO UF 0 or UF 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Although its default function is to be the AniLink clock line user I O line F can function as a TTL output The command UFO specifies the I O pin F as an output while UF value sets the voltage I O pin F will be a logic high voltage if UF 1 and a logic low voltage if UF 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UFA function In order for the output voltage to reflect the state of UF both UFO and UF value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UFO and UF 0 have been issued You only have to issue UFO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE set PIN F as output and recall output latch value UFO define PIN F output UF 1 set output latch value PRINT UFO recall the l
170. atch value response is 1 UF 0 set output latch value PRINT UFO recall the latch value response is 0 323 Related Command UGA UGI UGO RS4 UG Enable Re Enable Port G Sync Functionality APPLICATION I O control DESCRIPTION Set Pin G to Act as G command when grounded EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS Assignment only UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line G can function as the GO or G command when grounded It does so by default If at any time UGI or UGO commands are used this func tionality is disabled To Re enable the sync function just issue UG by itself The reason it is called the sync function is because it allows multiple motors to trig ger Go commands via hardware at the exact same time thereby synchronizing them 324 Related Command UGA UGI UGO RS4 UG expression Set I O Port G Output Logic State APPLICATION I O control DESCRIPTION Set Pin G output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line G can function as a TTL output The pin defaults to be a general p
171. ate CONDITIONAL TO Anilink LCD required for display LIMITATIONS Output is not buffered Each character transmitted must wait for previous character to be finished Next command not executed until entire PRINT function is done REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES Expressions limited to 2147483648 to 2147483647 TYPICAL VALUES Any of ASCII character set DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The PRINTA through PRINTH print to an LCD on the AniLink port or to a DIO 100 card The command actually employs DOUTA1 as the export mechanism PRINTA outputs to an LCD that is addressed A PRINTB to an LCD addressed B and so forth As in the case with all AniLink expansion cards the LCD address is selectable via jumpers Allitems to be printed reside within the parentheses and are separated by commas ASCII Text strings must be within double quotation marks Variables are referenced by name and their ASCII string vales are printed Simple math expressions are allowed Raw ASCII code values are prefixed by the sign The SPACE character is 32 TAB is 9 CARRIAGE RETURN is 13 and LINE FEED is 10 There is a practical difference between PRINTA a b c and the sequence PRINTA a PRINTA b PRINTA c Executing from within a program PRINTA a b c will be output the values of a b and c without the possibility of another command from the terminal interf
172. available character in the channel 0 serial receive buffer It is absolutely necessary to check that LEN gt 0 before issuing the GETCHR command Normally the SmartMotor interprets incoming RS 232 data as com mands Sometimes it is useful to prevent that from happening and instead write a custom command interpreter This is accomplished by re opening the input channel in data mode with the OCHN command EXAMPLE C20 IF LEN gt 0 c IF c 69 END ENDIF ENDIF GOTO20 Place a label Check to see that LEN gt 0 Get character from buffer Check to see if it is an End the program Loop back to C20 129 Related Command GETCHR LEN LEN1 OCHN1 APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE GETCHR1 Get Character From RS 485 Serial communications control Fetch next character in channel 1 serial input buffer Immediate Requires that a character is in the buffer Must check if LEN1 gt 0 before using N A Read only Expressions and conditional test N A N A N A N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION GETCHR 1 reads and removes the next available character in the channel 1 serial receive buffer It is absolutely necessary to check that LEN1 gt 0 before issuing the GETCHR1 command Sometimes it is useful to be able to accept special
173. aw array elements only after they have been used The actual cam target positions can be increased by 2x 4x or 8x with the MC2 MC4 or MC8 statements In other words suppose aw 20 100 If you use MC2 the effective value will be 200 with MC4 it will be 400 and with MC8 it will be 800 So MC2 MC4 or MC8 change the amplitude by a factor of 2X 4X or 8X respectively The Cam Mode like any other position mode is subject to the error band defined by the E value and subject to limit switch inputs While in motion during Cam Mode flag Bo will be 0 flag Bt will be 1 and flag Be will be 0 Note PLS version Firmware allow the ability to run a relative CAM mode vice Absolute Please consult the Firmware addendum documents for more detail 159 MC2 Mode CAM 2X Multiplier Related Command APPLICATION Motion mode control BASE DESCRIPTION Request MODE CAM with x2 multiplier CTR EXECUTION Buffered pending a G G CONDITIONAL TO BASE expression and SIZE expression MC LIMITATIONS Requires external encoder signal source MC4 REPORT COMMAND RMODE MC8 READ WRITE N A MF1 LANGUAGE ACCESS N A MF2 UNITS N A MF4 RANGE OF VALUES N A MS TYPICAL VALUES N A SIZE DEFAULT MODE MP FIRMWARE VERSIONS Version 4 10 and higher DETAILED DESCRIPTION Same as mode MC in all regards with exception that all data points int he CAM table are multiplied by 2 Suppose the following CAM table aw 0 0 10 20 30 40 50 40 30 20 10 0 The CAM motor w
174. ay Variable Memory Map Page 1 of 2 ir v gjo _ 357 MSB aw 56 al 28 LSB MSB aw 57 LSB MSB aw 58 al 29 al 32 LSB MSB hhh al 33 LSB MSB B MSB aw 68 al 34 LSB MSB aw 69 LSI LSB Array Variable Memory Map MSB MSB aw 84 al 35 al 42 LSB MSB aw 85 LSB SI LSB MSB MSB aw 86 al 36 p al 43 LSB MSB LSB E MSB al 37 p al 44 aw 90 mmm al 38 ttt al 45 LSB MSB aw 91 L LSB LSB LSB MSB MSB LSB SB MSB MSB LSB SB MSB MSB SB i MSB l aw 92 al 39 uuu al 46 LSB l MSB aw 93 l L al 40 vw al 47 L s MSB MSB aw 82 aw 96 LSB MSB al 41 LSB MSB aw 83 aw 97 LSB LSB Page 2 of 2 MSB MSB aw 98 xxx al 49 LSB MSB aw 99 LSB LSB MSB yyy al 50 LSB 358
175. cations channel 1 I O pin E and F otherwise known as the secondary serial channel Note Proper OCHN command is required prior to use of PRINT All items to be printed reside within the parentheses and are separated by commas ASCII Text strings must be within double quotation marks Variables are referenced by name and their ASCII string vales are printed Simple math expressions are allowed Raw ASCII code values are prefixed by the sign The SPACE character is 32 TAB is 9 CARRIAGE RETURN is 13 and LINE FEED is 10 PRINT1 commands pause other code execution until the last character has been transmitted No language commands whether from the host or user program are executed until the last character has been placed in the hardware transmit port What does this mean in practice To put it more simply there is a practical differ ence between PRINT1 a b c and the sequence PRINT1 a PRINT b PRINT c Executing from within a program PRINT1 a b c will output the values of a b and c without the possibility of another command from the terminal interfering Executing PRINT1 a PRINT1 b PRINT1 c from within a program while the host terminal is transmitting GOSUB5 to the motor could lead to the execution sequence GOSUB5 195 Related Command BAUD CCHN CMD DAT OCHN PRINT PRINTA PRINTH PRINT1 continued Print to Secondary Communications Port EXAMPLE OFF KP 100 Set Proportional Gain eas
176. change overrun event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE By READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0 to 1 STATE VALUE 1 Step direction overrun event occurred STATE VALUE 0 Step direction overrun event has not occurred FIRMWARE VERSIONS 4 40 only DETAILED DESCRIPTION RBy reports the state of the step and direction overrun flag By It returns a 1 if the SmartMotor detected an invalid step most likely due to an improper direction change and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT By 13 Note IEEE standard states that the Direction bit should be looked at while the stp bit is low If th direction bit transitions at the exact same time as the stp bit the By bit will be set 234 Related Command CCHN OCHN RCHNO RCHN1 RCHN Report Serial Communications Status Flags APPLICATION Report command DESCRIPTION Report serial communications status flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Logical OR of CHNO with CHN1 READ WRITE N A LANGUAGE ACCESS N A UNITS Binary states RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 to 15 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION RCHN returns the value of the historical communications function CHN The read only function CHN holds binary coded historical erro
177. coder control DESCRIPTION Reset external encoder to zero EXECUTION Immediate CONDITIONAL TO External encoder inputs available LIMITATIONS N A REPORT COMMAND RCTR READ WRITE References read only external encoder CTR LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Resets CTR to zero FIRMWARE VERSIONS All except 4 40 series DETAILED DESCRIPTION The command MF0 allows the user to zero the second encoder register see the CTR command without changing the present motion mode of the SmartMotor Following MFO a secondary encoder signal whether coming from an external source through the I O A and B pins will be continuously tracked and made available in the form of the CTR function no gearing relationship is active unless you write one yourself If the Mode Follow with Ratio MFR or the CAM Mode does not meet your require ment you can write your own loop and define a unique relationship between the incoming secondary encoder signal and the motor s position In addition it may be that you do not want there to be any such relationship to motion A common use of MFO is to take input from a quadrature output selector switch especially in the context of a user interface often including an LCD readout like the Animatics LCD2X20 and LCD4X20 If the you are running in MF MFR MC or other encoder follow modes be careful issuing MFO as the value of CTR is immediately zeroed The Smar
178. commands and or data over the RS 485 port such as might come from a light curtain or a bar code reader This is accomplished by opening the input channel in data mode with the OCHN1 command EXAMPLE C20 IF LEN1 gt 0 c GETCHR1 IF c 69 ND ENDIF ENDIF GOTO20 E j Il Place a label Check to see that LI Get character Check to see if it is an EN gt 0 from buffer T F End the program Loop back to C20 130 Related Command C number GOTO number STACK Subroutines present a great opportunity to partition and organize your code GOSUB number Subroutine Call APPLICATION Program execution control DESCRIPTION Perform subroutine beginning at C7umber EXECUTION Immediate CONDITIONAL TO C number previously defined LIMITATIONS GOSUB0 to GOSUB999 nesting msut be lt 6 levels deep REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The GOSUB number command redirects program execution to a subroutine of the program marked with a label C number The end of every subroutine is marked by the RETURN statement which causes execution to return to the line following the corresponding GOSUB number command Subroutines may call further sub routines this is called nesting There may be as many as a thousand GOSUBs but they may be nes
179. d 32 bit variables they are subject to the usual restrictions of signed digital words and values The first bit is always a sign bit They are limited to integer values between 2147483648 to 2147483647 Math operations that result in decimal values are truncated or rounded down If you assign or perform an operation that would nor mally result in a value outside of this range the variable will wrap or take on the cor responding modulo As an example because of this 2147483647 1 2147483648 The result wrapped around to the negative extreme 21 Related Commands a Z ab index aw index al index aa Zzz contined 32 Bit Variables Bit Overflow Status Bd System Status bit e f aatbb exceeds 32 signed bits the operation cc aa bb will produce a wrong result No error flag is set e f aa bb exceeds 32 signed bits the operation cc aa bb will produce a wrong result No error flag is set e f aa bb exceeds 32 signed bits the operation cc aa bb will produce a wrong result The system flag Bd will be set If one of these variables is used with a variable of another type it will be appropriately converted In technical jargon the variable will be type cast For example if a 16 bit variable like aw 4 is used all variables will be converted to 16 bit values and then operated on Assigning the variable aw 27 yy directly stories the 16 least significant bits of yy to aw 27 The higher bits of the variable yy ar
180. detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bh 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 report trajectory status about once a second RINT OVER CURRENT STATE EJ ER HEAT STATE 1 EXAMPLE WHILE Bt WAIT 4000 P RBa PRINT OV RBh RBe LOOP PRINT POSITION ERROR STATE PRINT 13 TRAJECTORY TERMINATED 13 221 Related Command Bx j RI Z APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBi Report Index Captured Status Bit Report command Report system state flag index position latched Latch updated at PID sample if index event observed N A N A Bi N A N A Binary state 0to1 Latched index encoder count reading available No new latched index position available RBi reports the value of the index available flag Bi It returns a 1 if a new index value was latched and a
181. e e Target position equals present position D 0 e Bh 1 the motor is hotter than max permitted temperature TH e AMPS 0 or too small e T 0 or too small Motor is in Torque Mode e LIMD is in effect and the wrong limit input switch is active Issued MFO or MSO instead of MFn or MS External encoder signal not present or not changing in follow modes e Motor is part of a daisy chain that hasn t been properly set up e Serial communications are good but target motor is not addressed e Serial communications at incorrect baud rate e Serial communications cable not attached or poorly connected Motor has no drive power Motor has a prior fault that needs to be cleared first PLS firmware Motor has no connections to limit switch inputs on boot up and therefor has travel limit fault PLS firmware 127 Related Command A D E MC MD MFR MP MV UG UGI UGO G continued Start Motion GO EXAMPLE A 100 Set buffered Acceleration V 10000 Set buffered Velocity P 1000 Set buffered Position MP Set buffered Position Mode G load buffered move Start Motion To servo in place P P Set buffered position equal to actual position G Servo in place The execution time for G command varies with the computational burden of the mode or on the fly move In the some cases the G command computation may take longer than expected and may result in motion profiles of poor quality or erroneous move ment This c
182. e EXECUTION Updated each PID sample CONDITIONAL TO External encoder signal available LIMITATIONS N A REPORT VALUE CTR READ WRITE N A LANGUAGE ACCESS N A UNITS Encoder counts or step pulses RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RCTR reports the signed 32 bit value of the secondary encoder counter CTR No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT CTR 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE MFO RCTR responds with 0 Now provide external encoder input change RCTR response is non zero MF4 RCTR CTR reset to zero response is 0 242 Related Command A E G P MFR MP RD Report Commanded Relative Distance Value APPLICATION Report command DESCRIPTION Report buffered relative move distance EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE D READ WRITE N A LANGUAGE ACCESS N A UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 214748364
183. e left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Br 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 228 Related Command Z Zs ZS RBs Report Syntax Error Status Bit APPLICATION Report command DESCRIPTION Report system state flag scanning error event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bs READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Command scan error has occurred since Bs reset STATE VALUE 0 Command scan error has not occurred since Bs reset FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBs reports the value of the real time right limit flag Bs It returns a 1 if an active left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bs 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the
184. e in the master encoder input from its prior value to 0 As with most stepping systems opto isolation modules are suggested when using Step and Direction to assure robust operation EXAMPLE MSO reset CTR to zero CTR value follows step and direction inputs EXAMPLE It may be useful to monitor the quantity or frequency of incoming pulses a CTR Read CTR at start WAIT 4069 Wait one second a CTR a Read the difference PRINT Rate a Pulses Sec 177 Related Command Bd CTR MF1 MF2 MF4 MFDIV MFMUL MSR Calculate Enable Mode Step Ratio APPLICATION Motion mode control DESCRIPTION Request MODE STEP WITH RATIO EXECUTION Buffered pending a G CONDITIONAL TO Ratio MFMUL MFDIV D and V LIMITATIONS Magnitude of ratio MFMUL MFDIV must be less than 256 REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES 5 lt MFMUL MFDIV lt 5 DEFAULT MODE MP FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION MSR is used to implement a fractional relationship between an incoming secondary encoder signal and the SmartMotor internal shaft position represented by the pri mary internal encoder count The fractional relationship is defined the user set ratio of MFMUL to MFDIV To use MSR you will need to define the specific relationship ratio of the external encoder input to shaft position represented by the primary internal encod
185. e lost Similarly if the left hand variable is an 8 bit one like ab 167 all variables will be converted to 8 bit values before being operated on Conversely if the left hand value is a 32 bit variable and the right hand side contains 16 bit variables the 16 bit variables will be temporarily upgraded to 32 bits In the equation cc ab 4 aw 7 both ab 4 and aw 7 are converted into 32 bit numbers before the subtraction occurs EXAMPLE Suppose the following code cc 123 assign the value of 1239 t0 ee dd 345 assign the value of 345 to da ee 599 assign the value of 599 to ee ff 346 assign the value of B46 to TEE gg 678678 assign the value of 678678 to gg The Sequential loading methode equivlent is as follows cc 123 345 599 346 678678 sequentially load data into variable cc thru gg Note The last number MUST BE followed by a period All user variables are initialized to the value of 0 at power up or upon execution of the system reset command Z Other than by direct assignment this is the only way the SmartMotor sets all of the user variables to 0 Issuing a RUN command doesn t perform this automatic initialization For this reason it is usually preferred to test a program whether it is auto execution or not by power cycling the SmartMotor or issu ing a system reset command Z 22 Related Commands a Z ab index aa zz aaa ZZZ aw index al lindex VST VLD SEE APPENDIX C
186. e next G com mand In doing so the next G will not be issued until the previous trajectory has completed Relative Moves are subject to wrap status If the next relative move causes the coun ter to exceed 2431 counts the motor will error out The following code example will allow continuous indexing without exceeding maximum count Continued on next page 93 Related Commands P A V G MP MF1 MFR The D command is also used during gearing to implement Dynamic Phase Adjust See MFR D expression continued Set Relative Distance Example Continuous Index Moves with no accumulated error or roll over O 0 reset origin A 100 Set Acceleration V 100000 Set Velocity D 20000 Set Relative distance MP Set to Position Mode WHILE 1 While Forever G Initiate Index Move TWAIT Wait until Move is Completed O 0 Reset Position to Zero LOOP loop back to repeat continuously END In the above example the motor counts will continuously increase to 20000 during each move and then be set back to zero at the end of each move There will be no accumulating error because the O expression command accounts for any following error that may be present after the trajectory has completed Phase Offset Moves using the D command While in gearing Mode Follow or Step Mode the motor will follow an external encoder or pulse and direction signal The D command allows a move within gearing to adjust
187. e the point of origin for the encoder use the syntax O expression To set a desired target posi tion use P expression EXAMPLE A 100 set buffered acceleration V 40000 set buffered velocity MV set to Mode Velocity G GO start motion trajectory WHILE P lt 5000 wait until real time position LOOP exceeds 5000 counts PRINT Position is above 5000 13 Note P follows the primary encoder used to close the loop If you issue ENC1 it will follow an external encoder Please see ENCO and ENC1 for more details 15 Related Commands E P PE Real Time Actual Position Error APPLICATION Monitor trajectory DESCRIPTION Fetch Real Time Position Error EXECUTION Next PID sample CONDITIONAL TO None LIMITATIONS Expression value REPORT COMMAND RPE READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Encoder counts RANGE OF VALUES Magnitude limited to user set value of E TYPICAL VALUES 0 to 32000 DEFAULT VALUE 1000 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Position Error is the difference in encoder counts between the desired trajectory posi tion and the measured position If the absolute value of PE exceeds the user value E the drive stage will turn off immediately setting both the Bo Motor Off and Be Position Error status bits will be set to 1 within that PID servo sample When the servo is off PE reverts to zero since there is no longer a desired position
188. ease The STEP input is enabled on the rising edge of the I O A input signal and active while the signal is high The actually motion of the step occurs on the signal falling edge In accordance with standard rules do not change the DIRECTION signal while the STEP signal is active logic high If you do you can cause that step move to go the wrong direction 175 Related Command CTR RCTR RMODE MFDIV MFMUL MSR MS continued Enable Mode Step MS will immediately turn on the servo and reset any position error The servo off Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 would immediately cause a position error upon any encoder pulse being received from the external encoder The motion is also subject to the currently defined activity of the limit switches As with most stepping systems opto isolation modules are suggested when using Step and Direction to assure robust operation EXAMPLE 1 IMMEDIATE MODE STEP 1 1 MS Reset CTR and step and direction mode Motor will immediately start following pulses at 1 1 RMODE RESPONSE 15 Ss WAIT 100000 Follow for a while MP Revert to position mode P 0 Set destination for home A 100 Set acceleration V 50000 Set velocity G Terminate following start position move RMODE RESPONSE is P EXAMPLE 2 BUFFERED MODE STEP WITH RATIO OF 1
189. eat value TH PRINT 13 Read Bh overheat flag Bh RETURN 289 Related Command Bh RBh TEMP TH THD Set Overheat Delay Timer APPLICATION Temperature control DESCRIPTION Set overheat delay time EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS NA UNITS PID samples RANGE OF VALUES 0 to 65536 TYPICAL VALUES 12000 DEFAULT VALUE 12000 samples approximately 3 seconds FIRMWARE VERSIONS 4 11 and higher DETAILED DESCRIPTION The THD command permits the user to set to set the time for which the overheat condition may exist before the servo is shut off THD 16000 means that the SmartMotor will allows an overheat condition for 16000 servo samples or approximately 4 seconds before shutting down The maximum value for THD is 20000 in 4 4x series firmware and 64000 in all others One Servo Sample is 250useconds If an overheat condition exists for more than THD samples the amplifier will turn off Bh will be set to 1 the motor off bit Bo set to 1 and the trajectory bit cleared to 0 If issued RMODE will return O The SmartMotor will reject any command to start motion until the temperature has fallen 5 Celsius EXAMPLE test to measure approximate shut down time not very accurate but illustrates TH THD and TEMP PRINT 13 Default value of TH TH PRINT 13 Motor Temperature TEMP PRINT 13 START M
190. ected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bf 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE c10 IF CHNO PRINT PRINT PRINT PRINT ENDIF RETURN communication status check subroutine check both serial channels simultaneously return immediately if no error found PARITY ERROR STATE RBO BUFFER OVERFLOW STATE RBE FRAMING ERROR STATE RBE SYNTAX ERROR STATE RBs 220 Related Command TEMP TH THD APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 RBh Report Over Heat RMS Over Current Status Bit Report command Report real time system state motor overheat condition Updated each PID sample N A N A Bh N A N A Binary state 0to1 Motor in overheat condition Motor not is overheat condition FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBh reports the value of the overheat flag Bh It returns a 1 if an overheat was
191. eleration w 32552 use to set Wait time PIDI Default PID updates every servo sample WAIT w Wait time 8 seconds V v Velocity 2400 RPM A a Acceleration 400 RPS 2 PED PID updates every 2 servo samples WAIT w Wait time 4 seconds V v Velocity 1200 RPM A a Acceleration 200 RPS 2 PID4 PID updates every 4 servo samples WAIT w Wait time 2 seconds V Vv Velocity 600 RPM A a Acceleration 100 RPS 2 PID8 PID updates every 8 servo samples WAIT w Wait time 1 second V Vv Velocity 300 RPM A a Acceleration 50 RPS 2 1 PID1 Return to Default PID WAIT w Wait time 8 seconds END As can be seen above although the values used for Velocity Acceleration and Wait times remained the same their effect was changed by a factor for the PID setting As a result much care should be taken if changes are made in the middle of a program The PID parameter can be changed from PID1 to PID8 while the motor is sitting still to increase I O scanning efficiency or other code execution and then returned to PID1 just prior to the next move This is a technique used to increase response time for input triggers or mathematical calculations while there is no trajectory in progress 192 Related Command BAUD CCHN CMD DAT F 4 OHCN PRINT1 PRINTA PRINTH WARNING DO NOT USE A COMMENT MARKER WITHIN PRINT IT WILL CAUSE A COMPILER ERROR PRINT Print to Primary Communications Port APPLICATI
192. elf to use GOSUBs for program control You ll be glad you did EXAMPLE download the following program co Place main label if YAT PRINT Input A Low 13 ENDIF GOTOO GOTO allows program to run forever END 133 Related Commands Bi Bx RBi RBx I capital i Encoder Index Pulse Location APPLICATION Hardware Index Capture DESCRIPTION Encoder value latched by hardware index capture EXECUTION Immediate CONDITIONAL TO Index previously captured LIMITATIONS High velocity at time of capture will create a systematic offset error REPORT COMMAND RI READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION I capital i is the function that stores the last hardware latched encoder index posi tion It can be read from a host with the RI command or it can be read by the program with a line such as a l Only after it is read by either of these means will the SmartMotor be looking for the next Index event The host or the program can monitor for the event by reading the flag Bi Bi will read as zero until an index is latched at which time Bi will be set to one Bi is set to zero when the index position is read or accessed The commands RI and PRINT I 13 report the captured index value through the p
193. ent until both UGO and UG 0 have been issued Just issue UGO once the I O pin stays configured until another configuration specification is issued When you open channel 0 as an RS485 port dedicates I O G to the RS485 control function which is required for use with Animatics RS232 to RS485 converters like the RS485 and RS485 ISO When using one of these adapters you must ensure that the I O G pin is configured as a TTL output with the UGO command before the channel is opened EXAMPLE UGO define PIN G output UG 1 set output latch value PRINT UGO recall the latch value response is 1 UG 0 set output latch value PRINT UGO recall the latch value response is 0 329 Related Command UPLOAD WARNING Do not use the UP command within a user program It will terminate the program UP Complied User Program and Header Upload APPLICATION User program verification DESCRIPTION Upload user EEPROM through serial communications EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS ASCII Characters RANGE OF VALUES Alpha numeric TYPICAL VALUES Alpha numeric DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The UP command will cause the SmartMotor compiled user program runtime code to be sent out the primary serial port In contrast the UPLOAD command returns the user program in readable text The out
194. er count The command MSR must be issued after both MFMUL and MFDIV have been speci fied Both MFMUL and MFDIV may be positive or negative use this fact to control the resulting direction of shaft motion Overly large ratio gains are flagged by the firmware setting the system flag Bd and may be unstable The error flag Bd will be set by MFR if the magnitude of MFMUL MFDIV is 256 or greater MFR does NOT reset Bd if already set by a prior procedure MSR followed by G will immediately turn on the servo and reset any position error The servo off Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 would immediately cause a position error upon a single count of output motion being required The motion is also subject to the currently defined activity of the limit switches The fractional ratio is accurate to 23 binary places this means that if the external encoder displacement during the motion exceeds 256 256 64 or 4 000 000 counts the G command should be reissued Within this limitation the calculated requested trajectory position is to within one count of mathematical precision In some applications it may be necessary to introduce a phase shift to achieve prbvS Related Command Bd CTR MF1 MF2 MF4 MFDIV MFMUL MSR continued Calculate Enable Mode Step Ratio alignment during MFR following To perform this shift param
195. er the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UBA function In order for the output voltage to reflect the state of UB both UBO and UB value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UBO and UB 0 have been issued You only have to issue UBO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE UBO define PIN B output UB 1 set output latch value PRINT UBO recall the latch value response is 1 UB 0 set output latch value PRINT UBO recall the latch value response is 0 301 Related Command UCA UCI UCO UC expression Set I O Port C Output Logic State APPLICATION I O control DESCRIPTION Set Pin C output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0 or1 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line C can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN C as an output set the value of the pin C output latch UC to either 0 or 1 Issue the command UCO if this has not already been issued I O pin C will be a logic high v
196. erform an operation that would normally result in a value outside of this range the variable will wrap or take on the corresponding modulo As an example because of this 2147483647 1 2147483648 The result wrapped around to the negative extreme Bit Overflow Status Bd System Status bit e If al 1 a exceeds 32 signed bits the operation c al 1 a will produce a wrong result No error flag is set e lf a al 1 exceeds 32 signed bits the operation c a al 1 will produce a wrong result No error flag is set e f a al 1 exceeds 32 signed bits the operation c a al 1 will produce a wrong result The system flag Bd will be set If one of these variables is used with a variable of another type it will be appropriately converted the variable will be type cast EXAMPLE In the equation where the variable on the left of the equal sign is a 16 bit one like aw 4 all variables will be converted to 16 bit values and then operated on Assign ing the variable aw 27 al m directly stores the 16 least significant bits of al m into aw 27 The higher bits of the variable al m are lost Similarly if the left variable is an 8 bit one like ab 167 all variables will be converted to 8 bit values before being operated on Conversely if the left value is a 32 bit variable and the right side contains both 8 and 16 bit variables both 8 and 16 bit variables will be temporarily upgraded to 32 bits In the equation al 3 ab 4 aw 7 both
197. ering Executing PRINTA a PRINTA b PRINTA c from within a program while the host terminal is transmitting GOSUB5 to the motor could lead to the execution sequence GOSUB5 PRINT a PRINTA b PRINTA c or PRINTA a GOSUB5 PRINTA b PRINTA c etc depending upon the exact timing The resulting output may or may not be the identical 197 Related Command BAUD CCHN CMD DAT OCHN PRINT PRINT1 PRINTA PRINTH continued Print to External LCD Display In SMI the character is a comment delimiter As such if you puta inside of the PRINT statement the SMI debugger will think that are commenting out the rest of the PRINT statement and flag it as an error The SmartMotor however doesn t use comments and will transmit the as a character The easiest thing to do is simply not use within a print string PLEASE CONSULT MANUAL FOR LCD DISPLAY PRODUCTS FOR MORE ON THE FOLLOWING EXAMPLE EXAMPLE printing output to an AniLink LCD with port address A PRINTA 56 14 6 1 56 initialize LCD 14 turns on cursor 6 sets cursor direction 1 clears LCD and resets position to first character of first line PRINTA 128 I AM LCD ADDRESS A Print stating from character block 128 far left character of first line PRINTA 192 2nd TEXT LINE Print starting from character block 192 far left character of second line of LCD PRINTA 148 3rd TEXT
198. erred to test a program whether it is auto execution or not by power cycling the SmartMotor or issuing a system reset command Z The aa through zz and aaa through zzz variables share the same physical memory as part of the ab aw and al arrays That is if you set aaa 123456 you will find that al 0 has the same value regardless of what you set it to before Similarly the values of ab 0 through ab 3 and aw 0 and aw 1 will have values that correspond to the individual 8 bit bytes and 16 bit words that are part of aa 28 Related Commands a z aa zz aaa ZZZ alfindex ab index VST VLD APPENDIX C Page uses tables to describe the relationship between user assigned variables aa thru zzz and variable arrays abf al and aw aw index 16 bit Array Variables APPLICATION General purpose data DESCRIPTION User signed 16 bit data variables EXECUTION Immediate CONDITIONAL TO Index values 0 to 101 LIMITATIONS This data space is shared with variables aa zz aaa zzz arrays ab and al and coordinated motion see MD REPORT COMMAND Raw index READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Signed 16 bit number RANGE OF VALUES 32768 to 32767 TYPICAL VALUES 32768 to 32767 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor has 8 16 and 32 bit arrays The 16 bit array takes the fo
199. etermines the acceleration that will be used by subse quent position or velocity moves to calculate the required trajectory Changing A dur ing a move will not alter the current trajectory unless a new G command is issued To set acceleration take the desired acceleration in Rev S multiply it by 7 91 for 500 line encoder motors and 15 82 for 1000 line encoder motors Then set A equal to it the integer portion Acceleration is pre scaled by 65 536 256 256 and may range from 0 to 2 147 483 648 the default value is zero A is buffered by G It should also be understood that since A is bit shifted once to the right by the extended PID filter loop odd values for A will be reduced by 1 in operation An A 1 command will have the same effect as A 0 you won t go anywhere Equations for Real world Units Acceleration Encoder Counts Sec A xk Acceleration RPS A x k Encoder Resolution Acceleration RPM A x k Encoder Resolution x 60 Where Encoder Resolution Encoder Counts per Revolution and k 252 63236 for all standard SmartMotors lt v4 95 32 A expression continued Related Commands EXAMPLE D MP Set Mode Position E A 5000 Set Acceleration G P 20000 Set Absolute Position p V 100000 Set Velocity A MV G Start Motion PIDn EXAMPLE A 100 set buffered acceleration P V 750 set buffered velocity V MV set buffered velocity mode X G Scart Motion F 1 33 Related Commands SADDR ADD
200. eters D and V are employed to superimpose the corrective phase During a phase shift RD will report the remaining phase difference As with most stepping systems opto isolation modules are suggested when using Step and Direction to assure robust operation EXAMPLE zd reset Bd system flag MFDIV 10 Numerator 21 MFMUL 21 Numerator 21 MSR Calculate Ratio input 21 external counts resulting motion 10 counts D 0 No phase shift IF Bd GOTOS ENDIF gain too large G Start Following Implementing Phase Adjust D 500 Set Relative Distance V 5000 Set Relative Velocity G Start Phase Adjust RMODE RESPONSE is X c5 END 179 Related Command T exp MT Enable Torque Mode APPLICATION Motion mode control DESCRIPTION Request MODE TORQUE EXECUTION Immediate CONDITIONAL TO 1023 lt T lt 1023 LIMITATIONS None REPORT COMMAND RMODE RT READ WRITE N A LANGUAGE ACCESS NA UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS ALL DETAILED DESCRIPTION MT enables torque mode In this mode the motor is commanded to develop a spe cific power level set by T expression T is in units of tenths of percent of the full capacity of the subject motor T 1023 results 100 PWM full torque in the positive direction T 1023 results 100 PWM full torque in the negative direction The encoder still tracks position and can still be read with the P variable
201. f sent from a PLC or PC the same space character can be used as an string terminating character When assigning values to sequential variables use between assigned value and ter minate sequence with an immediately following period The space character can also be used in PRINT command strings in like manner EXAMPLE as Delimiter for variable initialization n72 8 56 Note spaces and period equivalent n 7 o 2 p 8 q 56 t 6 aw t 63 44 98 Note spaces and period equivalent aw 6 63 aw 7 44 aw 8 98 EXAMPLE as Delimiter and Null Terminator in PRINT command PRINT a 1 b 2 note space after b 2 as null terminator equivalent PRINT a 1 b 2 13 note carriage return as null terminator Note When sending commands via serial port from a PC or PLC or other controller a space character can be used as both a delimiter and a string terminator It can be used equally and interchangeably with a carriage return as a string terminator 12 Related Commands P V A APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE Direct Binary Mode Control Binary Trajectory Data Format Direct Mode Position Velocity and Acceleration Data Binary Packet Data Immediate Appropriate terminal N A N A N A Serial communications channel data Function byte 32 bit binary packet 0x80000000
202. fered target acceleration to 100 and Go A 100 G OxFC 0x00 0x00 0x00 0x64 0x47 0x20 Keep in mind Proper Mode commands must be set up prior to binary command strings in order to get predictable results If Velocity Mode Is required then first send MV followed by the associated binary commands This would then allow for fast changes in speed once in velocity mode 14 Related Commands P RP PE V ENCO ENC1 P Real Time Actual Position APPLICATION Monitor trajectory DESCRIPTION Fetch Real Time Encoder Position EXECUTION Next PID sample CONDITIONAL TO N A LIMITATIONS Expression value REPORT COMMAND RP READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES N A DEFAULT VALUE 0 at power reset FIRMWARE VERSIONS ALL DETAILED DESCRIPTION P is used to access the value of the primary encoder This number may be called the current position or actual position If the motor shaft moves the value of P will be changed by the net number of encoder counts occurring during this shaft motion The primary encoder is tracked at all times and is independent of the mode of opera tion of the SmartMotor or any error condition PRINT P and RP would transmit an identical value if It were possible to execute both commands at the same time P cannot be used to store a new value to a given shaft position to chang
203. for pre 4 00 firmware REPORT VALUE aa READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Raa reports the signed value of the variable aa to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT com mand is PRINT aa 13 Use similar PRINT commands for Rbb Rec through Rxx Ryy Rzz In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Raa is received through channel 0 the response is sent through channel 0 If Raa is received through channel 1 the response goes out channel 1 In SmartMotors so equipped if F 4 has been commanded this report is redirected to serial channel 1 and the reported value is not be seen output the primary or cur rently active serial channel Following F 4 the equivalent to Raa is PRINT1 aa 13 F 0 resets report commands to again be sent out the primary or currently active serial port 202 Related Command N A Raa Rzz continued Report 32 Bit Variable Data Value EXAMPLE F use HOST channel PRINT 13 F 0 GOSUB5 F 4 redirect report output PRINT 13 F 4 GOSU
204. g IF expression LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Each control block commencing with IF expression must have a corresponding ENDIF block exit statement The program statement following ENDIF is the common exit point branched to upon processing the IF ENDIF control block regardless of the execution path thought the control block at run time There can only be one ENDIF statement for each IF statement The common exit point following ENDIF is branched to upon the following 1 Processing a true IF expression clause and encountering ELSEIF ELSE or ENDIF 2 Processing a true ELSEIF expression and encountering another ELSEIF ELSE or ENDIF 3 Processing an ELSE expression and encountering ENDIF 4 If all IF and ELSIF expressions are false and there no ELSE clause ENDIF is not a valid terminal command it is only valid within a user program EXAMPLE IF a PRINT ok 13 ENDIF PRINT EXIT 13 115 Related Command CASE number DEFAULT SWITCH exp ENDS End SWITCH Statement SWITCH expression ENDS control block a corresponding SWITCH expression APPLICATION Program execution control DESCRIPTION terminator EXECUTION N A CONDITIONAL TO LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS
205. g MC and G commands CONDITIONAL TO N A LIMITATIONS SIZE lt BASE REPORT COMMAND None READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Encoder counts RANGE OF VALUES 0 to 32767 TYPICAL VALUES 0 to 100 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor performs a practical cam application by partitioning the required cam trajectory definition into a number of linearly interpolated segments The vari able SIZE stores the number of segments The segments are required to partition the BASE into a set of equally spaced intervals For example if BASE 1000 and SIZE 50 each segment will then be 20 counts wide BASE SIZE The cam motion is then defined by providing the required SmartMotor positions corresponding to CTR 0 20 40 60 940 960 980 and 1000 If the motion is truly periodic the required position at CTR 0 will be identical to the required position at CTR 1000 The set of required positions are to be entered into the aw array beginning at aw 0 and ending with aw SIZE It is simplest to define the cam using position at CTR 0 to be encoder position 0 by issuing MFO and O 0 commands 276 Related Command BASE G MC SIZE expression continued Set Number of CAM Table Data Point EXAMPLE A saw tooth cam with periodic motion every 2000 external encoder counts and the motion interpolation divided into 25 equal segments CAM Profile
206. g inadequate or excessive resistance friction to motion is occurring In this event please check your overall motion system The overheat temperature limit is adjustable by the user by the TH command but cannot exceed 70 Celsius optional 85 The amount of time that the temperature is allowed to stay at or above this temperature is set by the THD function If the temperature stays at or above the TH value for longer than THD servo samples the amplifier will turn off Bh will be set to 1 the motor off bit Bo set to 1 and the trajectory bit is cleared to 0 ALL at the same time If issued RMODE will return O meaning the drive stage is off The SmartMotor will reject any command to start motion until the temperature has fallen 5 Celsius below the trip point Note If power is removed and restored and temperature is lt 5 degrees below the set point the motor will be allowed to move This however can lead to damage if it is done repeatedly 45 Related Commands TEMP TH THD OFF RW RPW Bh continued Overheat RMS Over Current Status Bit The RMS current monitor continuously calculates the equivalent Root Mean Square current of the amplifier If the RMS current is too high for longer than THD servo samples the amplifier will turn off Bh will be set to 1 the motor off bit Bo set to 1 and the trajectory bit cleared to 0 ALL at the same time If issued RMODE will return O The SmartMotor will reject any motion c
207. generator I O serial communications ports and uses position error to perform the PID calculation to control the servo drive stage The user program code if any is executed at any time the microprocessor is not involved in these activities The WAIT command is controlled by the system CLK clock The PID value changes the reported values to CLK and the effects of WAIT as well Both Velocity and Acceleration are impacted the same way the WAIt command is The values of 1 2 4 and 8 mean the PID filter will react upon and update on position error to correct dive power every 1 2 4 or 8 PID samples This does not change how code is executed but does change how much time is given to that execution As a result a program run at PID8 will typically run faster than a program run at PID1 However since the frequency of PID updates to the drive stage are changed and samples of position error are done at different intervals PID8 will result in a more course or abrasive motion than PID1 Special care should be taken when using the PID command due to this fact Improper usage could result in very sporadic motion The next page show a comparison of the different PID values 191 Related Command A V WAIT CLK PID Continued P I D Tuning Filter Control EXAMPLE For a 2000 count encoder SmartMotor Using three fixed values under each of the PID settings v 128504 use to Set commanded Velocity a 3167 use to Set commanded Acc
208. gram The AMPS function essentially cuts the torque speed characteristic of the motor by slicing off the part of the curve to the right of the AMPS line Note that there are some values of AMPS that will limit top speed but not peak torque The slope of the line is highly depen dent on the voltage of the power source AMPS is often used to limited torque and speed AMPS has no effect in torque mode MT T In this mode the value of T controls the commanded torque of the motor without limitation by AMPS AMPS 600 0 10 20 30 40 50 60 70 Percent 80 90 100 36 Related Commands AIN DIN DOUT AOUT address value Analog Output to I O Device APPLICATION Output command use with Anilink device DESCRIPTION Output analog byte to Anilink peripheral port EXECUTION Immediate AniLink byte write CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND None READ WRITE Write only LANGUAGE ACCESS _ Unlatched output value to recall create shadow variable UNITS Numerical value RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION When using an optional AniLink Analog I O Card such as AlO 100 or AlO 110 an 8 bit 0 255 output voltage can be specified Adjustments on the card allow the user to set the upper and lower limits and therefore the range anywhere between zero and Full scale output voltage The examples assume the
209. h the command UGI EXAMPLE UGI Initialize U ser defined I O pin G as I nput PRINT 13 PIN G Input UGI n UGI Store state of I O pin G as digital input into variable name n PRINT 13 REPORT PIN G Input Rn END RUG Directly Report Port G logic State gt 4 76 firmware only n U 64 Bitmask Port G to the variable n gt 4 76 firmware only Rn Report Result 328 Related Command UG UGA UGI RS4 UGO as command Set I O Port G to Output APPLICATION I O control DESCRIPTION Set Pin G to be an output EXECUTION Immediate CONDITIONAL TO UG 0 or UG 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Although its default function is the hardware go line user I O line G can function as a TTL output The command UGO specifies the I O pin G as an output while UG value sets the voltage I O pin G will be a logic high voltage if UG 1 and a logic low voltage if UG 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of the I O pin is always available through the UGA function In order for the output voltage to reflect the state of UG both UGO and UG value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink curr
210. he last character has been transmitted No language commands whether from the host or user program are executed until the last character has been placed in the hardware transmit port What does this mean in practice To put it more simply there is a practical difference between PRINT a b c and the sequence PRINT a PRINT b PRINT c Executing from within a program PRINT a b c will output the values of a b and c without the possibility of another command from the terminal interfering Executing PRINT a PRINT b PRINT c from within a program while the host terminal is transmitting GOSUB5 to the motor could lead to the execution sequence GOSUB5 193 Related Command BAUD CCHN CMD DAT F 4 OHCN PRINT1 PRINTA PRINTH EXAMPLE OFF P 100 v 100000 a 100 p 2000 WAIT 10 PRINT 130 MP P p 2000 WAIT 10 END PRINT continued Print to Primary Communications Port Set Proportional Gain Allow time tell TELL reri SWS dd K 0 1234 Set origin to 1234 a 1 b 2 PRINT Demonstration 13 PRINT a a PRINT and b b 13 PRINT at tb a b 13 PRINT Position P 13 WAIT 10 PRINT KP KP 13 PRINT Hello World 13 13 PRINT Run Subroutines 13 WAIT 10 PRINT 128 GOSUB5 13 WAIT 10 PRINT 129 GOSUB10 13 WAIT 10 PRINT 130 GOSUB20 13 WAIT 10 PRINT 131 GOSUB30 13
211. hen ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release If an External Brake is used instead of the optional internal brake the BRKC com mand allows automatic and interrupt driven control of the external brake via I O port pin C BRKC is a re direction of the same signal that would otherwise control an internal brake As a result Port C will follow the state of the internal brake pin Port C will be active low zero volts when ever the brake should be engaged and at 5VDC when ever the brake should be disengaged The logic state follows the present Brake control method chosen See BRKSRV BRKTRJ BRKENG and BRKRLS for more Example UCO Assign Port C to be used as an output pin BREC re direct brake control to port C pin BRKRLS t will set port C to OVDC BRKENG will set port C to 5VDC 66 Related Commands BRKRLS BRKSRV BRKTRJ BRKC BRKG BRKI It is important to turn the servo off when the brake is engaged or the motor could be driving against the brake and overheat When the SmartMotor powers up or comes out of a soft reset the brake control is set to BRKSRV by default to automatically enforce this safety rule BRKENG Brake Engage APPLICATION Hardware brake control DESCRIPTION Engages hardware brake immediately EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO Hardware BRAKE required LIMITATIONS None REPO
212. hen in Sleep Mode a SmartMotor will continue to echo if in ECHO1 mode all characters received over the network but will ignore all commands other than a WAKE1 command A sleeping SmartMotor will also ignore a G line input go request but will be responsive to other input s dedicated functions The most common use of the SLEEP1 command is to keep SmartMotors in a daisy chain from responding to commands imbedded in a program which is being downloaded to another SmartMotor in the same chain If a program is running when a SmartMotor receives the SLEEP1 command the program will continue to run Messages originating from within the running program of a sleeping SmartMotor will be transmitted unless the motor is also in SILENT1 mode SLEEP1 may be issued from the terminal or within a user program SLEEP1 mode is terminated by the WAKE1 command 279 Related Command END GOSUB RUN RUN Are there any WHILE statements in version 4 00 STACK Clear Stack Pointer Register APPLICATION Program execution control DESCRIPTION Reset user program subroutine return stack EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Prior to version 4 00 a total of 6 WHILE and GOSUB statements are permitted at one time Version 4 00 supports up to 6 GOSUB statements at one time REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Return STACK empty
213. higher DETAILED DESCRIPTION F value sets various functions or operational conditions of the motor The value is Bit weighted meaning that each binary bit is a on or off state for that particular function As a result it is also bit additive meaning that to turn on or off any selected function the appropriate bits must be set to 1 or 0 F is not assignable or readable If you wish to rack it s value a shadow variable may be used Example x 2 F x x 2 amp 8 X This allows you to keep track of the functions that are enabled or disabled via the F command The following page covers a description of each function 123 Related Command None F 1 F 2 F F 8 F 16 F 32 F 64 F 128 F 256 F 512 F 1024 F expression continued Motor Function Control Decelerate to stop on limit switch input as opposed to just turning off Invert Commutation Changes Shaft rotation Any Report commands transmit to Com 1 only Use with Extreme Caution Clear PID integral term at trajectory end to avoid possible slow settling Mode Cam positions are relative for each re entry into CAM table from either direction GOSUB1 is issued under motor fault condition C1 can not be called again prior to receiving a RETURNF GOSUB2 is issued on user input G transition from high to low C2 can not be called again prior to receiving a RETURNI Internal Slave Counter base dwell modulo while in CAM Mode Set
214. ht velocity you are likely in position error Similarly if you observe the position error is not changing see PE the present reported velocity is the exact velocity Equations for Real world Units Velocity Encoder Counts Sec V xk Velocity RPS V x k Encoder Resolution Velocity RPM V x k Encoder Resolution x 60 Where Encoder Resolution Encoder Counts per Revolution and k 0 0620876 for all standard SmartMotors lt v4 95 When in Position or Velocity Mode MP or MV the actual velocity is enforced by the PID feedback control to match the desired velocity computed by the trajectory generator If the position error see PE is exactly constant the actual velocity will exactly match the desired velocity over time that is macroscopically with respect to time Continued on following page 17 Related Commands v MV RV P PE PIDn V continued Present Trajectory Velocity While Accelerating the position error may increase as a result of the physical veloc ity being less than the trajectory velocity During the constant velocity slew phase if position error were constant physical velocity would equal the trajectory velocity on average Looking at time microscopically within one PID sample the limit of encoder measure ment is one encoder count a velocity granularity of 65536 scaled counts per sample This is in contrast to the macroscopic velocity which has a granularity of one sca
215. i Loop Forever a UAA 512 2 5V 0 Torque 1 T 2 a GOTO1 END The above example will track an incoming analog signal from 0 to 5 Volts UAA 0 to 1023 Note Do not attempt to regulate speed with Torque Mode It is not designed for that and will give poor results In like manner it is difficult at best to attempt to place a speed limit on Torque mode If the load decreases the motor shaft speed will increase to a new equilibrium with th lighter load because Power must remain the same 181 Related Command CTR D G MF1 MF2 MF4 MFDIV MFMUL MT MTB Enable Mode Torque Brake APPLICATION Motion mode control DESCRIPTION Dynamically brakes the motor EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE N A FIRMWARE VERSIONS gt 4 76 DETAILED DESCRIPTION MTB places the SmartMotor into dynamic brake mode In this mode the motor coils are shorted together Any motion of the shaft would normally produce Back EMF somewhat proportional to speed Bt having the windings shorted out causes this Back EMF to be dissipated immediately he result is a magnetic damping counter force to any attempted motion of the shaft for an external source IF MTB is issued while moving at a given speed the shaft will come to a gradual stop at a rate proportional to the Back EMF that was be
216. ications Parity Error Status Bit Related Command APPLICATION Report command RCHN DESCRIPTION Report system state flag communication parity RCHNO error latched RCHN1 EXECUTION Immediate Zb CONDITIONAL TO N A Z LIMITATIONS N A zS REPORT VALUE Bb READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Parity error event has occurred STATE VALUE 0 Parity error event has not occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBb reports the value of the communications parity error flag Bb It returns a 1 if any parity error has been detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bb 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response is transmitted through Note channel 1 A syntax error from the terminal causes EXAMPLE RCHN to respond c10 communication status check subroutine with value 4 but check both serial channel simultaneously the value CHNO or IF CHNO return immediately if no errors found CHN1 assigned to PRINT PARITY ERROR STATE RBO an expression is still PRINT BUFFER OV
217. ied whenever the motor off bit Bo is 1 BRKSRV terminates the brake control modes BRKENG BRKTRJ and BRKRLS BRKSRV set brake mode assuming it is safe MP set buffered mode A 100 set buffered acceleration V 100000 set buffered maximum velocity P 1000 set target G servo on brake release go to target 71 Related Commands BRKENG BRKRLS BRKSRV BRKC BRKG BRKI BRKTRJ Brake Engage With No Active Trajectory APPLICATION Hardware brake control DESCRIPTION Release hardware brake while a trajectory is in progress Engage brake turn off servo while no trajectory is in progress EXECUTION Immediate and effective until otherwise commanded CONDITIONAL TO Hardware BRAKE required LIMITATIONS None REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Power On BRKSRV Power Off brake engaged FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engag es The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release BRKTRJ automatically coordinates movement and brake application When a trajec tory is started by a G command the brake is
218. ies or parallel serial communication I O lines In order to automatically detect and differentiate between multiple motors on a serial daisy chain cable the ECHO state can be alternately turned on and off to insure addressing is done properly Note It is not possible to maintain communications on a serial chain without issuing ECHO 105 Related Commands ECHO ECHO_OFF ECHO_OFF1 ECHO1 Echo Incoming RS 485 Data APPLICATION Serial communications control DESCRIPTION Motor echoes received channel 1 serial EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE ECHO1 is off FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The ECHO1 command causes the SmartMotor to re transmit or echo out all serial bytes on the transmit line that were received on the receive line of the secondary comm port This retransmission occurs when the SmartMotor reads these bytes from the buffer regardless of whether these bytes are command or individual data bytes ECHO_OFF1 terminates the echo facility It is important to note that the channel 1 serial port is half duplex RS485 It cannot simultaneously send and receive Thus when used directly as RS 485 the ECHO1 command is not recommended 106 ECHO OFF1 Turn RS 485 Echo Off Related APPLICATION Serial communications control Commands DESCRIPTION
219. ignment expressions and conditional testing UNITS N A RANGE OF VALUES 0 to 32767 TYPICAL VALUES 5 to 200 DEFAULT VALUE Motor size dependent FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The KL term sets a limit on the effects of the KI term Since the KI integrates the position error over time it can ultimately dominate the PID equation KL sets an upper limit on what the KI term can be Physically speaking the KI term will raise the power to the servo as a function of time If there is something other than friction blocking the servo and it is unable to move the amount of torque given to the motor over time can quickly become unreasonably large It is therefor a good idea to keep KL as low as possible while still allowing the KI term to effectively contend with friction The F command must be issued for a new buffered KL parameter to take effect PRINT KL 13 and RKL both report the value of KL through the primary serial port while PRINT1 KL 13 sends it out channel 1 KL is valid with any expression and can be treated as if it were any read write variable The motion and servo character istics are unaffected until KL is applied by the F function EXAMPLE KL 1500 Set buffered integral limit E Update Filter 143 Related Command KA KD KG KI KL KS KV KP expression PID Proportional Compensation APPLICATION PID filter control DESCRIPTION Proportional gain EXECUTION Buffered pending an F command C
220. imit switch control DESCRIPTION Limit switches non directional EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT PROPERTY Limit switches are non directional FIRMWARE VERSIONS 4 15 and 4 40 not available in PLS firmware DETAILED DESCRIPTION LIMN Limit NON Directional specifies the way the SmartMotor responds to a G command while any limit input is active LIMN means that if you are on a limit switch if it is active at the time The motor will still be allowed to move in the same direction upon receiving another G go com mand Basic Effects of LIMN are as follows If the Positive Limit is active and the motor is commanded in the positive direction it will still be able to move If the negative limit is active and the motor is commanded in the negative direction it will still be able to move Note LIMN behavior is applicable to all modes of operation 152 Related Command LOCKP LOCKPROM RCKS RUN RUN UP UPLOAD This command is intended to be used in custom terminal software LOAD Download Compiled User Program to Motor APPLICATION User program EEPROM control DESCRIPTION Receive and store SmartMotor executable program EXECUTION Immediate CONDITIONAL TO User program EEPROM present LIMITATIONS EPPROM capacity is limited to 8k 16k or 32k REPORT COMMAN
221. ince Port A has a 5K pull up resistor if MD50 is initiated with no connection to Port A the motor will immediately be commanded to full positive PWM In operation MD50 is similar to Mode Torque there is no trajectory calculation so there is no position error associated with the resultant motion Flags Bo Bt and Be will all be zero Motion is not affected by the E value A motor in MD50 mode responds to RMODE with W MD50 motion is conditional to limit switch input activity see LIMD LIMN LIMH and LIML and MD50 can be terminated with OFF S and X MD50 like MT is immediate and if the signal input at PIN A is a logical high or low then full output will be requested instantly If you assign Port A as an output then set Port A to logic 1 or zero via UA 1 or UA 0 respectively the motor will be commanded to full PWM in either positive or negative direction respectively MD50 performs an analog read on the I O A pin signal every PID sample A to D conversions are one of the most lengthy processes so you may wish to use the PID2 command if you are also running a user program that takes additional analog readings MD50 is closely tied to MT When invoked any prior value in the T parameter gets over written To change from MD50 to MT be sure to first issue OFF and then T value before issuing the MT command 163 Related Command RCTR CTR MF1 MF2 MF4 MFO Enable Quadrature Input Counter Mode APPLICATION External en
222. index 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Ral 23 is received through channel O the response is sent through channel 0 If Ral 23 is received through channel 1 the response goes out channel 1 The valid range for the value of index is 0 to 50 Index may be expressed directly as a number a variable a z the sum of twoa z variables or difference of two a Z Variables See Example 1 for clarification the example illustrates ALL legal index formats thus Rab 6 Rab t 6 and Rab g do not represent valid index references If you attempt to use a legal valid syntax but the actual index value is out of range system state flag Bs set to 1 and a syntax error message may be reported See Examples 2 and 3 The al 0 to al 50 variables represent signed 32 bit values assignment of larger values is handled by truncating any extra leading data bits The most significant bit is always considered to be a sign bit 208 Related Command N A Ral index continued Report 32 Bit Array Data Value EXAMPLE 1 a 0 assign test values WHILE a lt 6 al a a a a 1 LOOP p 2 q 3 u 1 v 5 PRINT al 0 Ral 0 report al 0 PRINT al 1 Ral 1 report al 1 PRINT al 2 Ral p report al 2 PRINT al 3 Ral q report al 3 PRINT al 4 Ral v
223. ing generated at the time of issu ing the MTB command The shaft doesn t stop at any predetermined or commanded position and its trajectory is uncontrolled While in MTB the motor will not produce any external DC bus voltage rise if the shaft is rotated because all windings are shorted back to themselves As a result the DC bus is protected against bus over voltage to within the drive stage current limits MTB is the default mode of operation for all motors with gt 4 765 firmware MTB is automatically issued any time the motor faults on over temp position errors or travel limit crash The only mean to prevent this automatic action is to issue BRKRLS and OFF in that sequence To Re enable the automatic MTB function issue BRKSRV brake Servo 182 Related Command A D E G MV P V PID loop MV Enable Velocity Mode APPLICATION Motion mode control DESCRIPTION Request MODE VELOCITY EXECUTION Buffered pending a G CONDITIONAL TO A D E G P V PID loop LIMITATIONS Motor power sufficient to deliver Acceleration A and Velocity V REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The MV command enables velocity mode In velocity mode the value of V the tar get velocity can be negative or positive In contrast position mode only uses the magnitude of the velocity pa
224. ing the AniLink data line it can be explicitly set up as a digital input with the UEI command If I O line E has been set to an output with the command UEO it can be reset to be an input with the command UEI EXAMPLE UEI Tnitializ U ser defined I O pin E as I nput PRINT 13 PIN E Input UET n UEI Store state of I O pin E as digital input into variable name n PRINT 13 REPORT PIN E Input Rn END RUE n U amp l1l6 Rn Directly Report Bitmask Port E Report Result Port E logic State gt 4 76 firmware only to the variable n gt 4 76 firmware only 317 Related Command UE UEA UEI UEO as command Set I O Port E to Input APPLICATION I O control DESCRIPTION Set Pin E to be an output EXECUTION Immediate CONDITIONAL TO UE 0 or UE 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Although its default function is to be the AniLink data line user I O line E can function as a TTL output The command UEO specifies the I O pin E as an output while UE value sets the voltage I O pin E will be a logic high voltage if UE 1 and a logic low voltage if UE 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available
225. internal encoder is now associated with CTR value Immediate External encoder attached to motor N A N A N A N A N A N A N A ENCO FIRMWARE VERSIONS 4 11 and higher DETAILED DESCRIPTION The SmartMotor can accept inputs from either the internal integrated encoder or an external source The ENC1 command will cause the SmartMotor to servo from the secondary external encoder channel instead of the internal encoder The internal encoder will likewise then be readable by way of the CTR variable P will rack the external encoder The default mode of operating from the internal encoder is restored with the ENCO command If the external encoder is not connected or connected wrong the motor may run away If this happens use the RP command to check the position If by rotating the shaft you can change the position then the encoder is connected but the A and B signals likely need to be swapped to reverse the direction described by the quadrature phasing of the A and B signals EXAMPLE ENCI Servo from external encoder ENCO restore default encoder behavior 113 Related Commands RCKS Rv RUN RUN UP UPLOAD Z END End Program Code Execution APPLICATION Program execution control DESCRIPTION Terminates the user program execution EXECUTION Immediate CONDITIONAL TO Valid whether issued by host or user program LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS
226. ion of RS485 data This is required for use with Animatics RS232 to RS485 converters like the RS485 and RS485 ISO When using one of these adapters you must ensure that the I O G pin is configured as a TTL output with the UGO command before the channel is opened Note RS4 should only be used when the RS485ISO communications adapter is being used 261 Related Command PID1 PID2 PID4 PID8 RSP Report CPU speed and Firmware Revision APPLICATION Report command DESCRIPTION Report PID sample period and Firmware Revision EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT STRING ASCII alphanumeric string READ WRITE Read only LANGUAGE ACCESS N A UNITS ASCII string RANGE OF VALUES Firmware version dependant TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The report command RSP returns a five digit value of the PID sample period followed by an ASCII string code representing firmware version For versions 4 0 and higher this basic sample rate is associated with the command PID1 The following is a table of firmware releases and RSP responses at the time of this printing The PID sample period in microseconds is the five digit number 100 All version 4XX series motors respond in t form of 24576 firmware revision Example when sent to anSM2315D with 4 40c firmware RSP 24576 440C 262 Related Command MT SEVERE WARNING If MT follows MD50 i
227. is aborted if any recognizable serial character is received during the first 500 mil 264 Related Command END RUN RUN continued Start Re Start Program Execution liseconds after power up or reset In versions 4 15 4 75 and onwards the stored program is aborted if the serial character string EE or subset EE of EEEEEEEEEEEE reset EXAMPLE user program with possible halt PRINT LOADING TRAJECTORY A 100 V 1000000 P 1000000 MP PRINT Type RUN to start 13 RUN command RUN Run command requested execution until RUN PRINT EXECUTING TRAJECTORY G END during the first 500 milliseconds after power up or Prompt user for Stop program command is received 265 Related Command END RUN The program will only begin when explicitly told to run by a RUN command sent by a host RUN Halt Program Execution until RUN Received APPLICATION Program execution control DESCRIPTION Halt execution of user program commenced without RUN EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Valid via serial communication or program read LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT Halts programs automatically started at power up FIRMWARE VERSIONS ALL DETAILED DESCRIPTION If a program exists within the SmartMotor user EEPROM it will automa
228. is redirected to serial channel 1 and the reported value is not be seen output the primary or currently active serial channel Following F 4 the equivalent to Raaa is PRINT1 a 13 F 0 resets report commands to again be sent out the primary or currently active serial port 204 Related Command N A Raaa Rzzz continued Report 32 Bit Variable Data Value EXAMPLE ry ll 0 use HOST channel RINT 13 F 0 OSUB5 ll D redirect report output RINT 13 F 4 OSUBS reset to default AA ty QQ y Z il O iS c5 iii 123 jJjj 456 kkk 789 PRINT iii jjj kkk Rii RJJ Rkk END Host terminal only sees the following program output Note the carriage returns not explicitly shown here F 0 123456789123 456 789 205 Related Command N A Rab index Report 8 Bit Array Data Value APPLICATION Report command DESCRIPTION Report user variable ab index EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Index range from 0 to 50 REPORT VALUE ab index READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 128 to 127 TYPICAL VALUES 128 to 127 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Rab index reports the signed value of the variable ab index to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmi
229. is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 238 Related Command CCHN OCHN RCHNO RCHN1 RCHN1 continued Report Secondary Serial Port Status EXAMPLE download and run the following END c5 IF CHN1 amp 4 PRINT1 CHANNEL 1 ELSEIF CHN1 amp 1 PRINT1 CHANNEL 1 ENDIF PRINT1 13 RETURN c10 IF CHN1 test individual flags scan error occurred buffer overflow test all flags PRINT1 CHANNEL 1 SERIAL ERROR ENDIF PRINT1 13 RETURN Then from terminal type RKK GOSUB5 239 Related Command RCS1 APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE LANGUAGE ACCESS READ WRITE UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE RCS Report Primary Serial Port Checksum Report command Report channel 0 serial receive checksum Immediate N A N A Checksum for channel 0 since prior RCS N A N A ASCII checksum number 0 to 255 0 to 255 Non zero FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION RCS reports the accumulated channel 0 checksum value to the primary serial channel No leading zeros are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return There is no equivalent PRINT command The RCS checksum value is the simple 8 bit sum of all
230. issue MFO while in mode MF2 REPORT COMMAND RMODE READ WRITE Associated external encoder is read only LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS All except 4 40 series DETAILED DESCRIPTION MF2 causes the SmartMotor to instantly and precisely follow a second external encoder signal from input pins A and B resetting the external encoder CTR value to zero For each 4 external encoder counts in the same direction received by the SmartMotor the motor shaft will be requested to follow moving 1 internal encoder count in the same direction Velocity and acceleration feed forward gains are not computed during this mode Issuing any other mode such as MT or MP followed by G will take the SmartMotor out of this following behavior MF2 instantly turns on the servo and resets any position error The servo off flag Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 will immediately cause a position error after 4 encoder counts in the same direction are received from the external encoder The motion is also subject to the currently defined activity of the limit switches EXAMPLE MF2 Reset CTR and Set follow mode RMODE RESPONSE is EF WAIT 100000 Follow for a while MP Revert to position mode P 0 Set destination for home G Terminate following
231. it and it responds If you issue the LOAD command to the motor it immediately goes into a memory write mode while checking all incoming data Every ASCII character that is received after the LOAD command is issued goes directly onto the Program EPROM To terminate the LOAD command the last characters to send are 2 two hexFF characters The hexFF characters tell the motor that it is the end of the file and to drop back into regular command mode 153 Related Command LOCKP RCKS RUN RUN UP UPLOAD LOAD continued Download Compiled User Program to Motor Details on the downloadable file When you compile an SMS file with the SMI software it creates an SMX file extension with the same name in the same directory This is the file you need to download to the motor So basically here is what you should do Do an initial download of your program to the motor from SMI on some other machine Issue the RCKS command This is the Report Checksum com mand It will respond with a string in the form of RCKS 000000 0000EB P where the 000000 0000EB will be different than shown and represent a unique 2 byte checksum to any given program The P at the end will be either a P passed or F failed Keep this number in your own program PLC that will do the downloading 1 Store the SMX file for downloading 2 Store the string received from the RCKS command above as well 3 Establish serial communications with the mo
232. ity mode A 10 set buffered acceleration V 4000 set low buffered maximum velocity G start slow motion profile WHILE Bm travel until negative limit reached i I clear and arm index capture LOOP X decelerate to a stop P I go back to index G start motion TWAIT wait till end of trajectory 7 7 7 O 0 set origin at index 47 Related Commands Bx I RI Bi continued Index Position Captured Status Bit EXAMPLE Fast Index Find MP set buffered velocity mode A 1000 set fast acceleration Vv 4000000 set fast velocity D 2100 set relative distance just beyond one shaft turn i I clear and arm index capture O 0 force change to position register G start fast move TWAIT wait till end of trajectory P I go back to index G start motion TWAIT wait until end of trajectory O 0 set origin at index Index used as High Speed Position Capture When enabled via F 1024 v4 95 or later firmware the Bi flag is set to 1 when Port G I O pin gets driven to zero This happens within 5 microseconds of Port G going low As a result Port G can be used to capture position for high speed registration applications EXAMPLE Fast Position Capture UGI Get Port Gas Input Port Set F command flags al 0 64 set value to enable C2 interrupt call C2 gets called when Port G grounded al 1 1024 set value to enable Index Position capture to be triggered from Port G F al 0 al 1 V
233. ive or negative use this fact to control the direction of shaft motion Overly large ratio gains are flagged by the firmware setting the system flag Bd and may be unstable The error flag Bd will be set by MFR if the magnitude of MFMUL MFDIV is 256 or greater MFR does NOT reset Bd if already set by a prior procedure EXAMPLE Zd MFO MFDIV 10 MFMUL 21 MFR D 0 IF Bd GOTO12 ENDIF G D 500 V 5000 END C12 END reset Bd system flag reset CTR Denominator 10 Numerator 21 Calculate Ratio input 21 external counts resulting motion 10 counts No phase shift gain too large Start Following Implementing Phase Adjust Set Relative Distance Set Relative Velocity Start Phase Adjust Stop Motion 169 Related Command Bd CTR MF1 MF2 MF4 MFDIV MFR MFMUL Set Mode Follow Multiplier APPLICATION Mode follow control DESCRIPTION Mode follow external encoder with ratio MFMUL MFDIV EXECUTION Buffered pending a G CONDITIONAL TO D MFMUL MF1 MF2 MF4 V LIMITATIONS Magnitude of ratio MFMUL MFDIV must be less than 256 REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Number RANGE OF VALUES 32768 to 332767 TYPICAL VALUES 5 lt MFMUL MFDIV lt 5 DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The ratio MFMUL MFDIV specifies the gain for Mode Follow with Ratio MR
234. jectory in progress LIMITATIONS None REPORT COMMAND RBt READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE DEFAULT VALUE 0 no trajectory in progress 1 trajectory in progress 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The flag Bt is set to 1 any time the motor is performing a calculated trajectory path from one point to another Once the trajectory generator has requested the final target position the Bt flag is reset to zero At this point the PID positioning control takes over the motion which means that the motor shaft may still be moving due to mechanical settling Torque Mode MT will not set the Bt bit to 1 because there is no target trajectory Mode Velocity MV will maintain the Bt bit to 1 regardless of commanded velocity or acceleration even they are set to Zero Mode Follow and Mode Step will maintain Bt to 1 even if there are no change in incom ing counts If a relative or absolute move is commanded in position mode MP and there is no zero commanded Acceleration or Velocity the Bt bit will be set to 1 and the motor shaft will not move EXAMPLE 1 WHILE Bt while trajectory in progress LOOP WHILE V while still settling or while velocity not zero LOOP OFF motor off BRKENG brake engage 58 Related Commands BRKTRJ G OFF EXAMPLE 2 MP A 10 v 440000 P 10000 G WHIL
235. l roll over return to zero at value 2 147 483 647 which corresponds to 4 13 days at PID1 EXAMPLE 1 The following two examples perform the same function pause for one second WAIT 4069 Pause for one sec CLK 0 Initialize clock WHILE CLK lt 4069 Loop one sec LOOP 85 Related Commands RCLK WAIT CLK continued Hardware Clock Variable The advantage of the second example is that you could write code within the WHILE loop to execute during the pause EXAMPLE 2 CLK increments more slowly at PID2 than PID1 etc To most easily see the effect load and run the following code PID1 a 5 WHILE a a a 1 CLK 20 WHILE CLK lt 4089 LOOP note nested whiles are permitted PRINT PID1 13 LOOF a 5 PID2 WHILE a a a 1 CLK 20 WHILE CLK lt 4089 LOOP PRINT PID2 13 LOOP PID4 a 5 WHILE a a a 1 CLK 20 WHILE CLK lt 4089 LOOP PRINT PID4 13 LOOP PID1 return to PIDI END 86 Related Commands CMD1 DAT DAT1 OCHN CMD Accept Command Input RS 232 APPLICATION Serial communications control Parameter DESCRIPTION Set serial communication channel 0 to receive commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Command channel FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION By default anything
236. larly the 8th line CASE 3 tells what to do if x 3 Finally DEFAULT tells what to do if none of the CASE s match the value of the x 99 Related Commands BREAK CASE ENDS SWITCH DEFAULT continued Switch Case Structure Element If no CASE number equals the value of the SWITCH expression and there is no DEFAULT case program execution passes through the SWITCH control block to the ENDS statement without explicitly performing any commands There can only be one DEFAULT statement per SWITCH control block DEFAULT is not a valid terminal command it is only valid within a user pro gram EXAMPLE 2 a 20 WHILE a SWITCH a 12 CASE 4 PRINT 4 BREAK CASE 3 PRINT 3 BREAK CASE 2 PRINT 2 BREAK CASE 1 PRINT 1 BREAK CASE 0 BREAK CASE 1 PRINT 1 BREAK CASE 2 PRINT 2 BREAK CASE 3 PRINT 3 BREAK CASE 4 PRINT 4 BREAK DEFAULT PRINT D ENDS a a 1 LOOP The above code example produces the following output D D D D 4 3 2 1 1 2 3 4DDDDDDD 100 Related Commands DOUT See Appendix for greater detail and information about expanding the SmartMotor I O using AniLink chip sets DIN port channel Input Byte From I O Device APPLICATION Input control DESCRIPTION Fetch AniLink digital peripheral input byte EXECUTION Immediate byte read from IIC link CONDITIONAL TO Peripheral input attached to motor LIMITATIONS Port A
237. le RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 3200000 to 3200000 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RV reports the signed 32 bit value of the current trajectory velocity V It is not the actual velocity but what the velocity is supposed to be at the time the RV command was executed No leading zeros are transmitted and it is followed by an ASCII car riage return The equivalent PRINT command is PRINT V 13 EXAMPLE monitor acceleration ramp O 0 set up a velocity move E 4000 A 10 v 4000000 V v MV G WHILE V lt v monitor velocity while IF Be accelerating BREAK exit if position error ENDIF GOSUB5 report trajectory velocity LOOP GOSUB5 final report END c5 PRINT VELOCITY RV report trajectory WAIT 4000 commanded velocity request RETURN 267 Related Command RPW RW Whoops some more of those pesky asterisks that don t seem to go anywhere RW Report System 16 Bit Status Word APPLICATION Report command DESCRIPTION Report extended motor status flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE N A READ WRITE Report only LANGUAGE ACCESS None UNITS 16 motor status bits RANGE OF VALUES a TYPICAL VALUES ia DEFAULT VALUE 128 Motor OFF FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION RW reports the unsigned value of the present SmartMotor status word W No leadi
238. le can be assigned a value with an equation but can also be sequentially loaded by specifying the starting variable and the series of values to be loaded Continued on following page 24 Related Commands a z aa zz aaa ZZZ aw index al lindex VST VLD SEE APPENDIX C To describe the relationship between user assigned variables aa thru zzz and variable arrays ab J al and aw ab index continued 8 Bit Array Variables Continued from preceding page EXAMPLE ab 6 123 34 67 34 127 Loads sets ab 6 equal to 123 aw 7 to 34 and so forth ending with 127 loaded into ab 10 The command syntax requires a space between the leading variable and each subsequent value The function is terminated by a period All user variables are initialized to the value of 0 at power up or upon execution of the system reset command Z Other than by direct assignment this is the only way that the SmartMotor sets all of the user variables to 0 Issuing a RUN command does not perform this automatic initialization For this reason it is usually preferred to test a program whether it is auto execution or not by power cycling the SmartMotor or issuing a system reset command Z The aa through zz and aaa through zzz variables share the same physical memory as part of the ab aw and al arrays That is if you set aaa 123456 you will find al 0 has the same value regardless of what you set it to befo
239. led count In position or velocity mode the macroscopic trajectory velocity with a granu larity of 1 scaled count per sample is returned by V In modes that do not generate a trajectory velocity for example torque mode the velocity must be gleaned from changes in the encoder each Sample so the micro scopic value with a granularity of 65536 scaled counts per sample is returned by V RV PRINT V and the sequence a V Ra would transmit identical values if it were possible to execute all three command sequences simultaneously To display the user specified buffered maximum velocity value V V expression as opposed to the present velocity the sequences a V Ra or equivalently PRINT V would be used EXAMPLE A 20 set buffered acceleration V 66500 set buffered velocity MV Set to Velocity Mode G Begin Moving WHILE V lt V wait for acceleration phase to complete LOOP PRINT Target Velocity has ben reached 13 18 Related Commands aa ZZZ ab index al lindex aw index SEE APPENDIX C To describe the relationship between user assigned variables aa thru zzz and variable arrays ab al and aw a Z 32 Bit Variables APPLICATION General purpose data control DESCRIPTION User signed 32 bit variables EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Versions prior to 4 00 only have variables a j REPORT COMMAND Ra Rz READ WRITE Read Write LANGUAGE ACCESS Assignment expres
240. lized to the value of 0 at power up or upon execution of the system reset command Z Other than by direct assignment this is the only way that the SmartMotor sets all of the user variables to 0 Issuing a RUN command does not perform this automatic initialization For this reason it is usually preferred to test a program whether it is auto execution or not by power cycling the SmartMotor or issuing a system reset command Z The aa through zz and aaa through zzz variables share the same physical memory as part of the ab aw and al arrays That is if you set aaa 123456 you will find that al 0 has the same value regardless of what you set it to before Similarly the values of ab 0 through ab 3 and aw 0 and aw 1 will have values that correspond to the individual 8 bit bytes and 16 bit words that are part of aa 31 Related Commands D E G MP MV PIDn A expression Set Acceleration APPLICATION Trajectory control DESCRIPTION Set buffered acceleration EXECUTION Buffered pending G command CONDITIONAL TO E G V PIDn LIMITATIONS Must not be negative Effective value is rounded down to next even number REPORT COMMAND RA READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Scaled encoder counted sample RANGE OF VALUES 0 to 2147483647 TYPICAL VALUES 0 to 5000 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Setting the buffered A value d
241. low Control Decelerate Shaft to a Relative Position Total CPU Reset 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 335 337 338 339 340 342 343 Language reference table of contents continued Za Zb Zc Zd Ze Zf Zl Zr Zu Zw ZS Array Variable Memory Map Array Variable Memory Map Reset Peak Over Current Flag Reset Comms Parity Error Flag Reset Comms Buffer Overflow Flag Reset Math Overflow Error Flag Reset Position Error Flag Reset Comms Framing Error Flag Reset Historical Left Limit Flag Flag Reset Historical Right Travel Limit Flag Reset Array Index Error state Flag Reset Encoder Wrap Status Flag Global Reset System State Flags Page 1 of 2 Page 2 of 2 344 345 346 347 348 349 350 351 353 354 355 357 358 Contact Us Animatics Corporation 3200 Patrick Henry Dr Santa Clara CA 95054 USA Tel 1 408 748 8721 Fax 1 408 748 8725 www animatics com Language reference introduction The Smartmotor Language Reference lists each Smartmotor command in alphabetical order Every command is described in exacting detail and shown in the context of a real world example where it applies The commands are supplemented with a Related Commands section in the outside column that is designed to guide you to other pertinent commands and assure that you become aware of every resource the Smart
242. m channel 0 port and will simply store incoming bytes in the 16 character serial buffer without attempting to execute any of that data The characters are read from the buffer with the GETCHR command while the LEN function holds the number of characters in the buffer With proper code writing a custom serial command parser can be created Warning The DAT command should only be used within the context of a downloaded program with proper code to follow that deals with all incoming serial data from that point on If DAT is issued via serial port you will be immediately locked out of the motor until next power up It is highly recommended to write code that will handle any incoming data and allow a means to issue CMD command within that code to re open standard command mode via serial port The following code example is written to parse out incoming data It specifically looks for the characters R P and space key one by one Each incoming character is stored into 3 consecutive variables Then they are compared to the proper ASCII value to insure they match If the match the program prints acknowledgment of it SEE NEXT PAGE FOR CODE EXAMPLE 95 Related Commands CMD CMD1 DAT1 LEN OCHN DAT continued Accept Data Input Only RS 232 EXAMPLE using the default host channel PRINT 13 Default mode is CMD PRINT 13 Issuing DAT DAT PRINT 13 Issuing a GETCHR PRINT 13 Use SMI to send RP command 13 a GETCHR
243. martMotor the above does not normally happen because most applications have naturally occuring intervals between commands or groups of commands EXAMPLE sub component of system check routine IF Be PRINT SERIAL OVERFLOW inform host oo clear overflow state latch ENDIF 40 Related Commands Zd ZS RW RPW Bd Math Overflow Status Bit APPLICATION Monitor expression evaluation math overflow DESCRIPTION Math product overflow value out of range EXECUTION Historical immediate CONDITIONAL TO Software detects value out of range LIMITATIONS None REPORT COMMAND RBd RW bit 11 RPW bit 11 READ WRITE Read only To reset to zero issue Zd or Zs command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS 3 00 and higher DETAILED DESCRIPTION Bd is set to 1 by a math multiplication out of range condition gt 32Bit signed integer or an out of range Mode Follow Ratio result gt 256 The SmartMotor employs 32 bit signed integer calculations for all math func tions If for example a b results in a magnitude greater than 31 binary bits the Bd system flag is set to 1 You can possibly avoid this by scaling the numbers perform ing calculations in a different order or using different method of calculation EXAMPLE Try this following product on your own hand held calculator and observe the result The
244. motor has to offer to address your specific need The examples are printed in a bold ina MORE STRUCTURED FONT to be quickly and unmistakably identified and interpreted Comments are included and separated with a single quotation mark as they would be in your own programs You will almost certainly find the SmartMotor programmability the most pow erful of any motion controller you have ever used Any problem you may be facing will have many solutions to choose from The key to successful appli cation programming is knowing enough to choose the most elegant solution available Please let us know if you find any errors or omissions in this book so that we may improve it for future readers Such notifications should be sent by e mail with the words Language Reference in the subject line sent to info animatics com Thank you in advance for your contribution 2001 2002 Animatics Corporation All rights reserved Animatics The SmartMotor Language Reference This book is furnished under license and may be used or copied only in accordance with the terms of such license The content of this book is furnished for informational use only is subject to change without notice and should not be construed as a commitment by Animatics Corporation Animatics Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this book Except as permitted by such license no part of this publication may be reproduced
245. n progress Status flag 7 Status flag 6 Status flag 5 Status flag 4 Status flag 3 Status flag 2 Status flag 1 Status flag 0 reset by RS RW reset by RI reset by RW RS reset by RW RS In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 258 RS continued Report 8 Bit System Status Byte Related Example Command O 10000 Set current shaft position as position 10000 set up move RPW P 0 A 222 RW V 33333 MP G go WHILE Bt GOSUB5 monitor for status change LOOP PRINT 13 FINAL REPORT 13 GOSUB5 final report END c5 subroutine 5 PRINT 13 STATUS BYTE VALUE RS IF S amp 32 logical AND status byte S and position error status bit 0010 0000 PRINT 13 POSITION ERROR ENDIF IF S amp 16 logical AND status byte s and wraparound status bit 0001 0000 PRINT 13 WRAP AROUND ENDIF IF S amp l logical AND status byte S and trajectory error status bit 0000 0001 PRINT 13 TRAJECTORY IN PROGRESS ENDIF RETURN 259 Related Command CCHN OCCHN RS4 RS2 Restore Port G normal control APPLICATION I O Control DESCRIPTION Restore PIN G I O
246. n try the same calculation using a motor ad reset error flag ZZ 123456789 aa 987654321 f aa zz Rf lt Response to host will be 67153019 gt RBd lt Response to host will be 1 gt Notice that even the sign of the product is incorrect 41 Related Commands Zd ZS RW RPW Bd continued Math Overflow Status Bit EXAMPLE Mode Follow with Ratio permits the shaft to respond with a user defined scaling gain to the external encoder input There is a limit to the magnitude of the gain such that 256 lt GAIN lt 256 The system flag Bd is set if this GAIN restriction is violated The flag is set immediately after executing the MFR command Zd reset error flag MFMUL 256 Multiplier for incoming encoder counts MFDIV 1 Divisor for incoming encoder counts RBd Response to host 0 MFR Calculate Mode Follow Ratio RBd Response to host 1 The MFMUL parameter cannot exceed 256 MFDIV Note The Bd bit will only go out of range on multiplication of two numbers not addition In other words IF you add two numbers and the result exceeds 231 in magnitude the number will be bit rolled over Example a 2140000000 ZS b ata Rb 14967296 Under the above condition even though the value of b is not correct the Math overflow bit was not set 42 Related Commands Ze ZS G E RW RPW Be Excessive Position Error Status Bit APPLICATION Monitor trajectory for error DESCRIPTION Position
247. nction holds the number of characters in the buffer With proper code writing a custom serial command parser can be cre ated Warning The DAT1 command should only be used within the context of a down loaded program with proper code to follow that deals with all incoming serial data from that point on If DAT1 is issued via serial port you will be immediately locked out of the motor until next power up It is highly recommended to write code that will handle any incoming data and allow a means to issue CMD1 command within that code to re open standard command mode via serial port The following code example is written to parse out incoming data It specifically looks for the characters R P and space key one by one Each incoming character is stored into 3 consecutive variables Then they are compared to the proper ASCII value to insure they match If the match the program prints acknowledgment of it SEE NEXT PAGE FOR CODE EXAMPLE 97 Related Commands CMD CMD1 DAT1 LEN OCHN DAT1 continued Accept Data Input Only RS 485 EXAMPLE using the secondary com channel 1 PRINT1 13 Default mode is CMD1 PRINT1 13 Issuing DAT1 DAT1 PRINT1 13 Issuing a GETCHR1 PRINT1 13 Use SMI to send RP command 13 a GETCHR1 b GETCHR1 c GETCHR1 PRINT1 13 Received ASCII a PRINT1 13 Received ASCII b PRINT1 13 Received ASCII c PRINT1 13 Issuing CMD1 CMD1 IF a 82 GOTO10 ENDIF
248. ndex level detected high and prior index value read F command and Port G LIMITATIONS Latched until index value read REPORT COMMAND RBi RS bit3 RW bit3 RPW bit3 READ WRITE Read only Reset to zero by reading or assigning index value LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES Any legal encoder value DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION When enabled the Bi flag is set to 1 when the internal encoder Z pulse index mark is detected The value of the primary encoder in the servo sample that the index is captured is stored in the I system register WITHIN 5 microseconds of the time it was captured While Bi is 1 the microprocessor is prohibited from making another index capture If the captured value is read or accessed via accessing the I register via RI of lt variable gt I the Bi flag will be reset to zero and the ability to capture the index is again enabled The commands RI and PRINT I 13 report the captured index reading through the primary serial channel PRINT 1 I 13 reports through the channel 1 serial port Any of these command sequences reset the Bi flag to zero Assignments such as variable I likewise assign the captured value and reset the Bi flag to zero If Bi is zero at the time the I value is accessed the previously captured index value is again returned EXAMPLE simple homing MV set buffered veloc
249. ng zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT W 13 As does RS RW resets the Bh BI and Br flag values to zero Asummary of W the motor status word is Bk EEPROM checksum failure Ba AMPS over current latch Bs Syntax error Bu Array index range error Bd Math overflow error Bm Real time negative limit active Bp Real time positive limit active Bx Real time index report Bo Motor OFF Bh Excessive temperature Be Excessive Position error Bw Position wrap around Bi Historical index report latched BI Historical negative limit Br Historical positive limit Bt Trajectory in progress bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit O reset by RPW RW RS reset by RI bit 3 reset by RPW RW RS reset by RPW RW RS If RW is reported the historical limit and overheat flags are immediately reset after the request command operation is completed The value W cannot be assigned to a variable 268 Related Command A D E G MP MV P x CAUTION Careful use of the S command is vital APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE S as command Stop Motion Quickly Motion mode control Abruptly stop motor motion Immediate E value If position erro
250. ng assigned as a general purpose Input via UCI command or Output via UCO command To Re Enable the Right Positve Hardware Travel Limit issue UCP EXAMPLE IF Br PRINT Right LIMIT PRESENTLY ACTIVE ELSEIF Bp ELSE ENDIF PRINT Right LIMIT PREVIOUSLY CONTACTED PRINT Right LIMIT NEVER REACHED Command to Command to Disable Enable PosiNeg Plus Minus Left Right ed Ee ee Port D I Ne Positive AINUS EFT BI Bp ZrorzS UClorUCO Br ZI or Zs UDI or UDO LL Related Commands Bm Bp BI LIMH LIML LIMD LIMN RS RPW RW UCI UCP UCO UDI UDM UDO SLE SLD SLP SLN ZI ZS Br Historical Right Limit Status Bit APPLICATION Monitor Right limit switch latch DESCRIPTION Right limit latch EXECUTION Sampled each PID update until latched CONDITIONAL TO LIMH LIML LIMITATIONS None REPORT COMMAND RBr READ WRITE Read only Reset by RW RS Zr ZS LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE DEFAULT VALUE 0 Right positive limit has not been active 1 Right positive limit has been active 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Br is the historical right limit flag If the right limit is found to be active during any servo sample Br is set to 1 and remains 1 until reset by the user In addition the motion will sto
251. nge for the value of index is 0 to 100 Index may be expressed directly as a number a variable a z the sum of two a z variables or difference of two a z variables See Example 1 for clarification the example illustrates ALL legal index formats thus Raw 6 Raw t 6 and Raw g do not represent valid index references If you attempt to use a legal valid syntax but the actual index value is out of range system state flag Bs set to 1 and a syntax error message may be reported See Examples 3 and 4 The aw 0 to aw 100 variables represent signed 16 bit values assignment of larger values is handled by truncating any extra leading data bits The most significant bit is always considered to be a sign bit See Example 2 for results when aw index is assigned a value larger than 256 256 or 65536 210 Related Command N A Raw index continued Report 16 Bit Array Data Value EXAMPLE 1 a 0 assign test values WHILE a lt 6 aw a a a atl LOOP p 2 q 3 u 1 v 5 PRINT aw 0 Raw 0 report aw 0 PRINT aw 1 Raw 1 report aw 1 PRINT aw 2 Raw p report aw 2 PRINT aw 3 Raw q report aw 3 PRINT aw 4 Raw v u report aw 4 PRINT aw 5 Raw v report aw 5 PRINT aw 6 Raw vt u report aw 6 END EXAMPLE 2 a 65534 assign test values WHILE a lt 65538 i a 65534 aw i l a assignment truncated to only 16 bits Rwb i reported value
252. nput UCT n UCI Store state of I O pin C as digital input into variable name n PRINT 13 REPORT PIN C Input Rn END 304 Related Command UC UCA UCO UCI as input value Read I O Port C to Input APPLICATION I O input DESCRIPTION Input at Pin C EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UCI READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES Oor1 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line C serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input and Defaults to the positive travel limit input It can be accessed with the statement variable UCI PRINT UCI 13 or WHILE UCI LOOP The digital read occurs once at the time the UCI command is executed Assigning the variable a UCI will perform the digital read once and store it into the variable a EXAMPLE UET Initialize U ser defined I O pin C as PRINT 13 PIN C Input UCT n UCI Store state of I O pin C as digital input into variable name n PRINT 13 REPORT PIN C Input Rn END RUC Directly Report Port C logic State gt 4 76 firmware n U amp 4 Bitmask Port C to the variable n gt 4 76 firmware Report Result I nput only only 305 Related Command UC UCA UCI UCO as command Set I
253. o devices a framing error is likely to occur EXAMPLE sub component of system check routine IF Bt ENDIF PRINT S AT ERIAL FRAMING ERROR inform host clear over current state latch 44 Related Commands TEMP TH THD OFF RW RPW Bh Overheat RMS Over Current Status Bit APPLICATION Monitor motor error state DESCRIPTION Hardware motor overheat state EXECUTION Real time set after thermal delay THD reset each PID sample CONDITIONAL TO Motor temperature temperature set point TH temperature set point dead band thermal delay THD LIMITATIONS None REPORT COMMAND Realtime RBh Historical RS bit 6 RW bit 6 RPW bit 6 READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION There are two mechanisms in the SmartMotor that can indicate excessive heat The first is a temperature sensor while the second is an RMS current monitor The former is a direct measurement of heat while the latter predicts that an overheat will occur In either case Bh will be set to 1 With continuous heavy loads all motors will generate heat If the heat sinking or ventilation is inadequate eventually the motor will overheat If this situation repeatedly occurs it may mean that the motor does not have enough power for the assigned task motor sizin
254. o on start trajectory The brake will automatically be energized and released TWAIT wait for trajectory to end now brake will be on and servo off WAIT 4069 brake on for one second P 0 set new buffered target position G servo on brake off trajectory WAIT 4069 GOTO1 effective loop forever Note A position error will terminate the trajectory in progress state In this case brake would then be asserted Once in BRKTRJ mode the brake can be audibly hear clicking on at the beginning of each move and clicking back off at the end of each move This is normal and gives assurance of proper operation 73 Related Commands CASE DEFAULT ENDS LOOP SWITCH WHILE BREAK Program Flow Loop Exit Control APPLICATION Program execution flow control DESCRIPTION Causes immediate exit from a WHILE or SWITCH control block EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Downloaded code only not via Serial Port REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION BREAK is used both by WHILE LOOP and SWITCH ENDS control flow structure blocks In both structures if BREAK is encountered the program jumps out of that particular WHILE loop or SWITCH structure If the control blocks are to be nested BREAK only exits the WHILE loop or SWITCH structure that it is currently
255. ocumentation for more information 150 Related Command LIMD LIMH LIMN UCP UDM LIML Travel Limits Active Low APPLICATION Limit switch control DESCRIPTION Limit switches are active low EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT PROPERTY Limit switches are active low FIRMWARE VERSIONS 4 15 and 4 40 DETAILED DESCRIPTION The limit switches are associated with the I O C and I O D pins Following a power up or reset the Z command the limit inputs are active LOW by default This means if the logic state goes low the motor will stop LIML defines the limit inputs to be active Low This means if the logic state level goes low the motor will stop NOTE The limit input pins have 5K Ohm pull ups meaning they are seen as logic high when there is no connection to them LIMH defines them to active High Associated with the limit switches are the system flags Hardware Travel Limit Overview Status Bits Ca Command to Ea to Disable nable A sati Plus Minus eet j Historical Bit Travel Limit Input Travel Limit e Zr or ZS UCI or UCO Note PLS firmware defaults to LIMH with no option to change it Please consult PLS firmware documentation for more information 151 Related Command LIMD LIML LIMH LIMN Enable Non Directional Travel Limits APPLICATION L
256. olding the the shaft locked in place nd therefor may be applying a force to the load BRKTR4g is the only mode that behaves this way 53 Related Commands Bm BI Br LIMH LIML LIMD LIMN RS RPW RW UCI UCP UCO UDI UDM UDO SLE SLD SLP SLN ZI ZS Hardware Travel Limit Overview Status Bits Command to APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES VALUES BY STATE DEFAULT VALUE FIRMWARE VERSIONS Bp Real Time Right Limit Status Bit Monitor right limit switch Right Positive limit state Sampled each PID update LIMH LIML None RBp Read only Expressions and conditional testing Binary flag Oor1 0 right positive limit switch not active or pin not assigned as a limit switch 1 right positive limit switch is active 0 ALL DETAILED DESCRIPTION Bp indicates if the right positive pin is presently active If Bp is set to 1 the historical right limit flag Br is also set to one In non PLS firmware motors the polarity of the signal that is considered active is determined by commands LIMH and LIML PLS firmware has Active High Limits only Note on Programmable Software Limits gt 4 76 firmware The Active Real Time status bit will be set to a one as long real time position is beyond the programmed software limit position The Right Positive Hardware Travel Limit may be disabled by bei
257. oltage if UC 1 and a logic low voltage if UC 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UCA function EXAMPLE UCO set PIN C to function as a digital output UC 0 set PIN C to logic 0 zero volts UC 1 set PIN C to logic 1 5 volts Note The I O state can be set prior to assigning as an output UC 0 Pre set PIN C to logic 0 zero volts Uca set PIN C as an output pre initialized to zero 302 Related Command UC UCI UCO UCA Read I O Port C as Analog Input APPLICATION I O control DESCRIPTION Read Pin C analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UCA READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line C can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UCA is read only and can be accessed with the state ment variable UCA PRINT UCA 13 or WHILE UCA gt 200 LOOP The analog read occurs once at the time the UCA command is executed Assigning the variable a UCA will perform the analog read once and store it into the variable a All user I O
258. ommand negates the effect of SILENT and restores the motor s primary port to it s default state of operation 274 Related Command TALK TALK1 SILENT SILENT1 Silence Secondary Port Outgoing Communications APPLICATION Serial communication control DESCRIPTION Motor prevented from sending channel 1 responses to commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE TALK1 state FIRMWARE VERSIONS 4 0 and later DETAILED DESCRIPTION The SILENT1 command causes the SmartMotor to suppress all internally originating serial communication messages intended for the channel 1 secondary port It does not prevent the SmartMotor from sending messages in response to incoming serial report commands from the host This command is most commonly used when sending a new program to an individual SmartMotor mounted in a networked system In order to guarantee that the program arrives as sent it is required that all other motors in the array be silent during download The TALK1 command negates the effect of SILENT1 and restores the motor s secondary port to it s default state of operation 275 Related Command BASE G MC SIZE expression Set Number of CAM Table Data Points APPLICATION Mode CAM control DESCRIPTION Number a data entries for CAM Mode EXECUTION Buffered pendin
259. ommanded Torque Value Start Re Start Program Execution Halt Program Execution until RUN Received Report Current Trajectory Velocity Report System 16 Bit Status Word Stop Motion Quickly 8 Bit System Status Byte Set Motor Address Silence Primary Port Outgoing Communications Silence Secondary Port Outgoing Communications Set Number of CAM Table Data Points Ignore Incoming Commands on Primary Port Ignore Incoming Commands on Secondary Port Clear Stack Pointer Register Selectable Program Flow Control Set Open Loop Commanded Torque Value Enable Outgoing Messages on Primary Port Read Motor Temperature Set Maximum Allowable Temperature Set Overheat Delay Timer Pause Program Execution During Active Trajectory Set I O Port A Out t Logi c State Read I O Port A as Analog Input Set I O Port A to Input Read I O Port A Logic State Set I O Port A to Output Set I O Port B Output Logic State Read I O Port B as Analog Input Set I O Port B to Input Read I O Port B Logic State Set I O Port B to Output Set I O Port C Output Logic State Read I O Port C as Analog Input I O COMMAND 261 262 263 264 266 267 268 269 270 272 274 275 276 278 279 280 282 284 286 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 Language reference table of contents continued UCI as input value UCO as command UCP UD expression UDA UDI as command UDI as input value UDM UDO as command
260. ommands for approximately 10 milliseconds The biggest difference between the two overheat mechanisms described will be that if the RMS current monitor detects and overheat the SmartMotor may not physically feel hot Once Bh is set to 1 the historical overheat flag is latched when read by RW RS or accessing S If the overheat condition no longer exists Bh will be reset to zero upon reporting RS RW or accessing the S value EXAMPLE sub component of system check routine IF Bh IF TEMP gt 69 PRINT MOTOR TOO HOT inform host GOSUB123 deal with condition LSE PRINT RMS Over Current Trip GOSUB123 deal with condition ENDIF ENDIF EXAMPLE Test to measure approximate shut down time not very accurate but illustrates TH THD and TEMP PRINT 13 Default value of TH TH default 70 PRINT 13 Motor Temperature TEMP PRINT 13 START MOTION A 222 V 44444 MV G THD 32000 THD default 12000 or 3 seconds units are PID samples TH TEMP 5 Force an over heat condition units are degrees Centigrade TH maximum setting is 70 a CLK WHILE Bh 0 LOOP WHILE Bt LOOP b CLK PRINT 13 Servo OFF after b a PID samples 46 Related Commands Bx I RI F Bi Index Position Captured Status Bit APPLICATION Monitor Index Latching DESCRIPTION Hardware index position available state EXECUTION Set upon hardware index latched CONDITIONAL TO Hardware i
261. on error upon a single count of output motion being required The motion is subject to the currently defined activity of the limit switches RMODE will respond with a V In firmware 4 76 if ay prior errors exist Zs r th appropriate command must be used to clear the associated error status bit flag Due to arcane digital math A is effectively rounded down to the next even number A values of 1 and 0 therefor produce a net acceleration of zero In these instances requests to change the current velocity produce no change in velocity until A gt 2 is requested and a new G command issued EXAMPLE MV buffer velocity mode request A 2 set the minimum possible buffered acceleration V 44444 set buffered velocity G apply buffered motion parameter and mode WAIT V do not use TWAIT since move is forever RMODE response is V V V prepare to reverse velocity direction A 2 A with double the present acceleration G reverse direction V V 4 prepare to slow to one quarter tof original velocity WAIT V V this is a valid expression G slow to one quarter original velocity WAIT 4096 10 Wait 10 seconds 4069 servo samples 1 second X decelerate to stop at acceleration set by A END 184 Related Command RP MSO MFO O expression Set Main Position Counter APPLICATION Reset SmartMotor s encoder origin DESCRIPTION Request SmartMotor s encoder origin change EXECUTION Immediate CONDITIONAL
262. on occurs when the SmartMotor reads these bytes from the buffer regardless of whether these bytes are command or individual data bytes ECHO_OFF termi nates the echo facility ECHO can be issued to control a single motor communicating with a host terminal or any another serial device as well as control groups of motors sharing series loop daisy chain serial com munication lines ECHO is required to pass serial bytes though a motor to the next motor in a multi drop serial daisy chain setup such as when the Add A Motor cables are used It is also often used in single motor applications for transmit verification 104 Related Commands ECHO ECHO_ON ECHO_OFF1 ECHO_OFF Turn RS 232 Echo Off APPLICATION Serial communications control DESCRIPTION Motor does NOT echo received channel 0 serial characters EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A ae VALUE Motor Defaults to ECHO_OFF non echo O FIRMWARE VERSIONS ALL DETAILED DESCRIPTION ECHO_OFF causes the SmartMotor channel 0 or primary comm port to stop echoing This is the default power up state of any SmartMotor No incoming channel 0 characters are re transmitted The command can be issued to control a single motor communicating with a host terminal or any another serial device as well as control groups of motors sharing ser
263. onse is 1023 214 Related Command Z Za ZS RBa Report PEAK Over current Status Bit APPLICATION Report command DESCRIPTION Report system state over current latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Ba READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0to1 STATE VALUE 1 Over current event occurred STATE VALUE 0 Over current has not occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBa reports the value of the system over current flag Ba It returns a 1 if an over current has been detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Ba 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response is transmitted through channel 1 EXAMPLE PID1 sample rate 4069 second WHILE Bt report trajectory status about each second WATT 4000 PRINT 13 OVERCURRENT STATE w RBa PRINT 13 OVERHEAT STATE 1e RBh PRINT 13 POSITION ERROR STATE RBe LOOP PRINT 13 TRAJECTORY TERMINATED 13 END 215 RBb Report Commun
264. or information about the two serial channels on the SmartMotor It gives the 4 bit status of either serial port channels 0 or 1 broken down as follows CHN bit 0 1 if either receive buffer has overflowed CHN bit 1 1 if a framing error occurred on either channel CHN bit 2 1 if a scan error occurred on either channel CHN bit 3 1 if a parity error occurred on either channel For example if RCHN returns a 4 it means that a scan error was detected on channel 0 or channel 1 You cannot tell however whether the syntax error was on channel 0 1 or both If you really must know you would issue RCHNO and RCHN1 which return the 4 bit status of the individual serial ports CHN is read only but cannot be assigned to a variable It can be reported through RCHN PRINT CHN 13 and PRINT1 CHN 13 as well 79 CHN continued Combined Communications Error Flag Related Each of the four bits of CHN correspond to one of the four communica Commands tions system status bytes Bb Bc CHN bit 0 Bc Bf CHN bit 1 Bf Bs CHN bit 2 AND User Program Scan Error Bs Bb CHN bit 3 CHNO CHN1 Zs 80 Related Commands CHN CHN1 RCHN RCHNO RCHN1 CHNO Communications Error Flag RS 232 APPLICATION Serial communications control DESCRIPTION Fetch serial communications channel 0 error event flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RCHNO READ WRITE Read only LANGUAGE ACCES
265. or will be required to be at position 100 whenever CTR 27494 17294 2506 12506 22506 32506 etc The SmartMotor performs a practical cam application by partitioning the required cam trajectory definition into a number of linearly interpolated segments The SIZE param eter stores the number of segments The segments are required to partition the BASE 64 Related Commands MC MC2 MC4 MC8 SIZE Awlindex MF1 MF2 MF3 MF4 BASE continued Cam Mode Master Cycle Length into a set of equally spaced intervals Suppose BASE 1000 and SIZE 50 Each seg ment will then be of width BASE SIZE or 20 counts The cam motion is then defined by providing the required SmartMotor positions corresponding to CTR 0 20 40 60 940 960 and 980 and 1000 If the motion is truly periodic the required position at CTR 0 will identical to the required position at CTR 1000 The cam table is loaded into the aw array beginning at aw 0 and ending with aw SIZE It is simplest to define the cam using position at CTR 0 to be encoder posi tion 0 by issuing MFO and O 0 commands EXAMPLE A saw tooth cam with periodic motion every 2000 external encoder counts and the motion interpolation divided into 25 equal segments CAM Profile S S lt lt x E 1500 2000 2500 3000 3500 Master Motor Position BASE 2000 Cam period SIZE 25 data segments number of data points in table
266. ort Status Report Primary Serial Port Checksum Report Secondary Serial Port Checksum Report Secondary Encoder Counter Report Commanded Relative Distance Value Report Expanded Input Logic Status Report Maximum Allowable Position Error Return From Subroutine Program Flow Control Report Last Captured Index Pulse Location Report Acceleration Feed Forward Gain Tuning Value Report Derivative Gain Tuning Value Report Gravitational Compensation Gain Tuning Value Report Integral Gain Tuning Value Report Proportional Gain Tuning Value Report Inertial Time Constant Tuning Value Report Velocity Feed Forward Tuning Value Report Real Time Position Report Real Time Position Error Report 8 Bit System Status Byte Restore Port G normal control 221 222 223 224 225 226 227 228 229 230 231 232 233 235 236 238 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 258 260 Language reference table of contents continued RS4 RSP RT RUN RUN RV RW S as command S as status byte SADDR SILENT SILENT1 SIZE expression SLEEP SLEEP1 STACK SWITCH expression T expression TALK TEMP TH THD TWAIT UA expression UAA UAI as command UAI as input value UAO as command UB expression UBA UBI as command UBI as input value UBO as command UC expression UCA UCI as command Set Port G to RS 485 R W Control Pin Report CPU speed and Firmware Revision Report C
267. ot just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 224 RBm Report Historical Left Over Travel Limit Status Bit Related Command APPLICATION Report command BI DESCRIPTION Report Historical Left Limit State Z EXECUTION Updated each PID sample CONDITIONAL TO LINH LIML UDI UDO LIMITATIONS N A REPORT VALUE Bm READ WRITE N A LANGUAGE ACCESS N A UNITS Binary state RANGE OF VALUES 0 to 1 STATE VALUE 1 Left limit switch active STATE VALUE 0 Left limit switch not active FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBm reports the value of the Historical left limit flag Bm It returns a 1 if an active left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bm 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 225 Related Command G Z ZS RBo Report Motor Off Status Bit APPLICATION Report command DESCRIPTION Report real time system state motor off EXE
268. ould normally move through points 0 10 20 30 etc But if MC is replaced with MC2 the CAM motor would instead mover though points 0 20 40 60 80 100 80 60 40 20 and back to zero See the MC command for full details on CAM mode 160 Related Command BASE CTR G MC MC2 MC8 MF1 MF2 MF4 MS SIZE MC4 Mode CAM 4X Multiplier APPLICATION Motion mode control DESCRIPTION Request MODE CAM with x4 multiplier EXECUTION Buffered pending a G CONDITIONAL TO BASE expression and SIZE expression LIMITATIONS Requires external encoder signal source REPORT COMMAND RMODE READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS Version 4 10 and higher DETAILED DESCRIPTION Same as mode MC in all regards with exception that all data points in the CAM table are multiplied by 2 Suppose the following CAM table aw 0 0 10 20 30 40 50 40 30 20 10 0 The CAM motor would normally move through points 0 10 20 30 etc But if MC is replaced with MC4 the CAM motor would instead mover though points 0 40 80 160 340 680 340 160 80 40 and back to zero See the MC command for full details on CAM mode 161 MC8 Mode CAM 8X Multiplier Related Command APPLICATION Motion mode control BASE DESCRIPTION Request MODE CAM with x8 multiplier CTR EXECUTION Buffered pending a G G CONDITIONAL TO BASE expression and SIZE expression MC
269. ound wrapping condition by allowing MFO to be issued on the fly This will zero out encoder counter regis ters without having an effect on the motion profile Continued on next page 61 Related Commands Z G Bi RBx RBi Bw continued Encoder Wrap Around Status Bit Example to prevent wrap status while in Mode Follow continuously Set to Mode Follow at default 1 1 ratio MF4 WHILE LOOP END 1 IF P gt 2147480000 ENDIF IF P lt 2147480000 ENDIF MFO MFO Example to prevent wrap status while continuously indexing UGI D 20000 V 1234567 A 123 WHILE LOOP END 1 WHILE G TWAIT O 0 WHILE Use Port G as general input Set relative distance Set Velocity Set Acceleration while forever UGI LOOP wait for Port G to be grounded Go start Moving Wait until the move is complete set origin to zero UGI 0 LOOP prevent double trigger 62 Related Commands Bi I RI F APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES VALUE OF STATES DEFAULT VALUE FIRMWARE VERSIONS Bx Real Time Index Input Status Bit Monitor Hardware Index Capture Input Index input state Updated each PID sample N A None RBx Read only Expressions and conditional testing Binary flag Oor1 0 index capture input is not in contact low 1 index capture inp
270. ow d m Q MO FG PRINT 13 TEST RA PRINT 13 NO DATA WAIT 100 c a b a IF cl b PRINT DATA ENDIF RETURN GOTO10 c10 PRINT 13 PROGRAM END amp ES1000 slower data rate a faster data rate a N TO COMPLETION ERROR DETECTED PROBLEM ABORT TEST add many GOTO10 statements here to fill up your program EEPROM POINTER ERROR ABORT TEST 119 Related Command ES400 ES1000 Set EPROM Read Write Speed APPLICATION EEPROM Read write Control DESCRIPTION Set EEPROM read write rate to 1000kz EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS EEPROM Read Write Capability REPORT COMMAND None READ WRITE None LANGUAGE ACCESS N A UNITS Bits per sec RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE 1000 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION ES1000 controls the transmit and receive bit rate while communicating between the EEPROMS and the microprocessor There are two settings ES400 and ES1000 ES1000 is the preferable higher data transfer rate for read and writing user programs and data and is the default data rate of version 4 SmartMotors and later The ES400 command is used with older EEPROMs If you have an older EEPROMs and Smart Motors of differing versions you may wish to consider upgrading the EEPROMs Note the following applies to
271. p and the motor will either servo or turn the amplifier OFF depending on the value of the F function The historical right positive limit flag Br provides a latched value in case the limit may have already been contacted active but is not at presently active The real time Right Positive limit flag is Bp which only remains set to 1 while the signal level on the user pin C is active Whenever Bp is set to 1 Bris set to one The polar ity of the signal that is considered active is determined by commands LIMH Active High To Stop and LIML active Low To_Stop in all non PLS firmware motors PLS firmware motors are always Active High asserted If the pin s function is assigned to being general purpose I O by use of the UCI or UCO commands neither Bp nor Br will be affected by the pin state Changing pin states will not elicit limit behavior from the motor It will be necessary to issue the UCP com mand to assign the pin s function to being a limt switch for the pin to again elicit limit behavior including the setting of Br Continued on next page 55 Br continued Historical Right Limit Status Bit Related Commands Bm Bp BI In non PLS firmware motors Br is reset to zero under the following condi tions LIMH LIME 1 When the S status byte is accessed for assignment CMD 2 or reported via RS PRINT S 13 or PRINT1 S 13 3 or directly reset with Zr and ZS LIMN R
272. peration Continued on next page 91 Related Commands ENCO ENC1 MC MF MFO MF1 MF2 MF4 MFR MS MSO MSR Second Encoder Step and Direction Counter EXAMPLE To better understand the meaning of CTR try the following with a SmartMotor O 1234 Set origin to zero Then issue RP response will be 1234 Then issue ENC1 make INTERNAL encoder the source of CTR Then issue RP response will be zero RCTR response is also zero 0 Physically turn the motor shaft and Query the position again RP response should again be that NON ZERO response obtained before RCTR response is another non zero number ENCO return internal motor shaft encoder to Normal functioning If you have an external encoder attach it to a SmartMotor and repeat the above sequence or some similar sequence If in gear mode Mode Follow via MF n and you issue MFO on the fly CTR will be set to zero while trajectory continues without any glitch in movement This serves two purposes One it gives a means to zero the counter while moving Two it allows the user to prevent Wrap status from occurring should CTR exceed 2431 92 Related Commands A G MP MF1 MFR The D command can be used during gearing to implement Dynamic Phase Adjust See MFR The D command can also be sued in CAM mode to implement a dwell between CAM cycles D expression Set R elative Distance APPLICATION Trajectory con
273. pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UCA UCA b UCA PRINT 13 REPORT UCA Rb RUCA Directly Report Port C Analog Value gt 4 76 firmware only 303 Related Command UC UCA UCO UCI as command 1O COMMAND APPLICATION I O control DESCRIPTION Set Pin C to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line C serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input and the positive travel limit input While user I O line C defaults to being the positive limit input it can be explicitly set up as a digital input with the UCI command If I O line C has been set to an output with the command UCO it can be reset to be an input with the command UCI EXAMPLE UCI Initialize U ser defined I O pin C as I nput PRINT 13 PIN C I
274. ple ab 4 refers to the fifth element in the 8 bit array while ab n refers to the n th element of the array where the value of n must be between 0 and 203 The value of any array variable is reported with the R PRINT or PRINT1 func tions EXAMPLE Rab 47 Report the value of ab 47 to the primary serial port PRINT ab 47 ab 47 13 Print to the primary serial port PRINT1 ab 47 ab 47 13 Print to the secondary serial port 23 Related Commands a z aa zz aaa ZZZ aw index al lindex VST VLD ab index continued 8 Bit Array Variables The ab array is classified as read write meaning that they can be assigned a value or can be assigned to some other variable or function Another way of saying this is these variables can be left or right hand values EXAMPLE ab 24 ab 43 ab 7 The above is a valid equation combining the contents of ab 43 and ab 7 and send ing the total into ab 24 As signed 8 bit variables they are subject to the usual restrictions of signed digital words and values The first bit is always a sign bit They are limited to integer values between 128 and 127 Math operations that result in decimal values are truncated or rounded down If you assign or perform an operation that would normally result in a value outside of this range the variable will wrap or take on the corresponding modulo As an example because of this 127 1 128 The result wra
275. ports it to the primary channel The parameters address and channel refer to address and input channel respectively of the expansion card No leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT DIN address channel 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 The command is most commonly used with an Animatics DIO 100 digital I O module or an AniLink thumb wheel module Address may be A B C D E F G or H which is defined by jumper settings on the corresponding peripheral The range of valid channels is 0 through 63 and is determined by the hardware EXAMPLE PRINT DISPLAY THUMBWHEEL C INPUTS 13 13 RDINCO report wheel C digit 0 RDINC1 report wheel C digit 1 RDINC2 report wheel C digit 2 EXAMPLE RDINKO invalid port RDINA66 invalid channel RDINC 244 Related Command A E G P MP MV V RE Report Maximum Allowable Position Error APPLICATION Report command DESCRIPTION Report maximum allowable position error EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE E READ WRIT
276. position error upon a single count of output motion being required The motion is also subject to the currently defined activity of the limit switches RMODE will respond with a P The SmartMotor performs trapezoidal and triangular velocity profiles by default but because position velocity and acceleration are all changeable on the fly during a move more elaborate profiles can be implemented through programming Continued on next page 173 MP continued Enable Position Mode Related Command l l l Due to integer math truncation A is effectively rounded down to the next even number A A value of 1 or 0 therefore produce a net acceleration of ZERO In these instances requests to change the current velocity produce no change in velocity until A gt 2 is D requested and a new G command issued E EXAMPLE G MV MV Velocity Mode A 1000 Set Acceleration P V 50000 Set Velocity G Start Motion V WAIT 6000 Wait 6000 samples MP Position Mode A 50 Set Acceleration V 40000 Set Velocity P 1000 Set Position G Start change Motion WATT 200 Wait 200 samples V 45000 Change Velocity P 0 Update Position G Start Motion 174 Related Command CTR RCTR RMODE MFDIV MFMUL MSR Opto isolaton modules are suggested when using Step and Direction to assure reliable operation MS Enable Mode Step APPLICATION Motion mode control DESCRIPTION Request MODE STEP AND DIRECTION EXECUTION Immediate
277. pped around to the negative extreme Bit Overflow Status Bd System Status bit e lf ab 1 a exceeds 32 signed bits the operation c ab 1 a will produce a wrong result No error flag is set If a ab 1 exceeds 32 signed bits the operation c a ab 1 will produce a wrong result No error flag is set e If a ab 1 exceeds 32 signed bits the operation c a ab 1 will produce a wrong result The system flag Bd will be set If one of these variables is used with a variable of another type it will be appropriately converted the variable will be type cast EXAMPLE In the equation where the variable on the left of the equal sign is an 8 bit one like ab 4 all variables will be converted to 8 bit values and then operated on Assigning the vari able ab 27 al m directly stores the 8 least significant bits of al m into aw 27 The higher bits of the variable al m are lost Conversely if the left hand value is a 32 bit variable and the right hand side contains both 8 bit and 16 bit variables the 8 bit and 16 bit variables will be temporarily upgraded to 32 bits In the equation al 3 ab 4 aw 7 both ab 4 and aw 7 are converted into 32 bit numbers before the subtraction occurs In the SmartMotor language all user variables are written as lower case variables while functions and commands have at least one upper case character The term ab i is a general purpose variable while A is the acceleration function Any user variab
278. put set the value of the pin D output latch UD to either 0 or 1 Issue the command UDO if this has not already been issued O pin D will be a logic high voltage if UD 1 and a logic low voltage if UD 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UDA function EXAMPLE UDO set PIN D to function as a digital output UD 0 set PIN D to logic 0 zero volts UD 1 set PIN D to Logie 1 5 volts Note The I O state can be set prior to assigning as an output UD 0 Pre set PIN D to logic 0 zero volts UDO set PIN D as an output pre initialized to zero 308 Related Command UD UDI UDO UDA Read I O Port D as Analog Input APPLICATION I O control DESCRIPTION Read Pin D analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UDA READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line D can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UDA is read only and can be accessed with the state ment variable UDA PRINT UDA 13 or WHILE UDA gt 200 LOOP The analog read occu
279. put from the UP command will include a header containing binary information and special codes created by the compiler to make the program run faster interspersed with the program text UP immediately terminates any running user program The program counter is lost UP does not terminate the present motion mode or trajectory change motion parameters such as E A V or KP or alter the present value of the user variables The comments in your original source code do not appear when you UP or UPLOAD a program Comments are removed by the compiler which is normal for any compiled computer program When uploading a program from a SmartMotor in a daisy chain prevent the other SmartMotors in the chain from issuing unexpected characters by using the SILENCE and SLEEP commands After the upload is complete you can re enable normal communications with WAKE and TALK 330 Related Commanad UP WARNING Do not use the UPLOAD command within a user program It will terminate the program UPLOAD Standard User Program Upload APPLICATION User program verification DESCRIPTION Upload user EEPROM through serial communications EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS UPLOAD terminates user program execution REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS ASCII Characters RANGE OF VALUES Alpha numeric TYPICAL VALUES Alpha numeric DEFAULT VALUE N A FIRMWARE VERSIONS 4 00 and higher
280. r exceeds E motor will shut off and coast to a stop REPORT COMMAND N A N A N A N A N A N A N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The S command causes an emergency stop It does not turn the motor off rather it sets the target position at the current position The resulting commanded motion will be very abrupt In some cases it will be so abrupt that the amplifier can over current or the servo error can exceed the maximum allowable error set by the E command This will in turn cause the motor to be turned off and coast Consequently careful use of the S command is vital Following S the motion mode is position mode unless a position error is created regardless of the mode it was in before The response to RMODE will be R If the motion that was stopped was a Mode Position move the previous target P or D values are still retained EXAMPLE A 100 V 1000000 P 5000000 G WHILE IF UAI S ENDIF LOOP B PRINT I E stop if PIN A high Stop Abruptly Emergency Stop 269 Related Command RPW RS RW APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VAL UES DEFAULT VALUE FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION S as status byte 8 Bit System Status Byte Program execution control Fetch primary motor status flags Immediate N A N
281. r information about the two serial channels on the Smartmotor It gives the 4 bit status of either serial port channels 0 or 1 broken down as follows CHN bit 0 1 if either receive buffer has overflowed CHN bit 1 1 if a framing error occurred on either channel CHN bit 2 1 if a scan error occurred on either channel CHN bit 3 1 if a parity error occurred on either channel No leading zeros are transmitted and it is followed by an ASCII carriage return It is followed by an ASCII carriage return The equivalent PRINT command is PRINT CHN 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE RCHN test all command input combined error flags error occurred in value return is non zero 235 Related Command CCHN OCHN RCHN RCHN1 RCHNO Report Primary Serial Port Status APPLICATION Report command DESCRIPTION Report serial communications channel 0 status flags EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE CHNO READ WRITE N A LANGUAGE ACCESS N A UNITS Binary states RANGE OF VALUES 0 to 15 TYPICAL VALUES 0 to 15 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION
282. r sec RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE 1000 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION ES400 controls the transmit and receive bit rate while communicating between the EEPROMS and the microprocessor There are two settings ES400 and ES1000 ES1000 is the preferable higher data transfer rate for read and writing user programs and data and is the default data rate of version 4 and later SmartMotors and later The ES400 command is used with older EEPROMs If you have an older EEPROMs and SmartMotors of differing versions you may wish to consider upgrading the EEPROMS Note The following applies to units prior to year 2000 If you get an F or failure response to the RCKS command report program check sum following a program download you may wish to issue an ES400 command from the terminal and try again If RCKS now passes you may have a slow EEPROM In some cases you may need to make ES400 the first program statement within a program but as the command controls the speed at which the memory is read the command really has little value in a program and you may wish to consider upgrading the EEPROM 118 Related Command ES1000 EXAMPLE ES400 continued Set EPROM Read Write Speed The following simple test program may well abort if ES400 is unreliable PRINT TEST ES400 1000 HILE a a 1 S400 RINT 13 ES400 B5 000 PRINT 13 ES1000 vo S
283. r variables are written as lower case letters while functions and commands have at least one upper case character The term a is a general purpose variable while A is the Acceleration function Any user vari able can be assigned a value with an equation as discussed above but can also be sequentially loaded by specifying the starting variable and the series of values to be loaded EXAMPLE Suppose the following code c 123 assign the value of 173 to e d 345 assign the value of 345 to a e 599 assign the value of 599 to e 346 assign the value of 346 to TET g 678678 assign the value of 678678 to g The Sequential loading method equivalent is as follows c 123 345 599 346 678678 sequentially load data into variable c thru g Note The last number MUST BE followed by a period All user variables are initialized to the value of 0 at power up or upon execution of the system reset command Z Other than by direct assignment this is the only way that the SmartMotor sets all of the user variables to 0 Issuing a RUN command does not perform this automatic initialization For this reason it is usually preferred to test a program whether it is auto execution or not by power cycling the SmartMotor or issuing a system reset command Z 20 Related Commands a Z ab index al index aw index SEE APPENDIX C To describe the relationship between user assigned variables aa thru zzz and variable arrays
284. rameter Acceleration and velocity can be changed at any time even during motion The G command will initiate on the fly changes to any of the parameters If the actual velocity is greater that the value defined by V then upon reception of the next G command the motor shaft will decelerate at the rate set by A until the excess velocity is removed Conversely if the actual velocity is less than V when the G command is entered then the motor shaft motion will accelerate at the rate set by A until the requested velocity is attained Similarly if the actual velocity is in the opposite direction of V when the G command is entered then the motor shaft motion will decelerate and then accelerate at the rate set by A until the requested velocity is attained Once the commanded velocity V is attained motion continues at this rate i e uni form velocity indefinitely until the commanded velocity is changed or the mode is otherwise terminated The encoder may wrap around during this mode but no posi tion error will be declared during the wrap In all firmware pror to 4 76 MV followed by G will immediately turn on the servo and reset any position error The servo off Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present 183 Related Command A D V PID loop MV continued Enable Velocity Mode E value Issuing E 0 would immediately cause a positi
285. ransmitted through channel 0 If the report command is received through channel 1 the response is transmitted through channel 1 EXAMPLES RAINC3 valid port and channel RAINA1 valid port and channel RAINW4 invalid port syntax error created RAINBO invalid channel syntax error created Related Command AMPS T MT RAMPS Report Allowable PWM Limit APPLICATION Report command DESCRIPTION Report maximum allowed current to motor windings EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE AMPS READ WRITE N A LANGUAGE ACCESS N A UNITS 1 1023 of maximum current permitted RANGE OF VALUES 0 to 1023 TYPICAL VALUES 1023 DEFAULT VALUE 1023 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RAMPS reports the unsigned value of AMPS the maximum power setting to the primary serial channel No leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT AMPS 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if the report command is received through channel 0 the response is transmitted through channel 0 If the report command is received through channel 1 the response is transmitted through channel 1 EXAMPLE AMPS 333 RAMPS response is 333 AMPS 2000 too large entry auto corrected for safety RAMPS resp
286. re Similarly the values of ab 0 through ab 3 and aw 0 and aw 1 will have values that correspond to the individual 8 bit bytes and 16 bit words that are part of aa 25 Related Commands a z aa zz aaa ZZZ ab index aw index VST SEE APPENDIX C To describe the relationship between user assigned variables aa thru zzz and variable arrays ab al and aw al index 32 Bit Array Variables APPLICATION General purpose data DESCRIPTION User signed 32 bit variables EXECUTION Immediate CONDITIONAL TO The value of index must be between 0 and 50 LIMITATIONS This data space is shared with variables aa zz aaa zzz arrays ab and aw and coordinated motion see MD REPORT COMMAND Ral index READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Signed 32 bit number RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SmartMotor has 8 16 and 32 bit arrays The 32 bit array takes the form of the variables al index These are general purpose 32 bit signed variables that can be reported used on either side of an equation and used with vari ables other than 32 bit Like all user variables they are always lower case can be sequentially loaded and are automatically initialized at power up or reset All arrays share memory sp
287. released When the trajectory completes the brake is engaged and simultaneously the servo is turned off In this mode and whenever the motor is not performing a trajectory the brake is automatically engaged and the servo turned off for any reason that the Bt Busy Trajectory Bit clears A consequence of this behavior is that any non trajectory mode like torque mode will not result in motion as the brake will be engaged and the servo will be off This could be confusing to a user unaware of the nature of BRKTR4J especially since the motor off flag Bo is 0 or false To understand this from an operating control mode point of view the motor has not changed modes to OFF which would be coincidental with Bo set to 1 When running in torque or some other non trajectory mode it is more appropriate to use BRKSRV BRKTRJ terminates the BRKSRV mode BRKENG condition and BRKRLS condi tion 72 Related Commands BRKENG BRKRLS BRKSRV BRKC BRKG BRKI BRKTRJ continued Brake Engage With No Active Trajectory One consequence of BRKTRJ is that the trajectory flag is reset to zero immediately when trajectory generator declares the trajectory to be over At this instant the BRKTRJ will engage the brake de energize the brake BRKTRJ set brake mode to follow Bt bit MP set buffered mode A 100 set buffered acceleration V 100000 set buffered maximum velocity Cl program statement label P 1000 set buffered target position G serv
288. remental to 101 automatically EPTR 100 Set Eprom to 100 again VLD x 1 Load from location 100 into the variable x RX Report result will be 126 Storing and retrieving a 5 consecutive 32 bit standard variables a 10 11 12 13 14 assign values to the variables a thru f EPTR 100 Set Eprom pointer to 100 VST a 5 EPTR will increment to 100 4 5 120 4 bytes x 5 stored EPTR 100 Set Eprom to 100 again VLD v 5 Load from location 100 into the variable p RV will report 10 Rw will report 11 RX will report 12 Ry will report 13 RZ will report 14 Storing 7 16 bit numbers into EEPROM i 10 Using the variable i as index to an array variable j 7 Using the variable j as the number of sequential variables you wish to store Example 16 bit array data Data aw i 1111 2222 3333 4444 1111 2222 3333 EPTR 3200 Set EPROM memory pointer location to 3200 VST aw i j Store j or 7 sequential variables beginning with aw i into EPROM starting at address 3200 Note The EEPROM value will automatically increment for each value stored EPTR value after above execution will be set to 3200 7 variable 2 bytes each or 3214 Retrieving Same data into other variables for later use EPTR 3200 i 10 Using the variable i as index to an array variable j 7 Using the variable j as the number of sequential variables you wish to store VLD aw r s WHILE t lt 5 PRINT 13 aw
289. rent values can be read back with RKV PRINT KV 13 and RKV both report the value of KV through the primary serial port while PRINT1 KV 13 sends it out channel 1 KV is valid with any expression and can be treated as if it were any read write variable The motion and servo character istics are unaffected until KV is applied by the F function EXAMPLE KV 1000 Set buffered velocity feed forward F Update Filter 146 Related Command GETCHAR GETCHAR1 LEN1 LEN Main RS 232 data buffer fill level APPLICATION Communication control DESCRIPTION Number of characters in serial host channel 0 receive buffer EXECUTION Immediate CONDITIONAL TO Host communication channel open LIMITATIONS Maximum buffer length is 16 characters REPORT COMMAND None READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number of available characters RANGE OF VALUES 0 to 16 TYPICAL VALUES 0 to 16 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION LEN returns the number of characters placed in the serial communications channel 0 receive buffer which are still awaiting to be processed A serial channel in COMMAND mode will typically return LEN as 0 but a serial channel in DATA mode may well return a non zero value Testing the value of LEN is a good way to see if there is any char acter for GETCHR to fetch EXAMPLE DAT Set serial channel 0 to DATA mode i 0 IF LEN
290. response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 Scan errors result from malformed command and data syntax An illegal array read write access index also sets the scan error flag Scan errors can occur from commands within program execution or received via either serial channel A program encountering an illegal array access or syntax error should be carefully debugged These programs may not execute accurately following the error Bs is reset by ZS and Zs NOTE Downstream motors in a serial daisy chain will get their Bs bit set when upstream motors respond to report commands This is common and can be ignored EXAMPLE Zs reset any prior scan error state 3 88 for use as array index ZZZ2 3333 al j zzz value assigned is OK but the index value is not max Array al index is location al 50 RBs responds with 1 229 Related Command G Z APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE STATE VALUE 1 VALUE 0 RBt Report Busy Trajectory Status Bit Report command Report real time system trajectory in progress state Immediate N A N A Bt N A N A Binary state 0to1 Trajectory in progress No trajectory in progress FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBt reports the state of
291. ressions and conditional testing UNITS Binary bit RANGE OF VALUES 0or1 VALUES BY STATE 0 left negative limit switch not active or pin not assigned as a limit switch 1 left negative limit switch active DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Bm indicates if the Left Negative pin is presently active If Bm is set to 1 the histori cal Left limit flag BI is also set to one In non PLS firmware motors the polarity of the signal that is considered active is determined by commands LIMH and LIML PLS firmware has Active High Limits only Note on Programmable Software Limits gt 4 76 firmware The Active Real Time status bit will be set to a one as long real time position is beyond the programmed software limit position The Left Negative Hardware Travel Limit may be disabled by being assigned as a general purpose Input via UDI command or Output via UDO command To Re Enable the Left Negative Hardware Travel Limit issue UDM EXAMPLE IF Bm PRINT LEFT LIMIT PRESENTLY ACTIVE ELSEIF Bl PRINT LEFT LIMIT PREVIOUSLY CONTACTED ELSE PRINT LEFT LIMIT NEVER REACHED ENDIF Hardware Travel Limit Overview Status Bits Command to nota to an to Isabie nabie Pot Pos Neg Plus Minus i Travel Limit Input__ Travel Limit Input Port C Positive PLU UCP 52 Related Commands BRKTRJ G OFF Bo Motor
292. rflow Reset user math overflow Reset Position Error In gt 4 76 firmware only Reset communications framing error Reset historical left limit Reset historical right limit Reset user command syntax error Reset user read array indexing out of range Reset wraparound CONTINUED ON NEXT PAGE 355 Related Command Za Zb Zc Zd Zf ZI Zr Zs Zu Zw EXAMPLE ZS c900 IF Ba ad DIF Bb H m Hy H e mS wW Q DIF ra DIF Bd H m Hy A DIF BE H m Hy H m m wW H rj H E H a wW H K tj H E H z wW H a m H m 4 z 0 wW H G A H m H z j wW H x tj N a ne es H ty ZS cont Reset System state Flag reset all error and limit flag latches consider the following Test flag PRINT Over Current Test flag PRINT Parity Error Test flag PRINT Buffer Overflow Test flag PRINT Math Overflow Test flag PRINT Framing Error Test flag PRINT Left Limit Test flag PRINT Right Limit Test flag PRINT Syntax Error Test flag PRINT Array Error Test flag PRINT Wraparound Occurred Reset all tested flags useful for debugging new programs but not satisfactory for real time control Error Report Subroutine Faulty By the time ZS is executed it is possible some previously tested zero flags may now be set 356 Arr
293. rimary serial channel PRINT1 I 13 reports through the channel 1 serial port All three commands reset the Bi flag to zero Assignments such as variable I also assign the captured value and reset the Bi flag to zero If Bi is zero at the time the value is accessed the previously captured index value is returned again The index is a physical reference mark on the encoder It is also referred to asa Z pulse marker pulse and sometimes combinations of all three names Its most widely used in homing sequences requiring a high degree of repeatability 134 Related Commands Bi Bx RBi RBx continued Encoder Index Pulse Location EXAMPLE homing against a hard stop with Index reference AMPS 100 Current limit 10 O 0 Declare this home MP Set Mode Position A 100 Set Acceleration V 100000 Set Velocity P 1000000 Move negative G Start Motion WHILE Bt Wait for motion fault IF Bi If Index Pulse Seen a I Record Index Position ENDIF LOOP Loop back to wait O a Last Index is Home P 0 Move to New Hom G Start Motion AMPS 1023 Restore power Note gt v4 95 has the ability to redirect Port G to the Index register input trig ger allowing high speed position capture via Port G this capture time occurs at CMOS level and is typically around 3 to 5 microseconds All the same rules apply to arming and clearing the index as stated above The Re Direct to Port G is accomplished with the
294. rm of the variables aw index These are general purpose 16 bit signed variables that can be reported used on either side of an equation and used with variables other than 16 bit Like all user variables they are always lower case can be sequentially loaded and are automatically initialized at power up or reset All arrays share memory space with the variables aa through zz and aaa through zzz The syntax of the 16 bit array is aw index which stands for array word and accepts an index value between 0 and 101 This index can be specified explicitly or though another variable EXAMPLE aw 4 refers to the fifth element in the 16 bit array aw i refers to the I 1 element of the array where the value of i must be between 0 and 101 The value of any array element aw is reported with the R PRINT or PRINT1 functions For example to send the value of variable aw 47 out the primary serial port use the command Raw 47 or PRINT aw 47 13 To send the value of the variable aw 37 out serial port 1 use PRINT1 aw 37 13 The aw array is classi fied as read write meaning that they can be assigned a value or can be assigned to 29 Related Commands a z aa zz aaa ZZZ alfindex ab index VST VLD aw index continued 16 Bit Array Variable some other variable or function Another way of saying this though more cryptically technocratic is that these variables can be left or right hand values EXAMPLE a
295. rror detected state EXECUTION Historical latched by serial communications CONDITIONAL TO Channel 0 or channel 1 open with Even or Odd parity LIMITATIONS None REPORT COMMAND RBb RCHN bit3 RCHNO bit3 RCHN1 bit3 READ WRITE Read only To reset to zero issue Zb command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary bit RANGE OF VALUES Oor1 TYPICAL VALUES 0 DEFAULT VALUE 0 Not applicable to default No parity FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The firmware checks for and flags any communications parity error event by setting Bb to 1 If such an error occurs an error recovery routine can be implemented at the discretion of the user In practice unless the environment is electrically noisy this error is unlikely Any data or syntax error due to noise is potentially dangerous in a motion control environment please take appropriate precautions Parity only has relevance when the serial protocol includes parity checking To include parity checking the open channel command OCHN parity parameter must specify either even parity E or odd parity O The default is no parity N in which case there is no parity bit transmitted over the serial channel to check If ignore parity I is speci fied as the parity parameter there is a parity bit included with every data character but it is not checked EXAMPLE sub component of system check routine OCHN RS4 1 E 9600 1 8 C
296. rs once at the time the UDA command is executed Assigning the variable a UDA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on its corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UDA UDA b UDA PRINT 13 REPORT UDA Rb RUDA Directly Report Port D Analog Value gt 4 76 firmware only 309 Related Command UD UDA UDM UDO UDI as command Set I O Port D to Input APPLICATION I O control DESCRIPTION Set Pin D to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line D serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input and the negative travel limit input While user I O line D defaults to being the negative limit input it can be explicitly set up as a digital input with the UDI command If I O line D has been set to
297. rtable DEFAULT MODE MP FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The command MFR is used to implement a fractional relationship between an incoming secondary encoder signal and the SmartMotor internal shaft posi tion represented by the primary internal encoder count The fractional relation ship is defined the user set ratio of MFMUL to MFDIV To use MFR you will need to define the specific desired relationship ratio of the external encoder input to shaft position represented by the primary internal encoder count The command MFR must be issued after both MFMUL and MFMUL have been specified Both MFMUL and MFDIV may positive or nega tive use this fact to control the resulting direction of shaft motion Overly large ratio gains are flagged by the firmware setting the system flag Bd and may be unstable The error flag Bd will be set by MFR if the magnitude of MFMUL MFDIV is 256 or greater MFR does NOT reset Bd if already set by a prior pro cedure MFR followed by G will immediately turn on the servo and reset any position error The servo off flag Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 would immediately cause a position error upon a single count of output motion being requested The motion is also subject to the cur rently defined activity of the limit switches The fractional ratio is accurate
298. rupted You should not run the program in the SmartMotor This can occur if communications connection was lost or corrupted during a download of a program Bk is reset to zero by a power reset Z and a valid pass checksum is detected via RCKS RCKS scans the entire program including header and returns two 6 bit checksums fol lowed by a P pass or F fail at the end If RCKS reports a failure Bk is set to 1 RCKS sends its value through the primary serial port EXAMPLE commands issued and responses from terminal screen RCKS 000049 0025E0 P RBk 0 The VST command also has the capability to set Bk to 1 VST performs a read operation after every byte it writes to the User Data EEPROM if the read byte is not the same as what was sent the flag Bk is set to 1 49 Related Commands Bm Bp Br LIMH LIML LIMD LIMN RS RPW RW UCI UCP UCO UDI UDM UDO SLE SLD SLP SLN ZI ZS BI Historical Left Limit Status Bit APPLICATION Monitor left limit switch DESCRIPTION Left limit latch EXECUTION Historical sampled each PID update until latched CONDITIONAL TO LIMH LIML UDI UDO UDM LIMITATIONS None REPORT COMMAND RBI RS bit 2 RW bit 2 RPW bit 2 READ WRITE Read only Reset by ZI ZS RS RW RPW assignment or printing of S LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES Oor1 VALUE BY STATE 0 Left negative limit has not been active
299. s While in Sleep Mode a SmartMotor will continue to echo if in ECHO mode all characters received over the network but will ignore all commands other than a WAKE command A sleeping SmartMotor will also ignore a G line input go request but will be responsive to other input s dedicated func tions The most common use of the SLEEP command is to keep daisy chained SmartMotors from responding to commands in a program which is being downloaded to another SmartMotor in the same chain If a program is running when a SmartMotor receives the SLEEP command the pro gram will continue to run Messages originating from within the running program of a sleeping SmartMotor will be transmitted unless the motor is also in SILENT mode SLEEP may be issued from the terminal or within a user program SLEEP mode is terminated by the WAKE command 278 Related Command SLEEP WAKE WAKE1 SLEEP1 Ignore Incoming Commands on Secondary Port APPLICATION Serial communication control DESCRIPTION Motor prevented from executing channel 1 commands EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Illegal with a user program REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE WAKE state FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION The SLEEP1 command is used to put a SmartMotor into Sleep Mode with respect to channel 1 serial commands W
300. s are 2 1 0 1 and 2 a atl LOOP END EXAMPLE 3 Raw 101 sets Bs fails to report a value but instead emits a syntax error message if syntax reports active EXAMPLE 4 v 605 awl v sets Bs fails to report a value but instead emits a syntax error message If syntax reports active 211 Related Command N A APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS DETAILED DESCRIPTION RA Report Commanded Acceleration Report command Report buffered acceleration Immediate N A N A A N A N A Scaled encounter counts PID sample PID sample 2147483648 to 2147483647 2147483648 to 2147483647 0 ALL RA reports the signed value of the buffered acceleration to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT A index 1 3 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thus if RA is received through channel 0 the response is transmitted through channel 0 If RA is received through channel 1 the response is transmitted through channel 1 EXAMPLE V 3333 A 33 MV G A 444 RA use acceleration value
301. s corresponding I O pin That is regardless of whether the pin is being used as an input output or other function a 10 bit analog reading of I O that pin is always available EXAMPLE PRINT 13 PRINT UAA UAA b UAA PRINT 13 REPORT UAA Rb RUAA Directly Report Port A Analog Value gt 4 76 firmware only 293 Related Command UA UAA UAO UAI as command Set I O Port A to Input APPLICATION I O control DESCRIPTION Set Pin A to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line A serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input secondary encoder input A or the step input in Step and Direction Mode While user I O line A defaults to being a general purpose TTL input it can be explicitly set up as a digital input with the UAI command If I O line A has been set to an output with the command UAO it can be reset to be an input with the command UAI EXAMPLE UAI Initialize U ser defined I O pin A as I nput PRINT 13 PIN A Input UAT n UAI Store state of I O pin A as digital input into variable name n PRINT 13 REPORT PIN A Input Rn END 294 Related Command UA UAA UAO UAI as input value Read I O Port A
302. s to properly perform a cam profile a BASE SIZE and DATA table BASE specifies the number of encoder counts that the master turns through one cycle while the slaved camming SmartMotor moves through the points in its data table SIZE is the number of points in the data table In the example given below the camming SmartMotor moves from zero to 120 encoder counts in the positive direction and then back to the zero for every 2000 counts of the master encoder If the master encoder moves at a constant velocity in the posi tive direction this camming profile will continue to repeat for as long as the master encoder continues to move Since the profile completes every 2000 counts of the master encoder the BASE is 2000 The Units are actual encoder counts that are seen at the SmartMotors external encoder input User ports A and B This is the same external encoder input that can be read through the counter function CTR BASE is a parameter required to control Cam Mode motion In Cam Mode each value of the external encoder defines a required corresponding SmartMotor position Cams typically define a periodic motion profile or trajectory BASE defines the number of encoder counts through the external Cam moves before the required position map ping or required motion is exactly repeated Suppose BASE 10000 encoder counts and the suppose the required Smart position is to be 100 when the external encoder CTR reports a value of 2506 then SmartMot
303. see example below LIMITATIONS None REPORT COMMAND RCTR READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION By Default CTR contains the present value for the secondary encoder or Step and Direction signals ENCO and ENC1 determine whether the internal or external inputs are primary or secondary ENCO is the default state This means that the internal encoder will be the primary encoder and Ports A and B will be the source for Phase A and B or Step and Direction of an external source Under this condition CTR will contain the position or count value for Ports A and B Unlike using O expression for the internal encoder counter CTR cannot be set to any specific value It can only be set to zero If you issue MSO MFO MF1 MF2 or MF4 CTR will be set to zero and Ports A and B will be set to receive phase A and B of a standard quadrature encoder If the external encoder changes position RCTR will report that value If you issue ENC1 CTR will be set to zero and the sources of CTR and P will swap Now CTR will reflect internal encoder position and P will reflect external encoder position If you issue ENCO the sources will swap back to default and again CTR will follow the external encoder MFO and MSO will both set CTR to Zero without changing the mode of o
304. ser debug output page with pause a 10000000 program parameter O a set axis origin MP set buffered motion mode to Mode Position V 4000 se buffered maximum velocity A 100 set buffered acceleration P a set buffered target position b 50 loop counter c 0 data set counter GOSUB10 call debug routine G WHILE b while b gt 0 GOSUB10 emit data set IF Bt exit if trajectory done BREAK ENDIF b b 1 decrement loop index LOOP GOSUB10 emit final data set END program terminate C10 c ctl1 increment data set counter NOTE PRINT 13 PRINT 13 13 DATA SET RC PRINT 13 Value of a PRINT 13 Value of b PRINT 13 Position RP PRINT Velocity RV PRINT Acceleration RA PRINT Position Error RPE wait for RETURN sends a carriage return ENT ER from SMI terminal 11 Related Commands Carriage Return Single Space Character Single Space Delimiter and String Terminator APPLICATION Program flow control DESCRIPTION Single spaces placed between a series of user variables or commands EXECUTION Immediate FIRMWARE VERSIONS All DETAILED DESCRIPTION CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS Serial communications channel data A single space character may be placed between a series of user commands in a single ASCII string as delimiter I
305. sions and conditional testing UNITS Signed 32 bit Integer RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher Versions prior to 4 00 have 10 variables a j DETAILED DESCRIPTION The SmartMotor has three groups of pre defined user variables The first group consists of the variables a through z They are general purpose Read Write 32 bit signed integer variables that can be reported and used on either side of an equal sign in an equation The variables a thru z are stored in Dynamic RAM meaning Their values are lost when power is lost The value of any variable a through z variable is reported with the R PRINT or PRINT1 functions EXAMPLE Rg Report the value of g to the primary serial port PRINT g 9 13 Print to the primary serial port PRINT1 g g 13 Print to the secondary serial port All 32 bit signed integer variables are limited to integer values between 2147483648 to 2147483647 Math operations that result in decimal values are truncated or round ed down If you assign or perform an operation that would normally result in a value outside of this range the variable will wrap or take on the corresponding modulo As an example because of this 2147483647 1 2147483648 The result wrapped around to the negative extreme 19 Related Commands aa ZZZ alfindex aw index ab index SEE APPENDIX C
306. sspellings of commands but the improper use of vari ables are also flagged For example trying to access the array element aw 20000 will also produce a syntax error If this is the case the command that contains the syntax error is ignored Some errors may appear to be valid syntax and require other means to detect To more fully protect against ASCII input stream errors one can use RCKS RCS and RCS1 commands as well as checking for framing and parity errors EXAMPLES Suppose host transmitted A 100 but A 101 is received due to noise Bs would not be set but Bb might be Suppose host should have transmitted A 100 but actually transmitted A L00 Bs would be set but Bb would not be Note ResponsestorequestsforvaluesinvariablesorotherwisemaycausetheBsbittobeset in any downstream motors on an RS 232 bus or any other motor on a parallel RS 485 bus Thereason for this is because a value anumber in and ofitselfis nota valid SmartMotor command and as a result the other motors seeing that response will flag their Bs Bit Example Issue RP to Motor 1 in a 3 motor system when Motor 1 responds with it s position in the form of just an integer number that number in and of itself is not seen as valid command syntax 57 Related Commands BRKTRJ G OFF Bt Trajectory In Progress Status Bit APPLICATION Monitor Trajectory DESCRIPTION Trajectory in progress state flag EXECUTION Updated each PID sample CONDITIONAL TO Tra
307. ssue OFF and T expression before the MT command APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE RT Report Commanded Torque Value Report command Report torque request Immediate N A N A T N A N A Encoder counts 1023 to 1023 1000 to 1000 1000 FIRMWARE VERSIONS lt v4 95 DETAILED DESCRIPTION RT reports the value of the mode torque output value T No leading zeros are transmitted and it is fol command is PRINT T lowed by an ASCII carriage return The equivalent PRINT 13 EXAMPLE this demonstrates the Severe Warning label in the margin Test only with open shaft setting torque value set torque mode wait about 1 second VALUE T 33 MT WAIT 4000 PRINT TORQE RT report MD50 use an control mode torque requested alog voltage input to control torque Potentiometer placed on I O pin A tes to t 1023 V equates to T 1023 VALUE RT Voltage of OV equa and 5 WAIT 4000 PRINT TORQE WAIT 4000 MT PRINT ISSUED WAIT 4000 T 33 Effect torque request of 33 has been destroyed MT 263 Related Command END RUN RUN Start Re Start Program Execution APPLICATION Program execution control DESCRIPTION Execute user EPPROM program beginning at initial command EXECUTION Immediate COND
308. ssued RKV Report present buffered KV 254 Related Command P E P RP Report Real Time Position APPLICATION Report command DESCRIPTION Report current position EXECUTION Next PID sample CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE P READ WRITE N A LANGUAGE ACCESS N A UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES 2147483648 to 2147483647 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION RP is the fundamental command to position data RP reports the real time value of the primary encoder counter P No leading zeros are transmitted and it is followed by an ASCII carriage return The equivalent PRINT command is PRINT P 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 Do not confuse RP with PRINT P RP returns the present position whereas PRINT P returns the latest P expression buffered requested absolute target position value Notice also ENC1 changes the encoder position signal source from the default internal encoder to the external encoder inputs RP Report present shaft position 255 Related Command E G PE RPE Report Real Time Position Error
309. start position move RMODE RESPONSE is P 167 Related Command CTR MC MC2 MC4 MC8 MFO MF1 MF2 MS MF 4 Enable Mode Follow Full Quadrature APPLICATION Motion mode control DESCRIPTION Mode Follow 1 external counts per 1 count of shaft motion EXECUTION Immediate CONDITIONAL TO External encoder inputs present LIMITATIONS Do not issue MFO while in mode MF4 REPORT COMMAND RMODE READ WRITE Associated external encoder is read only LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS All except 4 40 series DETAILED DESCRIPTION MF4 causes the SmartMotor to instantly and precisely follow a second external encoder signal from input pins A and B resetting the external encoder CTR value to zero For each 4 external encoder counts in the same direction received by the SmartMotor the motor shaft will be requested to follow moving 1 internal encoder count in the same direction Velocity and acceleration feed forward gains are not computed during this mode Issuing any other mode such as MT or MP followed by G will take the SmartMotor out of this following behavior MF4 instantly turns on the servo and resets any position error The servo off flag Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 will immediately cause a posi
310. sts The set point is in hardware and depends on the model motor and drive stage If the set point is reached the system flag Ba is to 1 Once an over current has been detected the SmartMotor will shut the amplifier off for several servo samples in attempt to reduce the peak load and then turn back on to try to com plete its commanded motion If the position error exceeds the allowable following error E during the off state the servo will get a Following Error Be status Bit The Ba bit is not reset until either a power reset a Z ZS or Za command is issued Note in non PLS firmware motors a G will reset the Ba bit If Ba flag is regularly found to be set there may be a problem This typically indicated that the motor is undersized in the peak range Please verify the motor is correctly sized for the presently assigned task IF the Ba bit is set every machine cycle try lowering acceleration If it is still set very cycle there could be a large moment of inertia mismatch The AMPS command has no effect on the Ba bit It only effects continuous current not peak current EXAMPLE sub component of system check routine IF Ba If Peak over Current is detected PRINT OVER CURRENT Tinftorm host Za clear over current state latch ENDIF 38 Related Commands CHN CHNO CHN1 OCHN Z Zb ZS Bb Parity Error Status Bit APPLICATION Monitor Serial Communications DESCRIPTION Serial communications parity e
311. sum was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT Bk 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE RCKS RBk reporting value If 1 then the stored program is bad 223 Related Command Bm RS RW S Z ZS RBI Report Real Time Left Over Travel Limit State APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES STATE VALUE 1 STATE VALUE 0 Report command Report Left Limit State Latch Updated each PID sample LIML LIMH UDM N A BI N A N A Binary state 0to1 Left limit switch has been active Left limit switch has not been active FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBI reports the value of the historical left limit flag BI It returns a 1 if an active left limit input was detected and a 0 if not It is followed by an ASCII carriage return The equivalent PRINT command is PRINT BI 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and n
312. t can be accessed with the statement variable UBI PRINT UBI 13 or WHILE UBI LOOP The digital read occurs once at the time the UBI command is executed Assigning the variable a UBI will perform the digital read once and store it into the variable a If I O line B has been set to an output with the command UBO it can be reset to be an input with the command UBI EXAMPLE UBL Initialize U ser defined I O pin B as I nput PRINT 13 PIN B Input UBT n UBI Store state of I O pin B as digital input into variable name n PRINT 13 REPORT PIN B Input Rn END RUB Directly Report Port B logic State gt 4 76 firmware only n U amp 2 Bitmask Port B to the variable n gt 4 76 firmware only Rn Report Result 300 Related Command UB UBA UBI UBO as command Set I O Port B to Output APPLICATION I O control DESCRIPTION Set Pin B to be an output EXECUTION Immediate CONDITIONAL TO UB 0 or UB 1 LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line B can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input The command UBO specifies the I O pin B as an output while UB value sets the voltage I O pin B will be a logic high voltage if UB 1 and a logic low voltage if UB 0 Regardless of wheth
313. t Travel Limit Flag APPLICATION Program execution control DESCRIPTION Reset historical right limit latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBr READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DE SCRIPTION Zr resets system flag Br the right limit latch to zero If you use Br to detect the activa tion of the right limit be sure to reset it with Zr before scanning for the bit again EXAMPLE IF Br ENDIF Test flag PRINT Right Limit Latched Zr Reset flag 351 Related Command Bs RBs Zs Reset Command Syntax Error Flag APPLICATION Program execution control DESCRIPTION Reset command scan error latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBs READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 DETAILED DESCRIPTION and higher Zs resets system flag Bs the syntax or index access error latch to zero The RBs report and ZS commands may assist in discovering whether or not the present firm ware version recognizes what appears to be a perfectly valid command and data packet EXAMPLE IF Bs PRINT Syntax Zs ENDIF Test flag Error Reset flag 352 Related Command Bu RBu Zu
314. t equal zero common shortcut to IF a 1 All above examples must be True to allow code beginning below the IF command to run If they are not true the code execution will jump down to the nearest ELSE ELSEIF or ENDIF and continue from there 136 Related Commands ELSE ELSEIF ENDIF IF expression continued Conditional Program Code Execution Example 1 Simple case of IF true run some code IF P gt 12345 If Position is above 12345 PRINT position is greater than 12345 13 ENDIF This is the next line of code to b xecuted whether it is true or not Example 2 If true run some code ELSE if false run some other code IF P gt 12345 Tf Position is above 12345 PRINT position is greater than 12345 13 ELSE If it is no true PRINT position is not greater than 12345 13 ENDIF This is the next line of code to b xecuted Example 3 If true run some code else if something else is true IF P gt 12345 If Position is above 12345 PRINT position is greater than 12345 13 ELSEIF P Tf Position equals zero PRINT position is at zero 13 ENDIF This is the next line of code to b xecuted even if position is not at zero and not greater than 12345 Example 4 Test for two conditions and default to another line of code IF P gt 100 Tf Position is above 100 PRINT position is greater than 100 13 ELSEIF P lt
315. t is active and motion is commanded in the negative direction motion will be allowed Note LIMD behavior is applicable to all modes of operation 149 Related Command LIMD LIML LIMN UCP UDM LIMH Travel Limits Active High APPLICATION Travel Limit Switch Control DESCRIPTION Limits are active high to stop motion EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT PROPERTY Limits are active low FIRMWARE VERSIONS 4 15 and 4 40 not available in PLS firmware DETAILED DESCRIPTION The limit switches are associated with the I O C and I O D pins Following a power up or reset the Z command the limit inputs are active LOW by default This means if the logic state goes low the motor will stop LIMH defines the limit inputs to be active HIGH This means if the logic state level goes high the motor will stop NOTE The limit input pins have 5K Ohm pull ups meaning they are seen as logic high when there is no connection to them LIML defines them back to active low Associated with the limit switches are the system flags Hardware Travel Limit Overview Status Bits OE Command to ee to Disable nable EE Plus Minus ES EEE Historical Bit Travel Limit Input Travel Limit Input EE A Note PLS firmware defaults to LIMH with no option to change it Please consult PLS firmware d
316. t the only the data values are stored or loaded The association of these values to any variable is not retained The only way to retrieve this data is by keeping track of the EPTR value If the data memory access is out of range the scan error flag Bs will be set EXAMPLES Storing and retrieving a single 32 bit standard variable a 123456778 assign a value to the variable a EPTR 100 Set EPROM pointer to 100 VST a 1 Store into EPROM EPTR incremental to 104 automatically EPTR 100 Set Eprom to 100 again VLD b 1 Load from location 100 into the variable bp Rb Report result will be 123456789 333 Related Command Bk EPTR RBk VST I ve left the strikethroughs intact assume there ll be something to replace them or they ll go away eventually Ernie VLD variable number continued data EEPROM READ WRITE COMMAND Storing and retrieving a single 16 bit standard variable aw 0 32000 assign a value to EPTR 100 Set Eprom pointer VST aw 0 1 Store into EPROM EPTR 100 Set Eprom to 100 VLD x 1 Load from locatio RX Report result wil the 16 bit array w ra 0 to 100 EPTR incremental to 102 automatically again n 100 into the variable x l be 32000 Storing and retrieving a single 8 bit standard variable ab 0 126 assign a value to EPTR 100 Set Eprom pointer VST aw 0 1 Store into EPROM EPTR 100 Set Eprom to 100 VLD x 1 Lo
317. tMotor will interpret this to be a sudden change in the master encoder input from its prior value to 0 Continued on next page 164 MFO continued Enable Quadrature Input Counter Mode Related aiii EXAMPLE This example will print to the main channel RCTR CTR b 4 ob high for initial print cL Switch watch routine MF1 a CTR amp 3 a will recycle 0 3 IF a b See if new a MF2 PRINT SELECT a 13 b a Update b no re prnt MF4 ENDIF IF UGI Look for button GOSUB20 Sub to use a ENDIF GOTO1 Infinite loop 165 Related Command CTR MC MC2 MC4 MC8 MFO MF2 MF4 MS For other ratios and fractional relationships see Mode Follow with Ratio MFR MF1 Enable Mode Follow Raw Resolution APPLICATION Motion mode control DESCRIPTION Mode Follow 4 external counts per 1 count of shaft motion EXECUTION Immediate CONDITIONAL TO External encoder inputs present LIMITATIONS Do not issue MFO while in mode MF1 REPORT COMMAND RMODE READ WRITE Associated external encoder is read only LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT MODE MP FIRMWARE VERSIONS All except 4 40 series DETAILED DESCRIPTION MF1 causes the SmartMotor to instantly and precisely follow a second external encoder signal from input pins A and B resetting the external encoder CTR value to zero For each 4 external encoder counts in the same direction received by
318. ted only up to six deep Asubroutine may call itself which is called recursion but is highly discouraged because it can lead to a stack overflow or nest ing limit A counter conditional test or some other scheme can prevent exceeding the nesting limit The STACK control flow command explicitly and deliberately destroys the RETURN address history Thus if you issue STACK take care that the program execution does not encounter a RETURN before the next GOSUB The GOSUB command is valid from both the serial channels and within the a user program Do not however issue GOSUB number unless the corresponding C number label exists within the stored program Otherwise you willg et a memory pointing error Note If an attempt to issue a nonexistent GOSUB call is done via serial port the motor will respond with which basically means a memory error 131 Related Command C number GOTO number STACK EXAMPLE GOSUB20 GOSUB21 a 3 GOSUB25 END c20 GOSUB30 PRINT 20 13 RETURN C21 GOSUB30 PRINT 21 13 RETURN C25 PRINT 252 a a a 1 IF a RETURN ENDIF GOSUB25 RETURN c30 GOSUB number continued Subroutine Call run subro run subro yun SsubrO End nes utine 20 utine 20 utine 20 code execution ted subroutine nested subroutine recursive subroutine normal subroutine PRINT 13 Subroutine Call RETURN The output will be as follo
319. ter 140 Related Commands KA KD KI KL KP KS KV KG expression PID Gravity Compensation APPLICATION PID filter control DESCRIPTION Gravitational gain EXECUTION Buffered pending an F command CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RKG READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS N A RANGE OF VALUES 8388608 to 8388607 TYPICAL VALUES 0 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION KG sets the gravity compensation term of the PID filter Simple PID filters are ill equipped where a constant force is asserted on the system An example of such a constant force is that induced by gravity acting on a vertically moving axis The KG term exists to offset the PID filter output in a way that removes the effect of such constant forces The best way to set KG is to turn KP and KI to zero and servo in place The load will want to fall but hold it in place Issue increasingly positive or increas ingly negative KG parameters until the load barely holds Record that value and continue increasing the parameter until the load starts to go up Now record this value The optimum KG value is the average of these two Valid values for KG are integers from 8388608 to 8388607 As a result you may not see much of an effect until KG is greater than one million in magnitude However extremely higher magnitudes values risks rapid pulse width modula
320. testing UNITS N A RANGE OF VALUES 0 to 255 TYPICAL VALUES 1 DEFAULT VALUE 1 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The KS term of the extended PID filter will sometimes allow the SmartMotor to handle inertial ratios in excess of the traditional 5 1 or 10 1 This reflected load to rotor inertia ratio is often sighted as a traditional limit for dependable servo motor applica tion The KS term represents the number of sample periods used to form the integra tion of the KD term By raising the KS value beyond one a latency is developed within the response vector of the PID equation s differential element Since this reduces the rate at which the current error switches sign it allows the motor to apply its available torque more decisively This is also useful in situations where the mechanical time constant of the motor load system is longer than the PID period by several orders of magnitude Such systems can be very difficult to stabilize with a traditional PID filter If your application has an inertial ratio of greater than 5 1 experiment with raising KS above 1 Your ear will provide a good method of judgment listen for a range KS values which provide relaxed but decisive motor response across the velocity and acceleration regions required by your application PRINT KS 13 and RKS both report the value of KS through the primary serial port while PRINT1 KS 13 sends it out channel 1 KS is valid with any expression and
321. the SmartMotor the motor shaft will be requested to follow moving 1 internal encoder count in the same direction Velocity and acceleration feed forward gains are not computed during this mode Issuing any other mode such as MT or MP followed by G will take the SmartMotor out of this following behavior MF instantly turns on the servo and resets any position error The servo off flag Bo is set to 0 the trajectory flag Bt is set to 1 and the position error flag Be is reset to 0 The motion is restricted by the present E value Issuing E 0 will immediately cause a position error after 4 encoder counts in the same direction are received from the external encoder The motion is also subject to the currently defined activity of the limit switches EXAMPLE MF1 Reset CTR and Set follow mode RMODE RESPONSE is FE WAIT 100000 Follow for a while MP Revert to position mode P 0 Set destination for home A 100 Set acceleration V 537 1000 Set velocity G Terminate following start position move RMODE RESPONSE is P 166 Related Command CTR MC MC2 MC4 MC8 MFO MF1 MF4 Ms For other ratios and fractional relationships see Mode Follow with Ratio MFR MF2 Enable Mode Follow Half Quadrature APPLICATION Motion mode control DESCRIPTION Mode Follow 2 external counts per 1 count of shaft motion EXECUTION Immediate CONDITIONAL TO External encoder inputs present LIMITATIONS Do not
322. the ASCII bytes received by channel 0 serial channel RCS resets the channel 0 checksum to zero after reporting the current value See the ASCII Table in the appendix to map character to ASCII value There is no CS command or function It cannot be printed or assign to a variable In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port Thatis if the report command is received through channel 0 the response is sent through channel 0 If the report command is received through channel 1 the response goes out channel 1 EXAMPLE using the SMI terminal screen First noting ASCII Space 32 ASCII A 65 ASCII 1 49 ASCII C 67 ASCII 2 50 ASCII R 82 ASCII 3 51 ASCII S 83 ASCII is 61 and SMI issues a space following a command Z RCS response is 8 Mod 8 82 67 83 32 264 256 8 A 112 RCS response is 58 Mod 8 65 61 49 49 50 32 82 67 834 32 570 512 58 A 113 RCS response is 59 which is as expected one more than before 240 Related Command RCS RCS1 Report Secondary Serial Port Checksum APPLICATION Report command DESCRIPTION Report channel 1 serial receive checksum EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Checksum for channel 0 since prior RCS1 READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 0 to 255 TYPICAL VALUES 0 to 255 DEFAULT VALUE
323. through the UEA function In order for the output voltage to reflect the state of UE both UEO and UE value have to be issued Suppose the I O pin is functioning as a digital input If you want to output a logic low signal the pin will not sink current until both UEO and UE 0 have been issued You only have to issue UEO once the I O pin stays configured as an output for some other configuration specification is issued EXAMPLE set PIN E as output and recall output latch value UEO define PIN E output UE set output latch value PRINT UEO recall the latch value response is 1 UE set output latch value PRINT UEO recall the latch value response is 0 318 Related Command UFA UFI UFO UF expression Set I O Port F Output Logic State APPLICATION I O control DESCRIPTION Set Pin F output latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS Assignment only UNITS Binary bit RANGE OF VALUES 0or1 TYPICAL VALUES 0or1 DEFAULT VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line F can function as a TTL output The pin defaults to be a general purpose TTL 0 5 volt input To use PIN F as an output set the value of the pin F output latch UF to either 0 or 1 Issue the command UFO if this has not already been issued I O pin F will be a logic high voltage if UF 1 and a logic low voltage if UF 0
324. tically run every time the motor is turned on To prevent this make RUN the first program statement of the user program or place RUN anywhere in the program When RUN is encountered the program interpreter execution machine recalls whether or not the RUN command was previously issued and if RUN was not issued program execution ceases This is similar to to encountering an END statement except that a subsequent RUN command causes the program to take up after the RUN state ment RUN does not terminate the present motion mode or trajectory change motion parameters such as E A V and KP or alter the present value of the user vari ables RUN may be issued externally through the serial channel It can distinguish motors which have suffered a power reset or software reset Z from those motors in a daisy chain which have not performed a reset EXAMPLE GOSUB1 always execute subroutine 1 upon any reset GOSUB2 always execute subroutine 2 upon any reset PRINT Type RUN to start 13 Prompt user for RUN command RUN Halt program execution until RUN command is received GOSUB3 conditionally execute subroutine 3 END 266 Related Command V V RV Report Current Trajectory Velocity APPLICATION Report command DESCRIPTION Report current velocity EXECUTION Next PID sample CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE V READ WRITE N A LANGUAGE ACCESS N A UNITS Scaled encoder counts samp
325. tion Error Bit will be set to 1 All closed loop modes are bound by this E value Non closed loop modes such as Torque Mode ignore the value of E The amount of Position Error is always proportional to the difference between com manded torque and load torque The higher the commanded speed the higher the position error will be High Accelerations can lead to short duration high spikes in position error The value for E should always be high enough to allow for acceleration and declaration ramps It may be necessary to increase tuning gains to keep position error within reasonable limits for good dynamic operation EXAMPLE E 1234 set maximum allowable error to 1234 If the motor dynamically ever exceeds 1234 it fault on Position error immediately 103 Related Commands ECHO1 ECHO_OFF ECHO_OFF1 ECHO Echo Incoming RS 232 Data APPLICATION Serial communications control DESCRIPTION Motor echoes received channel 0 serial EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Applies to Channel 0 Primary Com Port REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE Motor defaults to ECHO_OFF non echo FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The ECHO command causes the SmartMotor to re transmit or echo out all serial bytes on the transmit line that were received on the receive line of the primary comm port This retransmissi
326. tion error after 4 encoder counts in the same direction are received from the external encoder The motion is also subject to the currently defined activity of the limit switches EXAMPLE MF4 Reset CTR and Set follow mode RMODE RESPONSE is P WAIT 100000 Follow for a while MP Revert to position mode A 100 Set acceleration V 537 1000 Set velocity P 0 Set destination for home G Terminate following start position move RMODE RESPONSE is P 168 Related Command Bd CTR MF1 MF2 MF4 MFR MFMUL APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS than 256 REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALUE FIRMWARE VERSIONS MFDIV Set Mode Follow Divisor Mode follow control Mode follow external encoder with ratio MFMUL MFDIV Buffered pending a G D MFMUL MF1 MF2 MF4 V Magnitude of ratio MFMUL MFDIV must be less N A Write only Assignment expressions and conditional testing Number 32768 to 332767 5 lt MFMUL MFDIV lt 5 N A 4 00 and higher DETAILED DESCRIPTION The ratio MFMUL MFDIV specifies the gain for Mode Follow with Ratio MRF To use MFR you will need to define the specific relationship ratio of the encoder count input to outgoing requested encoder counts of motion The command MFR must be issued after both MFMUL and MFDIV have been set Both MFMUL and MFDIV may posit
327. tional testing UNITS Fraction of available torque RANGE OF VALUES 1023 to 1023 TYPICAL VALUES 1000 and 1000 DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION Command MT enables torque mode In this mode the motor is commanded to develop a specific power level set by T expression T is in units of Tenths of Percent of the full capacity of the subject motor and takes values between 1023 and 1023 T 1023 results in full torque in the negative direction The encoder still tracks position and can still be read with the P variable but the PID loop is off and the motor is not servoing or running a trajectory MT sets the PWM signal to the drive to a fixed percentage which means that the amplifier tries to deliver a fixed amount of power to the motor coils For any given torque and no applied load there will be a velocity at which the back EMF of the motor will cause the acceleration to stop and the velocity to hold more or less constant Under the no load or static load conditions the T command will control velocity As the load torque increases the velocity decreases Note This means that MT does not regulate torque Instead it delivers a fixed amount of power to the motor coils As motor power is the product of torque and RPM velocity decreases as the delivered torque increases and vice versa In all firmware 4 76 MT will immediately turn on the servo and reset any position error The servo off flag Bo is set to 0
328. to version 4 00 only total of 6 WHILE and GOSUB permitted at any one time Version 4 00 supports up to 6 GOSUBS permitted at any one time REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The RETURN command is used to terminate a subroutine within a user program Upon execution of the RETURN program execution takes up immediately after the GOSUB that invoked the subroutine call RETURN is normally executed from within the user program but with care the HOST terminal may also be used to issue a RETURN instruction The RETURN program locations are stored in memory called a stack The stack depth is 6 Do not use more than 6 nested subroutines if the the stack overflows the program may will crash EXAMPLE PRINT WAIT FOR HOST TERMINAL COMMANDS 13 GOSUB10 start of subroutine 10 PRINT PROGRAM RECEIVED EXTERNAL RETURN END c10 start of subroutine 10 WHILE 1 wait for terminal commands WAIT 100 report terminal errors IF Bs PRINT 13 SCAN ERROR 13 Zs ENDIF LOOP RETURN return to line just below GOSUB10 command 246 Related Command Bi Bx l Rbi RBx APPLICATION DESCRIPTION EXECUTION CONDITION LIMITATION AL TO S REPORT VALUE READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT VALU
329. tor 4 Issue RCKS command 5 If it does not match the stored checksum number Open the smx file Issue the LOAD command Start sending down all characters in the smx file from beginning to end When the last character is read from the file and sent to the motor then send2 two hexFF characters to the motor 6 Issue RCKS command again If it comas back with the stored string with the P at the end then the download was successful 7 Issue RUN to see if it works as expected Reasons for unsuccessful download a Noise on serial port b Loss of connection during download c Failure to send the two hexFF s before power down d The SMX file as SMI compiled it was altered in some way Note If you were to open an SMX file in NotePad to look at it and then save it Notepad will automatically add carriage return characters at the end of each line it sees The resultant file will not work Each carriage return would have to be stripped back out prior to download So do not alter the smx file in any way from how SMI generated it 154 Related Command UP UPLOAD NOTE For motors with a plug in Memory Module Once LOCKP has been invoked the Memory Module EEPROM cannot be unlocked and the module must be replaced to return to an unlocked condition LOCKP Prevent User Program Upload APPLICATION User program execution control DESCRIPTION Prevents effects of UP and UPLOAD EXECUTION N A CONDITIONAL TO N A
330. tput UA 0 set PIN A to logic 0 zero volts UA 1 set PIN A to logic 1 5 volts Note The I O state can be set prior to assigning as an output UA 0 Pre set PIN A to logic 0 zero volts UAO set PIN A as an output pre initialized to zero 292 Related Command UA UAI UAO UAA Read I O Port A as Analog Input APPLICATION I O control DESCRIPTION Read PIN A analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UAA READ WRITE Read only LANGUAGE ACCESS Expression and conditional testing UNITS Number RANGE OF VALUES 0 to 1023 TYPICAL VALUES 0 to 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line A can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UAA is read only and can be accessed with the state ment variable UAA PRINT UAA 13 or WHILE UAA gt 200 LOOP The analog read occurs once at the time the UAA command is executed Assigning the variable a UAA will perform the analog read once and store it into the variable a All user I O pins have in internal 5K pull up resistor as well as current limiting and other protection mechanisms Any analog voltage source then should be rated to adequately drive a 5K ohm input impedance The analog to digital conversion is always available on it
331. tput of an OPTO 1 on Address A x DINAO Fist read state of the outputs DOUTAO x 4 Set 3rd bit to 1 DOUTAO x amp 251 Set 3rd bit to 0 102 Related Commands G MP MV E expression Set Allowable Position Error APPLICATION Position Error Handling DESCRIPTION Maximum Allowable Following Error EXECUTION Immediate Enforced each PID sample CONDITIONAL TO Trajectory in progress LIMITATIONS Torque mode has no position error REPORT COMMAND RE READ WRITE Read and Write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 0 to 8388607 23 Bit UNSIGNED Value TYPICAL VALUES 1000 DEFAULT VALUE 1000 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The E command is used to set the maximum allowable Position Error in encoder counts Position Error is the difference between the desired position at any instant in time and the actual position The SmartMotor uses the position error to generate a torque by means of the PID filter The more the error or deflection the more torque the motor applies in attempt to correct E is primarily used as a safety measure a programmable allowable error beyond which the motor recognizes it is outside of the domain of control you wish to enforce If E 100 is command and a position error of greater than 100 encoder counts occurs the motor will be turned off When the motor is turned off the Bo Motor Off Bit is set to 1 and the Be Posi
332. transmitted through channel 1 EXAMPLE O 0 Set current position to zero A 100 Set acceleration V 50000 Set velocity P 100000000 Set target position E 1000 default position error limit MP Set to position mode G Go and begin buffered move WATT 40000 Wait abut 10 seconds E 0 Force a position error by setting allowable limit to zero WAIT 10 Wait ten servo samples RBe response is 1 T 111 MT position error reset by mode change RPE report position error limit response is 0 RBe report position error bit response is 0 219 Related Command OCHN RCHN RCHNO RCHN1 Z Zf ZS Note a syntax error from the terminal causes RCHN to respond with value 4 but the value CHN assigned to an expression is still zero RBf Report Communications Framing Error Status Bit APPLICATION Report command DESCRIPTION Report system state flag communications framing error event latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT VALUE Bf READ WRITE N A LANGUAGE ACCESS NA UNITS Binary state RANGE OF VALUES 0 to1 STATE VALUE 1 channel 1 STATE VALUE 0 Parity error event occurred on either channel 0 or No communication parity error event has occurred FIRMWARE VERSIONS Versions 4 xx excluding HIRES Version 4 20 DETAILED DESCRIPTION RBf reports the value of the serial communications framing error flag Bf It returns a 1 if any framing error has been det
333. trol DESCRIPTION Relative move distance for position mode EXECUTION Buffered pending a G command CONDITIONAL TO Position mode See MFR command for alternate usage LIMITATIONS Encoder wrap around will produce a position error REPORT COMMAND RD READ WRITE Read write LANGUAGE ACCESS Assignment expressions and conditional testing UNITS Encoder counts RANGE OF VALUES 2147483648 to 2147483647 TYPICAL VALUES N A DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION D expression commands a relative distance move from the present position and will be repeated every time a G command is issued It is a signed value allowing a relative move in either direction If you command a D move while the motor shaft is moving its starting point will be the actual shaft position when the G command is executed In other words the D move will be relative to the reception of the G command on the fly This method will result in accumulating drift To avoid drift If you issue the command D 100 and then enter the G command ten times each after the previous move has completed you will travel a total of precisely 1000 counts regardless of any following error at the end of the previous moves The D move starts from where you are supposed to be regardless of the present position error avoiding the problem of position drift or accumulating errors over several relative moves In downloaded code you would use the TWAIT command prior to th
334. trol line While user I O line G defaults to being the active low hardware go it can be explicitly set up as a digital input with the UGI command If I O line G has been set to an output with the command UGO it can be reset to be an input with the command UGI EXAMPLE UGI Initialize U ser defined I O pin G as I nput PRINT 13 PIN E Input UGT n UGI Store state of I O pin G as digital input into variable name n PRINT 13 REPORT PIN G Input Rn END RUG Directly Report Port G logic State gt 4 76 firmware only n U amp 64 Bitmask Port G to the variable n gt 4 76 firmware only Rn Report Result 327 Related Command UG UGA UGO RS4 UGI as command Set I O Port G to Input APPLICATION I O control DESCRIPTION Set PIN G to be an input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT STATE Input FIRMWARE VERSIONS ALL DETAILED DESCRIPTION User I O line G serves many functions It can be a TTL 0 to 5V input TTL output 10 bit analog input the hardware go line and the primary port RS485 control line While user I O line G defaults to being the active low hardware go it can be explicitly set up as a digital input with the UGI command If I O line G has been set to an output with the command UGO it can be reset to be an input wit
335. tted data value The equivalent PRINT command is PRINT ab index 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Rab 23 is received through channel 0 the response is sent through channel 0 If Rab 23 is received through channel 1 the response goes out channel 1 The valid range of values of index is 0 to 200 Index may be expressed directly as a number a variable a z the sum of two a z variables or difference of two a Z variables There are no other combinations See Example 1 for clarification the example illustrates all legal index formats thus Rab 6 Rab t 6 and Rab g do not represent valid index references If you attempt to use a legal valid syntax but the actual index value is out of range system state flag Bs set to 1 and a syntax error message may be reported See Examples 3 and 4 The ab 0 to ab 200 variables represent signed 8 bit values assignment of larger values is handled by truncating any extra leading data bits The most significant bit is always considered to be a sign bit See Example 2 for results when ab index is assigned a value larger than 255 206 Related Command N A Rab index continued Report 8 Bit Array Data Value EXAMPLE 1 a 0 assign test values WHILE a lt 6 ab a a a atl LOOP p 2 q 3 u 1 v 5 PRINT ab 0
336. ttr t t 1 LOOP END output is 111 222 333 444 1111 336 Related Command TWAIT CLK PID WAIT expression Pause Program Flow for pre determined time APPLICATION Program execution control DESCRIPTION Suspends command execution for defined number of PID samples EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS PID samples RANGE OF VALUES 0 to 2147483647 TYPICAL VALUES 0 to 4000 DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The WAIT expression will pause program execution for a specified amount of time Time is measured in PID sample periods of which there are 4 069 per second by default Some firmware versions may have a different of PID rate please refer to the RSP command for details on how to query your SmartMotor for its PID sample period The number of PID sample periods per second can be changed with the PID commands for motors with version 4 00 or later firmware EXAMPLE pause program execution for a given period w 32552 use to set Wait time PIDI Default PID updates every servo sample WAIT w Wait time 8 seconds PID2 PID updates every 2 servo samples WAIT w Wait time 4 seconds PID4 PID updates every 4 servo samples WAIT w Wait time 2 seconds PID8 PID updates every 8 servo samples WAIT w Wait time 1 second PID1 Return to Default PID
337. u report al 4 PRINT al 5 Rall v report al 5 PRINT al 6 Ral vtu report al 6 END EXAMPLE 2 Ral 51 sets Bs fails to report a value but instead emits a syntax error message if syntax reports active EXAMPLE 3 H 222 al h sets Bs fails to report a value but instead emits a syntax error message if syntax reports active 209 Related Command N A Raw index Report 16 Bit Array Data Value APPLICATION Report command DESCRIPTION Report user variable aw index EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS Index range from 0 to 100 REPORT VALUE aw index READ WRITE N A LANGUAGE ACCESS N A UNITS Number RANGE OF VALUES 32768 to 32767 TYPICAL VALUES 32768 to 32767 DEFAULT VALUE 0 RELATED COMMANDS N A FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Raw index reports the signed value of the variable aw index to the primary serial channel A minus sign will precede negative values no leading zeros are transmitted and an ASCII carriage return terminates the transmitted data value The equivalent PRINT command is PRINT aw index 13 In versions 4 15 4 75 4 41 and later this has been changed to report through the current active serial channel and not just the primary port That is if Raw 23 is received through channel 0 the response is sent through channel 0 If Raw 23 is received through channel 1 the response goes out channel 1 The valid ra
338. ues are stored The association of these values to any variable is not retained The only way to retrieve this data is by keeping track of the EPTR value As each byte is written to the EEPROM is immediately verified by reading the EEPROM device If the byte read does not match the byte write the system bit Bk will be set to 1 If the data memory access is out of range the scan error flag Bs will be set EXAMPLES Storing and retrieving a single 32 bit standard variable a 123456778 assign a value to the variable a EPTR 100 Set EPROM pointer to 100 VST a 1 Store into EPROM EPTR incremental to 104 automatically EPTR 100 Set Eprom to 100 again VLD b 1 Load from location 100 into the variable b Rb Report result will be 123456789 335 Related Command Bk EPTR RBk VST VST variable number continued DATA EEPROM READ WRITE COMMAND Storing and retrieving a single 16 bit standard variable aw 0 32000 assign a value to the 16 bit array word 0 EPTR 100 Set Eprom pointer to 100 VST aw 0 1 Store into EPROM EPTR incremental to 102 automatically EPTR 100 Set Eprom to 100 again VLD x 1 Load from location 100 into the variable x RX Report result will be 32000 Storing and retrieving a single 8 bit standard variable ab 0 126 assign a value to the 8 bit array byte 0 EPTR 100 Set Eprom pointer to 100 VST aw 0 1 Store into EPROM EPTR inc
339. uous and repetitive resetting of the CPU and lock out the motor IF this does happen the Communications Lockup recovery tool may be used to regain access to the motor 343 Related Command Ba RBa Za Reset Peak Over Current Flag APPLICATION Program execution control DESCRIPTION Reset current limit violation latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND RBa READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A RESET VALUE 0 FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION Za resets the overcurrent error flag Ba to zero If the current violation still exists Ba will be set to 1 again In early firmware versions Ba was vallid only after being enabled by a Za or ZS com mand after the motion had started This proved cumbersome to users so enabling is not required in versions 4 15 4 41 4 75 and later If Ba flag is regularly found to be set there may be a problem Please verify the motor is correctly sized for the presently assigned task EXAMPLE IF Ba Test flag PRINT Over Current Za Reset flag ENDIF WAIT 4000 IF Ba Retest flag PRINT Over Current still in effect ENDIF 344 Related Command Bb RBb CHNO CHN1 Zb Reset Comms Parity Error Flag APPLICATION Program execution control DESCRIPTION Reset serial data parity violation latch EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS
340. urpose TTL 0 5 volt input To use PIN G as an output set the value of the pin G output latch UG to either 0 or 1 Issue the command UGO if this has not already been issued I O pin G will be a logic high voltage if UG 1 and a logic low voltage if UG 0 Regardless of whether the I O pin is being used as an input or output a 10 bit analog reading of that I O pin is always available through the UGA function GXAMPLE UGO set PIN G to function as a digital output UG 0 set PIN G to logic 0 zero volts UG 1 set PIN G to logic 1 5 volts Note The I O state can be set prior to assigning as an output UG 0 Pre set PIN G to logic 0 zero volts UGO set PIN G as an output pre initialized to zero 325 Related Command UG UGI UGO UGA as input value Read I O Port G As Analog Input APPLICATION I O control DESCRIPTION Read Pin G analog input EXECUTION Immediate CONDITIONAL TO N A LIMITATIONS N A REPORT COMMAND PRINT UGA READ WRITE Read only LANGUAGE ACCESS Expressions and conditional testing UNITS Number RANGE OF VALUES 0 or 1023 TYPICAL VALUES 0 or 1023 DEFAULT VALUE I O dependent FIRMWARE VERSIONS 4 00 and higher DETAILED DESCRIPTION User I O line G can serve as a 10 bit analog to digital input The A to D reference is 5VDC and the returned data is between 0 and 1023 A value of 0 corresponds to 0 volts and 1023 to 5 volts UGA is read only and can be accessed with the state ment variable U
341. ut is in contact high 0 4 00 and higher DETAILED DESCRIPTION Bx is the real time state of the index input level The Bx bit is set to a 1 ONLY while the motor is sitting on the index Be aware that the index marker is only one encoder count wide this function is mainly used to verify the exact position of the index For most other uses it is more efficient to use the functions Bi and I EXAMPLE Fast Index Find Report Bx MP set buffered velocity mode A 1000 set fast acceleration V 4000000 set fast velocity D 2100 set relative distance just beyond one shaft turn i I clear and arm index capture O 0 force change to position register G start fast move TWAIT wait till end of trajectory P I go back to index G start motion TWAIT wait until end of trajectory O 0 set origin at index IF Bx PRINT On Index Pulse 13 ENDIF 63 Related Commands MC MC2 MC4 MC8 SIZE aw index MF1 MF2 MF3 MF4 BASE Cam Mode Master Cycle Length APPLICATION CAM Mode Control DESCRIPTION Cycle period of Mode Cam encoder EXECUTION Immediate CONDITIONAL TO SIZE MC_ G being issued LIMITATIONS 2 lt BASE lt 32767 REPORT COMMAND N A READ WRITE Write only LANGUAGE ACCESS None UNITS Encoder counts RANGE OF VALUES 2 lt BASE lt 32767 TYPICAL VALUES User determined DEFAULT VALUE User determined FIRMWARE VERSIONS 4 12 and higher DETAILED DESCRIPTION CAM Mode requires three item
342. vo off when the brake is engaged or the motor could be driving against the brake and overheat See BRKSRV command APPLICATION DESCRIPTION EXECUTION CONDITIONAL TO LIMITATIONS REPORT COMMAND READ WRITE LANGUAGE ACCESS UNITS RANGE OF VALUES TYPICAL VALUES DEFAULT STATE FIRMWARE VERSIONS BRKRLS Brake Release Hardware brake control Release hardware break immediately Immediate and effective until otherwise commanded Hardware BRAKE required None N A N A N A N A N A N A Power on BRKSRV Power off 4 00 and higher brake engaged DETAILED DESCRIPTION SmartMotors may be purchased with optional internal zero backlash brakes used to hold a load for safety purposes They are Fail Safe Magnetic Clutch Disk Brakes When power is lost the brake engages The default with power on is to disengage the brake when ever the drive stage is turned on The brake takes between 3 and 5 milliseconds to actuate or release When BRKRLS is issued the brake is maintained energized allowing full shaft movement BRKRLS terminates BRKSRV mode BRKTRJ mode and BRKENG condition BRKENG OFF WAIT 4069 V 0 A 0 MP P P G BRKRLS Assuming motion has stopped or almost stopped Set buffered velocity Set buffered acceleration Set buffered mode Set Target position to current position Begin servo at current position Release disengage brak 70 Related Commands
343. w 24 aw 43 aw 7 The above is a perfectly valid equation taking aw 43 and aw 7 and stuffing the sum into aw 24 As signed 16 bit variables they are subject to the usual restrictions of signed digital words and values The first bit is always a sign bit They are limited to integer values between 32768 and 32767 Math operations that result in decimal values are trun cated or rounded down If you assign or perform an operation that would normally result in a value outside of this range the variable will wrap or take on the cor responding modulo As an example because of this 32767 1 32768 The result wrapped around to the negative extreme Bit Overflow Status Bd System Status bit e lf aw 1 a exceeds 32 signed bits the operation c aw 1 a will produce a wrong result No error flag is set f a aw 1 exceeds 32 signed bits the operation c a aw 1 will produce a wrong result No error flag is set e f a aw 1 exceeds 32 signed bits the operation c a aw 1 will produce a wrong result The system flag Bd will be set If one of these variables is used with a variable of another type it will be appropri ately converted In technical jargon the variable will be type cast For example in the equation where the variable on the left of the equal sign is an 8 bit one like ab 4 all variables will be converted to 8 bit values and then operated on Assigning the variable aw 27 al m directly stores the 16 least signific
344. ws Subroutine Call 20 Subroutine Call 21 2543 2542 2531 In the above program example you can issue GOSUB20 GOSUB21 GOSUB25 or GOSUB30 from the terminal as well 132 Related Command BREAK C number ELSE DEFAULT GOSUB number NOTE Extensive use of IF statements and GOTOs can quickly make your programs impossible to read or debug Learn to organize your code with one main loop using a GOTO and write the rest of the program with subroutines GOTO number Branch Program Flow to a Label APPLICATION Program execution control DESCRIPTION Branch program execution to statement C number EXECUTION Immediate CONDITIONAL TO C number previously defined LIMITATIONS GOTO0 to GOTO999 REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES N A TYPICAL VALUES N A DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The GOTO Number command unconditionally redirects program execution control to another part of the program marked by the label C Number The GOTO Number command is valid from both the serial channels and within a user program Take care however not to issue a GOTO Number command unless the corresponding C Number label exists witinn the stored program Novice programmers use IF statements and GOTOs to create elaborate and sophis ticated programs that quickly become impossible to read or debug Force yours
345. x 123 PRINT 132 GOSUB x 13 Telr PRINT 130 A a V v 13 G 13 PRINT 13 13 End of Demonstration for serial buffer processing all motors to run subroutine 5 Motor 1 to run subroutine 10 Motor 2 to run subroutine 20 Motor 3 to run subroutine 30 Motor 4 to run subroutine 123 Set speed and accel in motor 2 Command Motor 2 to position OUTPUT Demonstration a l1 and b 2 atb 3 Position 1234 KP 100 Hello World Run Subroutines GOSUB5 GOSUB10 GOSUB20 GOSUB30 GOSUB123 A 100 V 100000 MP P 2000 G End of Demonstration 194 Related Command BAUD CCHN CMD DAT OCHN PRINT PRINTA PRINTH PRINT1 Print to Secondary Communications Port APPLICATION Communications output control DESCRIPTION Serial communications channel 1 PRINT function EXECUTION Immediate at present baud rate CONDITIONAL TO Channel 1 serial port open LIMITATIONS Output is not buffered Each character transmitted must wait for previous character to be finished Next command not executed until entire PRINT function is done REPORT COMMAND N A READ WRITE N A LANGUAGE ACCESS N A UNITS N A RANGE OF VALUES Values passed to PRINT string must be in the range of 2147483648 to 2147483647 TYPICAL VALUES Any of ASCII character set DEFAULT VALUE N A FIRMWARE VERSIONS ALL DETAILED DESCRIPTION The PRINT1 command is used to transmit output data to the serial communi
346. xecution End IF Statement End SWITCH Statement Set Data EEPROM Pointer 67 68 69 70 71 72 74 76 78 79 81 83 85 87 89 91 93 95 97 99 101 102 103 104 105 106 107 108 110 112 113 114 115 116 117 Language reference table of contents continued ES400 ES1000 FE F expression G GETCHR GETCHR1 GOSUB number GOTO number capital i IF expression KA expression KD expression KG expression Kl expression KL expression KP expression KS expression KV expression LEN LEN1 LIMD LIMH LIML LIMN LOAD LOCKP LOOP MC MC2 MC4 MC8 MD50 MFO MF1 MF2 Set EPROM Read Write Speed Set EPROM Read Write Speed Load PID Filter Motor Function Control Start Motion GO Get Character from main RS 232 Get Character From RS 485 Subroutine Call Branch Program Flow to a Label Encoder Index Pulse Location Conditional Program Code Execution PID Acceleration Feed Forward PID Derivative Compensation PID Gravity Compensation PID Integral Compensation PID Integral Limit PID Proportional Compensation PID Derivative Term Sample Rate PID Velocity Feed Forward Main RS 232 data buffer fill level RS 485 data buffer fill level Enable Directional Travel Limits Travel Limits Active High Travel Limits Active Low Enable Non Directional Travel Limits Download Compiled User Program to Motor Prevent User Program Upload Return to WHILE Program Flow Control Enable Mode CAM Electronic
347. ze array members to values 0 1 2 3 4 Response is 1 since al 50 is the legal end of array 60 Related Commands Z G Bi RBx RBi Bw Encoder Wrap Around Status Bit APPLICATION Monitor Encoder Wrap Around DESCRIPTION Encoder overflow or underflow occurred EXECUTION Updated each PID sample CONDITIONAL TO Position mode set LIMITATIONS Velocity and Torque Modes are immune to encoder wrap around all others are subject to it REPORT COMMAND RBw READ WRITE Read only Reset via G or ZS command LANGUAGE ACCESS Expressions and conditional testing UNITS Binary flag RANGE OF VALUES 0or1 VALUE OF STATES 0 No encoder wrap around occurred 1 Encoder wrap around occurred by position mode move DEFAULT VALUE 0 FIRMWARE VERSIONS ALL DETAILED DESCRIPTION If Bw is 1 it indicates that the encoder position has exceeded or wrapped beyond maximum value for the 32 bit position register Specifically the position has gone outside of the range 2147483648 to 2147483647 This does not at all mean that the SmartMotor has lost its position informa tion It is still tracking its position If the SmartMotor wraps while in Absolute or Relative Position Mode it will set the Position Error Bit Be to 1 as well Velocity mode is designed to survive the wrap around condition and torque mode does not care about any trajectory updates Neither of these causes Bw will set to 1 Note Mode Follow MF_ allows for a means ar

Download Pdf Manuals

image

Related Search

Related Contents

Size Express Users Manual  IHT FAIRWAY  AMI Mode d`emploi - Guides des aides du Conseil régional d`Aquitaine  Ver Ficha Técnica - Diversey M. DETOMA        Scarica il manuale  UNE SITUATION-PROBLEME EN GEOLOGIE : UN DÉTOUR  

Copyright © All rights reserved.
Failed to retrieve file