C-400, Single commands, Compound commands – Pacific Laser Equipment C-400 User Manual

Page 9: Macro commands, Reporting commands

Advertising
background image

Motor controller 4ch

User manual

C-400

November 19, 2002

Release: 1.30

2002 by

Pacific Laser Equipment

PLEquipment, 3941 S. Bristol St. Unit D-122, Santa Ana, CA. 92704,

(

509-355-5155, Fax: 509-355-5155, Email: [email protected]

Page 9 of 21

5.1. Single Commands

A single command is executed immediately after a carriage return is received and will be repeated
each time a carriage return is received, until a different command is entered.
Examples:
MR2000 <return> Move motor 2,000 steps relative to the present target
MN <return> Set motor in ON state
TP <return> Report (tell) position for motor
MA20000 <return> Send motor to absolute position 20,000
Both uppercase and lowercase characters are valid, and spaces are allowed.

5.2. Compound Commands

A compound command is a series of single commands separated by commas.
In this way, it is possible to string together several commands before terminating them with a carriage
return. These multiple commands will then be executed sequentially.
The syntax for a compound command is: CMD[n], CMD[n], ...,..., <return>
Example: mr5000,ws100,wa500,ma12000,ws100,wa800,tp<return>

A compound command, such as in the following example, may be entered as one program line. It
instructs the motor to move 1,000 encoder counts in the positive direction, wait in that position 500
milliseconds, return to the original position, wait 1 second, and then repeat that sequence 5 times.
Example: "MR1000,WS100,WA500,MR-1000,WS100,WA1000,RP5" <return>
Once this compound command is entered, it remains in the buffer until replaced by another command
and can be re-executed by sending a carriage return (pressing <enter>).

5.3. Macro Commands

Macros can be a most powerful tool for the programmer. A macro command is a grouping of
commands to form a short program, stored under a macro number.
To use macros to programming the C-400

©

controller, insert an MDn (MacroDefinition) command as

the first instruction on the line and follow it by a comma and a comma-separated command string. The
syntax for macro commands is:

MD

(macro#), followed by a compound command string.

Example: MD3,MR1000,WS100,MR-1000,WS100,RP5 <return>
In this example, MD3 defines macro #3. To call up (run) this macro, just issue the command EM3.
Unlike MD# commands, EM# commands may be used in compound commands and, with some
restrictions, in other macro definitions.

A macro command can call other macros, but if the calling macro is to continue after the called macro
completes, the called macro must not contain any macro calls. For example, MC1 could call MC2, but
MC2 could not then call MC3 and still be able to return to complete the remainder of MC1.
Example: MD1,EM2,EM3,EM4,EM5,EM6

5.4. Reporting commands

Reporting commands are commands, which cause the C-400

©

controller to send a string of data, be it

a position, servo-control parameter, help or other information. These commands are easy to remember
as they usually begin with a T (tell). For example, TT (Tell Target).

Advertising