Buffered or immediate, About the buffers, Buffered or immediate? about the buffers – Applied Motion 1240i User Manual

Page 9

Advertising
background image

SCL Software Manual

9

920-0010 rev B

9/26/07

Buffered or Immediate?

There are two basic types of SCL commands:

buffered and immediate. Buffered commands execute one at a

time. If you send two buffered commands to the indexer at the same time, like an FL and an SS, the SS com-
mand sits in a buffer and doesn’t execute until the FL in completed. Other commands, indicated as

immediate

in the Command Summary, are executed right away, running in parallel with a buffered command if necessary.
That allows you to check the buffer status (BS), or input status (IS) while the motor is moving.

About the Buffers

Like most communication devices, the SCL drives use buffers to smooth the flow of data through the drive. If
you are using a fast computer to communicate with the drive, it is helpful to understand the data flow within the
drive.

The Receive Buffer

When commands are sent to an SCL drive, they arrive in a piece of hardware called a UART. Every 78 micro-
seconds, our drives run a piece of code called an interrupt service routine (ISR). The ISR handles time critical
functions and looks for characters that have arrived at the UART. It moves these characters to a 32 character
receive buffer.

A less time critical piece of code scans the receive buffer for new commands. If it finds an immediate com-
mand, it executes it right away. Immediate commands run very fast – in less than 1 millisecond. If the com-
mand is a buffered command, it is moved into the 128 byte command buffer.

The Command Buffer

Buffer commands are things like moves and parameter changes. These execute in order, one at a time. You
can check the number of characters available in the command buffer by using the BS command.

The Transmit Buffer

Some commands, like IS, ask the drive to send information back to the PC. If the command waited for all this
data to leave the drive (at 1 millisecond per character) it wouldn’t be very immediate. So responses from
commands like IS and SS are stored temporarily in a 32 character transmit buffer. The ISR makes sure these
characters make it out of the drive.

Overflow

If you are not careful about sending characters to the drive, you can overflow these buffers. And if you do,
strange things may happen.

It is useful to note the rate at which characters can enter and leave the drive: 9600 bits per second. To transmit
a serial character using UARTS, 10 bits are sent. So characters enter and leave the drive at a rate never
greater than 960 characters/second. That’s roughly one every millisecond.

Receive Buffer Overflow

There are some instances where the receive buffer is not attended to promptly. If you stream characters into
the drive at that time, the buffer can overflow. It is a circular FIFO buffer (they all are), so if it overflows, com-
mands may be lost. They may also be misunderstood and the drive will send the host a question mark. In
some cases, a command previously sent will be executed. None of this is good. And you cannot check the
status of the receive buffer. Scared yet? Don’t be – just be sure to observe these precautions:

After each of the following commands, you should not send any other commands to the drive for 50 millisec-
onds: FS, FD, FC, FY, SH, SK, ST, CJ.

During the WT command, you must use a 20 millisecond delay between commands.

Advertising
This manual is related to the following products: