MPC-385 SERIES OPERATION MANUAL – REV. 3.21K (20201120)
16. ‘S’ Command’s Streaming Return Data for Current Position: The Straight-Line Move (‘S’)
command has two modes of operation:
a. a CR is returned when the target position has been reached (F’ (Off) command
before the ‘S’ command sequence), or
b. streaming positional data is returned while movement is occurring, and then a
CR once movement is complete (‘O’ (On) command before the ‘S’ command
sequence).
Positional data is streamed at every 1 micron of movement, and the rate (data per second)
depends on the ‘S’ command speed level used. Each positional data block streamed
consists of 12 bytes:
1. The 1
st
three bytes each contains FF hexadecimal (255 decimal) as a data block
signature,
2. the next 3 contains positional data for the X axis,
3. the penultimate is for Y, and
4. last for Z.
All positional data are in microsteps. Each 3-byte position needs to be converted into 4-
byte blocks by prepending a byte containing 0, so that the resulting data (now 4 bytes)
can be treated programmatically as an unsigned 32-bit “long” (C/C++) or “U32”
(LabVIEW) data type. All positional data streamed is in Little-Endian bit/byte order
(Wintel), so conversion to 32-bit longs will require bit-order reversal (byte swapping) for
Big-Endian platforms (e.g., LabVIEW). The appropriate microstep-to-microns conversion
factor is needed according to the device type being moved (see
Microns/microsteps
conversion factors (multipliers)
table).
Little-Endian bit/byte order environment:
pos[x]
cpxus
cpyus
cpzus
Big-Endian bit/byte order environment (“pos” is in Little-Endian format):
pos[x]
cpxus
cpyus
cpzus
The following C/C++ code snippets can be used to process the streaming data.
Array for a streamed 12-byte block of data containing current position
unsigned char pos[12];
32-bit variables for current position in microsteps, all initialized to 0 to ensure MSB allows only
positive values