Installation guide
Motion Controller Programming Interface 49
ble Read-Only Memory), or a BBRAM (Battery Backed
RAM). The electrical codes stored in this type of memory
are not lost when external power is removed from the Con-
troller. The Controller uses a battery backed RAM for
storing NVR variables (1-2048). The controller stores the
operating system as well as user programs in Flash mem-
ory. This memory is located on the DSP Controller card.
A program in your Controller can have hundreds, or
even thousands of program lines. Because of the
wide variety of program commands, and the variable
line lengths allowed, it is impossible to state how
many lines of code can be stored in the controller. 
However, the user memory available is 2044 sectors
of 128 bytes per sector, for a total of 261,632 bytes
of program space. The FREE command may be
used to determine how much memory is available;
see Section 7 for details on using this.
6.1.4 - References
Newcomers to programming are encouraged to obtain a
copy of an elementary text on computer programming. 
Since your Controller uses a modified form of the familiar
"BASIC" computer language, you may refer to a book on
using BASIC. There are a great number of such books
available in the technical or computer section of your local
library or bookstore. We have found that books by
SAM's, Microsoft Press particularly ΑRunning MS DOS
QBASIC,≅ by Michael
Haverson & David Rygmyr, and those by the Waite Group
are among the most helpful.
Section 6.2 - Multi-Tasking Operations
A single computer can only do one thing at a time. How-
ever, a complex motion control system needs to have
many tasks done, all at once. An effective way to do this
is with a very fast microprocessor (or DSP), running a pre-
emptive multi-tasking operating system. This causes a
single computer to appear to be doing several things si-
multaneously. The computer works on one program for a
while, then switches to another program for a while, and
after all programs have been serviced, goes back to the
first, and repeats the cycle.
With a fast computer, the time slice for each program can
be small and the outward appearance is that a separate
computer is running each program.
The Controller uses this approach to give the user up to 7
"virtual" motion controllers in a single package. An addi-
tional advantage of multi-tasking is that information can
be easily shared among the 7 virtual controllers. The Con-
troller runs 1 system task and up to 7 user tasks. Task 0 is
a system task, which always runs. It processes commands
received over the Host serial port. Up to 7 user, SEBASIC,
BASIC programs (Task 1 - Task 7) may be running in addi-
tion to Task 0.
Every 256 microseconds, task execution is interrupted in
order to perform the time-critical functions associated with
motion control. Execution of the next task is resumed
upon completion of the interrupt routine. The execution
sequences for a 1-user-task system and for a 7-user-task
system are shown below.
If an application uses 7 tasks, then each task will be serv-
iced once every 2.048 ms. If fewer tasks are used, then the
service time decreases. A one-task system would be
serviced every 512 us. The service time can be calculated
by the following formula:
T
service
 = (n + 1) x 256 microseconds 
where n is the number of user tasks.
Large, complicated applications typically consist of sev-
eral independent operations occurring simultaneously. 
Multi-tasking allows the user to program the application
as a collection of several smaller and hence simpler appli-
cations.
A typical example of the use of tasks is to break up the
system functions into logical groups. For example, control
of a large machine might assign functions to tasks as fol-
lows:
Task 1 - Motion on axes 1 and 2
Task 2 - Handling all inputs and outputs
Task 3 - Communicating with operator interface panel
Using tasks and multi-tasking allows programs to be more
modular, hence they are easier to write, debug, and main-
tain.
Task 0
Task 1
Interrupt
Task 2
Interrupt
Task 3
Interrupt
Task 4
Interrupt
Task 5
Interrupt
Task 6
Interrupt
Task 7
Interrupt Interrupt
Interrupt Interrupt
Task 0
Task 1
Interrupt
Task 0










