P
ar
t
1: P
rog
ra
m
ming
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 192 of 909
The following is an example of printing menu selections for a terminal screen using SWITCH.
This example comes from the SmartBox demo program. For SmartBox details, see this
address:
http://www.animatics.com/products/smartmotor/testing-and-development.html
IF
INA
(V1,6)>3800
'If SEL pressed
m=m+1
'increment menu item
IF
m>9 m=1
ENDIF
'Limit menu items between 0 and 9
GOSUB102
'PRINT MENU OPTION
WHILE
INA
(V1,6)>3500
LOOP
'don't double trigger
ENDIF
'===========================================================================
C102
SWITCH
m
CASE
1
("Electronic Gearing 1:1
",#13)
BREAK
CASE
2
("Absolute Position Mode
",#13)
BREAK
CASE
3
PRINT("Velocity Mode
",#13)
BREAK
CASE
4
("Torque Mode
",#13)
BREAK
CASE
5
("Relative Position Mode
",#13)
BREAK
CASE
6
("High Speed Indexing
",#13)
BREAK
CASE
7
("CAM Mode <Gearing>
",#13)
BREAK
CASE
8
("Variable Gearing
",#13)
BREAK
CASE
9
("Preset Moves
",#13)
BREAK
ENDS
RETURN
Interrupt Programming
The following are interrupt commands that can be used in your SmartMotor programs.
For more details, see Part 2: SmartMotor Command Reference on page 238.
ITR(), ITRE, ITRD, EITR(), DITR(), RETURNI
Interrupt Commands
The interrupt ITR() function can be used to configure a SmartMotor to execute a routine based
on the change of a status bit. There are dozens of different bits of information available in the
SmartMotor, which are held in groups of 16 status bits called Status Words. ITR() can tell the
SmartMotor to execute a subroutine after the change of any one of these status bits in any
Status Word. When the status bit changes, that subroutine executes at that instant from
wherever the normal program happens to be. A program of some sort must be running for the
interrupt routine to execute.
Interrupt subroutines end with the RETURNI command to distinguish them from ordinary
subroutines. After the interrupt code execution reaches the RETURNI command, it goes back
to the program exactly where it was interrupted. An interrupt subroutine must not be called
directly with a GOSUB command.
Part 1: Programming: Interrupt Programming
Содержание SmartMotor
Страница 1: ...Developer s Guide Class 5 Later SmartMotor Technology with TM ...
Страница 909: ...PN SC80100003 002 Rev L ...