Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 51 of 909
l
When the SmartMotor power is turned on, there is a 500 ms "pause" before any
program or command is processed:
l
For all industrial networks, every node (or motor) must immediately send out a
"Who am I?"info data packet when power is turned on, which tells the network
host who it's talking to. This is a requirement for all industrial communications
protocols (like CANopen, DeviceNet and PROFIBUS).
l
The stored program does not execute until the 500 ms pause expires. Any serial
commands sent during that time are buffered and then accepted after that pause
expires. Because incoming commands take priority over the internal program,
any buffered commands are executed before the internal program begins.
l
Commands coming in over the network have priority over the program running within
the SmartMotor. For example, while a program is running, you could issue a GOSUB
command from the terminal and send the program off to run the specified subroutine.
When the subroutine is done, the program would resume at the point where the GOSUB
command was issued.
l
The RUN? command can be used at the beginning of a program to prevent it from
automatically running when the SmartMotor power is turned on, as shown in the "Hello
World" example. For details, see Creating a "Hello World" Program on page 51.
l
The SmartMotor will not execute any code past the RUN? line until it receives a
RUN command through the serial port.
l
Using the serial port, the motor can be commanded to run subroutines even if the
stored program is not running.
Creating a "Hello World" Program
This procedure describes how to create and save a simple "Hello World" program.
NOTE: When copying and pasting code from another text editor, make sure that
your text editor is not inserting "smart quotes" (angled single or double quotation
marks). These are not the same as ASCIIcharacters 39 (') and 34 ("), and the SMI
program editor doesn't recognize them.
Entering the Program in the SMI Editor
To create the program, type the following code into the SMI software program editor:
RUN?
PRINT("Hello World",#13)
END
NOTE: The program will not run when the SmartMotor power is turned on (because
of the RUN? command on the first line).
When you run this program, it outputs the following text to the Terminal window:
Hello World
To run this program, you must download it to the SmartMotor and then enter the
RUNcommand in the Terminal window. For more details on downloading the program, see
Downloading a Program to the SmartMotor on page 52. For more details on running the
downloaded program, see Running a Downloaded Program on page 54.
Part 1: Programming: Creating a "Hello World" Program