270 likes | 494 Views
SPiiPlus Training Class. PEG and MARK. What is PEG?. PEG (Position Event Generator) creates pulses based on exact feedback position. These events can be used as a trigger for external devices, such as a camera, laser, etc.
E N D
SPiiPlus Training Class PEG and MARK
What is PEG? • PEG (Position Event Generator) creates pulses based on exact feedback position. These events can be used as a trigger for external devices, such as a camera, laser, etc. • A PEG pulse is generated in hardware (delay < 0.1 microsecond) by comparing actual encoder position with a set of predefined values • Two different PEG modes: • Incremental PEG: • Pulse at fixed position increments • Random PEG: • Pulse at user-defined positions • Update a 4-bit state vector at each position
What is PEG? • PEG accuracy: ±1 count up to 10M counts/sec (using a digital encoder) • Three PEG engines per SPii • PEG engine outputs can be assigned to 10 physical RS422 interface outputs • PEG pulses can be sent in parallel through opto-isolated general purpose digital outputs, along with physical PEG outputs • PEG pulse width and polarity are programmable • Physical PEG outputs can be configured as RS422 general purpose outputs
Incremental PEG Mode • A pulse is generated at a predetermined start position followed by a stream of pulses a fixed distance apart until a predetermined end position is reached
Incremental PEG Mode • Maximum Incremental PEG pulse output frequency is 18 MHz. • Maximum Incremental PEG edge separation is (1/18MHz) = 55.56 nSec. • Pulse width range is 26.67 nSec to 1.745 mSec. • Direction of motion should correspond to sign of Interval.
How to use Incremental PEG • Use ASSIGNPEG to define which encoder PEG will use • Use ASSIGNPOUTS to define physical output pins PEG will use • Use PEG_I to set Incremental PEG • Wait for PEGREADY • Command motion to fire PEG pulses • (Optional) use STOPPEG to end PEG process before completion
ASSIGNPEG • The ASSIGNPEG command is used for: • Defining which encoders PEG will use • Configuration of digital outputs (for optional use as PEG signals) • A single ASSIGNPEG command effects all three PEG engines and all four general purpose outputs on a servo processor • ASSIGNPEG axis, engines_to_encoders_code, gp_out_assign_code • axis: Used to identify the relevant servo processor • engines_to_encoders_code: Bit code for engines-to-encoders mapping • gp_out_assign_code: General purpose outputs assignment to use as PEG state and PEG pulse outputs • For relevant bit codes, refer to SPiiPlus NT PEG and MARK User Guide
ASSIGNPEG Example 1 • ASSIGNPEG 0, 0b000, 0b0000 • 0: Assign all three PEG engines on servo processor 0 • 0b000: The following assignments are all made: • PEG engine 0 assigned to encoder 0 • PEG engine 1 assigned to encoder 1 • PEG engine 2 assigned to encoder 2 • 0b0000: The following assignments are all made: • General purpose output 0 configured as general purpose output 0 • General purpose output 1 configured as general purpose output 1 • General purpose output 2 configured as general purpose output 2 • General purpose output 3 configured as general purpose output 3
ASSIGNPEG Example 2 • ASSIGNPEG 5, 0b010, 0b0110 • 5: Assign all PEG engines on servo processor 1 • 0b010: The following assignments are all made: • PEG engine 4 assigned to encoder 4 • PEG engine 6 assigned to encoder 4 • PEG engine 5assigned to encoder 5 • 0b0110: The following assignments are all made: • General purpose output 4 configured as PEG_Pulse(4) • General purpose output 5configured as general purpose output 5 • General purpose output 6configured as PEG_Pulse(5) • General purpose output 7configured as general purpose output 7
ASSIGNPOUTS • Physical PEG pins can be used for either PEG (default) or as additional general purpose outputs. The ASSIGNPOUTS command is used to configure these pins accordingly. • ASSIGNPOUTS axis, output_index, bit_code • axis: Used to identify the relevant servo processor • output_index: 0 for X_PEG pins, 1 for Y_PEG pins, etc. • bit_code: Bit code for pin designation as PEG or as general purpose • For relevant bit codes, refer to SPiiPlus NT PEG and MARK User Guide
ASSIGNPOUTS Examples • ASSIGNPOUTS 3, 1, 0b000 • 3: Pins corresponding to servo processor 0 • 1: Y_PEG pins to be assigned • 0b000: Send PEG1_Pulse through Y_PEG pins • ASSIGNPOUTS 4, 5, 0b111 • 4: Pins corresponding to servo processor 1 • 5: X_STATE0 pins to be assigned • 0b111: X_STATE0 set as general purpose out (OUT(1).20) • ASSIGNPOUTS 4, 5, 0b010 • 4: Pins corresponding to servo processor 1 • 5: X_STATE0 pins to be assigned • 0b010: PEG4_Pulse sent through X_STATE0 output
Incremental PEG PEG_I Axis, Width, First Point, Interval, Last Point
Incremental PEG PEG_I X, 0.003, 1000, 1000, 3000
AST.#PEGREADY • AST is an integer array containing a set of bits used for displaying the current axis state • Bit 4 (#PEGREADY) indicates the readiness of a PEG engine • Syntax: AST(axis).#PEGREADY • Make sure this bit = 1 before commanding motion of the PEG axis
STOPPEG and STARTPEG • STOPPEG axisterminates PEG on the specified axis. The command is used in both Incremental and Random PEG. • Useful for safety purposes to stop PEG pulses while axis is in motion • If STOPPEG has been executed before the last PEG point has been reached, STARTPEG can be used to continue PEG from the current position. • STARTPEG axiscommand initiates the PEG process on the specified axis. The command is used in both the Incremental and Random PEG modes.
MARK • MARK (position registration) provides ability to latch current axis position when digital input signal is received • In many applications such as packing, it is desired to move an axis to a target that is relative to a registration mark • Once an axis is moving and a MARK is detected, motion profile can be modified on-the-fly to reach new target position
MARK • ACSPL+ variable MARK(axis) stores last MARK position • MARK inputs can be assigned as fast general purpose inputs using the ASSIGNFINScommand • Maximum MARKinput frequency depends on CTIME and other factors, and ranges between 50Hz for CTIME = 1ms, and 100Hz for CTIME = 0.5ms • MARK inputs are routed according to ACSPL+ variables SLPROUT, SLVROUT, SLCROUT. Routing two axes to a single input will cause undefined MARK behavior and should be avoided
Feedback Routing • SLPROUT is used for routing feedback position for the specified axis • SLVROUT is used for routing feedback velocity for the specified axis • SLCROUTis used for setting the feedback routing of the commutation velocity for the specified axis • Syntax: SLPROUT(AXIS#) = value, SLVROUT(AXIS#) = value, SLCROUT(AXIS#) = value • Where value corresponds to feedback source (see tables 34, 35, and 36 of the SPiiPlus ACSPL+ Command & Variable Reference Guide for definition)
ASSIGNFINS • ASSIGNFINS can be used to set MARK inputs as fast general purpose inputs • ASSIGNFINSaxis, output_index, bit_code • axis: Used to identify the relevant servo processor the axis is controlled by • input_index: 0 for IN_0, 1 for IN_1, ..., 9 for IN_9 • bit_code: Bit code for mapping MARK inputs to physical inputs • For relevant bit codes, refer to SPiiPlus NT PEG and MARK Operations tables 11 and 12
ASSIGNFINS Examples • ASSIGNFINS 1, 1, 0b111 • 1: Servo processor 0 is being used • 1: MARK Y input • 0b111: MARK Y set to FGP_IN1 • FGP_IN1 associated ACSPL+ variable: IN(0).17 • ASSIGNFINS 4, 5, 0b111 • 4: Servo processor 1 is being used • 5: MARK T input • 0b111: MARK T set to FGP_IN3 • FGP_IN3 associated ACSPL+ variable: IN(1).19
MARK Example • Assume the following motion should be built: • Move axis at a constant velocity with no defined end point • Latch exact MARK position while moving • Redefine the end point on the fly and stop motion smoothly at position equal to mark position plus 15000 units IST(0).#MARK = 0 ! Enable MARK latching JOG 0 ! Jog in positive direction TILLIST(0).#MARK ! Wait for MARK signal PTP 0, MARK(0) + 15000 ! Move to MARK(0)
Using PEG and MARK with SIN-COS Encoder • When SIN-COS encoder is used PEG and MARK can only be fired/captured at zero-crossings of the sine/cosine waves (not at the exact interpolated position)
GETCONF • GETCONF retrieves system configuration data • GETCONF(71, index): Use to view the actual assignment of digital outputs to PEG states and PEG pulses outputs. Index argument contains the axis index. • GETCONF(72, index): Use to view the actual encoder PEG engine assignment. Index argument contains the axis index. • GETCONF(73, index): Use to view the actual output pins assignment. Index argument: 0-7 is axis index, 8-16 is OUT_0 through OUT_9
Further Information • The following guides are part of the SPiiPlus NT Suite installation: • PEG and MARK Application Notes • ACSPL+ Command and Variable Reference Guide • SPiiPlus ACSPL+ Programmer’s Guide
Example 1 • A non-destructive testing machine requires RS422 PEG pulses be sent to its ellipsometry system for triggering purposes during stage travel. • Triggering needs to occur at fixed intervals along the stage’s length of travel • The application is using a CMnt Method: • Load and review example code
Example 2 • The inspection machine just had a HW revision, and now requires two metrology systems to be triggered in parallel. • Being a cost sensitive application it is desired to do this without adding/designing/purchasing/testing external circuitry. Method: • Modify code in previous example so two RS422 PEG pulses are sent out in parallel instead of one
Example 3 • For qualification purposes it needs to be verified that pulses are being fired at correct positions. Method: • Physically connect PEG pins to MARK pins • Modify the previous example to display MARK positions in the Communication Terminal • Hint – use an autoroutine to • Detect MARK latching (IST(axis).#MARK = 1) • Display the latched position (MARK(axis)) • Reset latch (IST(axis).#MARK = 0) so next PEG pulse can be detected