1 / 40

Power PMAC Script Program Flow November 2013

Power PMAC Script Program Flow November 2013. if (JogMotorStatus == 0) { // No motor jogging? JogMotor = MotorSelectSw + 1; // Read switch to select motor Ldata.Motor = JogMotor; // Specify motor for jog commands JogMode = IncJogSw; // Read switch to select jog mode

more
Download Presentation

Power PMAC Script Program Flow November 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Power PMAC Script Program FlowNovember 2013 if (JogMotorStatus == 0) { // No motor jogging? JogMotor = MotorSelectSw + 1; // Read switch to select motor Ldata.Motor = JogMotor; // Specify motor for jog commands JogMode = IncJogSw; // Read switch to select jog mode if (JogMode == 0) { // Continuous mode? if (Motor[JogMotor].JogTa < 0) { // Accel & jerk rates specified? JogDecelDist = pow(Motor[JogMotor].JogSpeed,2) * Motor[JogMotor].JogTa * -0.5; JogDecelDist += Motor[JogMotor].JogSpeed / Motor[JogMotor].JogTa * Motor[JogMotor].JogTs * 0.5; JogDecelDist += pow(Motor[JogMotor].JogTs,2) / pow(Motor[JogMotor].JogTa,3) * -0.5; } else { if (Motor[JogMotor].JogTa > 0) { // Accel & jerk times specified? JogDecelDist = Motor[JogMotor].JogSpeed * Motor[JogMotor].JogTa * 0.5; JogDecelDist += Motor[JogMotor].JogSpeed * Motor[JogMotor].JogTs * 0.5; JogDecelDist += Motor[JogMotor].JogSpeed * (pow(Motor[JogMotor].JogTs,2) / Motor[JogMotor].JogTa) * 0.5; } else { // Zero accel specified JogDecelDist = Motor[JogMotor].JogSpeed * 200 * 0.5; // As for 200 msec Ta } // if (JogTa > 0) else } // if (JogTa < 0) else } // if (JogMode == 0) } // if (JogMotorStatus == 0)

  2. Five Script Program Types • prog – Top-level motion program • Up to 1023 programs, numbered 1 to 232-1 • Executed with r [run], s [step], start commands, automatically stop at end • rotary – Special rotary motion program buffer • Can define 1 rotary motion program buffer per coordinate system • Considered prog 0 for the coordinate system • plc – Top-level PLC program • Up to 32 programs, numbered 0 to 31 • Executed with enable plc commands, automatically looping • forward, inverse – Kinematic routines • Each coordinate system can have 1 forward and 1 inverse routine • Called automatically and invisibly at appropriate times • subprog – Callable subprogram • Up to 1023 programs, numbered 0 to 232-1 • Not directly executable; must be called from other programs • Can be called from prog, plc, rotary, subprog, forward, inverse

  3. Loading Rules for Script Program Types • Note: IDE project manager automatically manages loading rules during project download • prog – Top-level motion programs • Can add new prog at any time • Cannot open an existing prog (to overwrite or erase) if it (or a called subprog) is executing, or suspended (e.g. with h, s, q) so that execution can resume (use abort if necessary) • plc – Top-level PLC programs • Can add new plc at any time • Cannot open an existing plc (to overwrite or erase) if it (or a called subprog) is executing (enabled) or suspended so can resume • subprog -- Callable subprograms • Can add new subprog at any time • Cannot open an existing subprog (to overwrite or erase) if it (or a called subprog) is executing or suspended so can resume • Overwriting existing program empties existing memory space, writes new version to end of buffer space

  4. Common Script Language Syntax • Motion and PLC programs have same syntax rules • Power PMAC eliminates differences of PMAC/Turbo PMAC • Motion and PLC programs have different execution rules • Motion program execution is automatically sequenced by the move • Only calculates far enough ahead to keep motion queue full enough • When program finishes, program counter returns to top, but stops • PLC program execution is “free running” like standard computer language • Move command only starts the move; must actively monitor for finish • When program finishes scan, program counter returns to top, ready to run again automatically on next scan • Subprograms follow execution rules of top-level program • Same subprogram can be called by motion or PLC top-level program, with different execution rules

  5. Script Language Syntax Notes • Script language is not case sensitive • Power PMAC reports back reserved words in lower case, except for single-letter names (axis, etc.) • Power PMAC reports back data structure names with first letters upper case, subsequent letters lower case • No “short forms” of key words (e.g. no dwe for dwell) • Use of semicolons after commands permits full syntax checking in IDE editor (but is not required) • Power PMAC ignores semicolons • Semicolon does not indicate that rest of line is comment • Double slash (//) indicates that rest of line is comment • /* indefinite-length comments must be removed before command parser • open {buffer} automatically clears buffer (except rotary) • Multiple commands can be put on same line • Does not affect execution for non-motion commands • Axes commanded on same line move together

  6. Pre-Conditions for Motion Program Execution • All motors assigned to position axes in the coordinate system must be: • Activated (Motor[x].ServoCtrl >= 1) • Enabled, closed-loop • Not in both hardware overtravel limits • Position-referenced if Coord[x].HomeRequired = 1 • Selected motion program (and any jump label) must be present and valid • Power PMAC must be able to compute all axis starting positions from present motor positions • Coord[x].Csolve = 1, indicating valid axis definition statement set, or • Valid forward kinematics subroutine • If resuming from suspended state that is not at a programmed point, all motors must be at suspended positions • Note that a motion program can be executed in a coordinate system with no motors assigned to position axes; this provides fast “dry run” and “mid-program start” capability.

  7. Motion Program Execution Sequencing • Each real-time interrupt (RTI), each active C.S. checks its internal “block-request” flag • Block-request flag can be set by either: • Command to start execution (e.g. r, s, start), or • Move execution (interpolation) progressing from one programmed move to the next • If flag is set, program calculations start at present program counter • Program calculations continue until either: • Equations of motion for enough moves have been computed and put into motion queue to fill the queue enough for this mode • Program calculations suspended, block-request flag cleared • Program counter jumps back toward top of program more than Coord[x].GoBack + 1 times • Blending disabled to prevent possible run-time error from indefinite loop • Block-request flag cleared until queued move(s) completed • Program calculations thus automatically sequenced by the move

  8. Motion Program Sequencing Example X0 Y0; // Compute move, suspend Xpos = Rad * cos(Angle); Ypos = Rad * sin(Angle); X(Xpos) Y(Ypos); // Compute move, suspend while (Interlock == 0) // Continue, blend if loop ct ≤ GoBack+1 { } // Suspend, no blend if loop ct > GoBack+1 X(-Xpos) Y(-Ypos); // Compute move, suspend if (ExtendedPause == 1) { PauseTime = 100; } else { PauseTime = 50; } LaserOn = 1; dwell(PauseTime); // Compute “move”, suspend

  9. Sequencing Example Time Line 3 2 4 Calculating “n” moves ahead (value of “n” dependent on mode) 1 "R" Execute time n+2 n+3 n+4 n 1 n+1 Calculate

  10. How Much Pre-Calculation is Required? • For basic point-to-point moves, no pre-calculation required – program calculations resume after end of move execution • For rapid mode moves, other modes with Coord[x].NoBlend = 1, dwells • For basic blending without acceleration control – one move ahead • For linear, circle mode moves with segmentation, no lookahead • For blending with simple acceleration control – two moves ahead • For linear mode moves with no segmentation (acceleration limiting) • For spline mode moves (acceleration continuity) • For blending with full (lookahead) acceleration control – enough moves to keep lookahead segment buffer full (Coord[x].LHDistance segments) • For linear, circle, pvt mode moves with segmented lookahead active • For 2D cutter radius compensation active – enough moves for intersection and interference-check calculations (Coord[x].CCDistance moves) • For linear or circle mode moves with 2D cutter comp active

  11. Rotary Motion Program Buffers • Permit simultaneous download and execution of motion program • Useful for programs too large for Power PMAC memory (multi-megabyte) • Useful for programs created in real time • Commonly used for CNC-style part programs, as from CAD/CAM • Reuses buffer memory from program lines already executed • Program commands that cause jumps to other lines in program are not permitted (cannot be sure that line will be present in buffer) • goto, gosub, callsub commands, jump labels • Multiple-line if branches* • else branches (single or multi-line) • Multiple-line while and do/while loops* • switch commands • call commands to subprograms are permitted (including G, M, T, & D codes) • No debugging breakpoints can be added * Multiple actions on a single line are permitted

  12. Rotary Buffer Management Commands • &n define rotary{program buffer size},[{line buffer size}] • Reserves specified memory for C.S. rotary buffer • Program buffer size must be >= 2048 bytes • Default line buffer size is 1024 bytes (sufficient for virtually all apps) • &n open rotary opens C.S. rotary buffer for entry, does not clear (so can add to end) • &n clear rotary erases content of buffer, but preserves buffer itself • &n close closes C.S. rotary buffer if open (recommended when done entering) • &n b0 sets C.S. program counter to rotary buffer at latest point that has not already been calculated • &n list rotary reports present contents of buffer starting at latest point that has not already been calculated • clear all buffers erases the buffers themselves

  13. Script PLC Program Execution Sequencing • Execution of active PLC program automatically started at appropriate time in real-time interrupt (RTI) or background cycle • Execution continues until end of program or end of (true) while loop – constitutes end of one “scan” • Next scan does not start until next RTI or next turn in background cycle • Next scan starts at top of program (if previous scan got to end), or at top of while loop (if previous scan exited at bottom of loop) • If PLC program commands motion (e.g. jog, homing, or axis move), program execution does not stop as motion program does • Must monitor in user code for end of move • Synchronous variable assignment useful to ensure move has started • No need to place program within while loop to cause continued scans; Power PMAC will automatically call repeatedly • For “one-shot” PLC, last line of program should be disable plc n

  14. Power PMAC Script PLC Program Execution • PLC 0 always executes in real-time interrupt (RTI) • PLCs 1, 2, & 3 can execute in RTI or background • PLCs 4 – 31 always execute in background • Sys.MaxRtPlc (= 0, 1, 2, or 3) sets highest numbered PLC to execute in RTI • Sys.RtIntPeriod sets RTI frequency (every Sys.RtIntPeriod+1 servo interrupts) • Scheduler starts background scan after “sleep” interval (which releases processor for separate Linux OS applications) • enable plc {list} command (on-line or program) starts execution at next “slot” for scan • disable plc {list} command (on-line or program) prevents execution starting at next scan

  15. Power PMAC Program Line Labels • Jump labels: e.g. N1200:, N4375821: • Label must be at start of a program line • Value must be a constant (unsigned 32-bit integer), followed by a colon • Can jump to label with goto, gosub, callsub, call, G, M, T, D • Jump command can use expression to specify label number • Can point to label with b, begin commands (using fractional part of value) • Synchronizing labels: e.g. N1200, N(P10) • Value can be constant or expression, no following colon • Expression value truncated (if necessary) to unsigned 32-bit integer • Regular assignment (at “lookahead” time) of value to Coord[x].Ncalc • Synchronous assignment of value to Coord[x].Nsync • Occurs at start of actual execution of next move or dwell • This assignment reversible during lookahead retrace operation • Useful for monitoring program and motion execution • Commonly used in CNC-style applications for operator display • OK to use both labels together: e.g. N1200: N1200 X10 Y20

  16. Power PMAC Conditions • Use in if and while statements (including do … while) • C-style conditional syntax (not BASIC-style) • Can be explicit comparison or just expression (new!) • if (P1) … is valid syntax • Expression must evaluate exactly to 0.0 to be “false” • 8 standard comparators: ==, !=, >, >=, <, <=, ~, !~ • Note that = (single equals sign) is not a valid comparator • Outside of condition, == is synchronous assignment operator • 3 alternate comparators: <>, !<, !> (stored as standard equivalent) • Logical negation operator ! • e.g. if (!(P1)) P2++; • 2 conditional combinatorial operators: && (and), || (or) • e.g. while (P1<1 && P2>=0) { }

  17. Power PMAC Conditional Actions • Single-line conditional actions: same line as conditional if ({condition}) {command};… else {command};… while ({condition}) {command};… • Null action requires empty curly brackets • e.g. while (Motor[3].DesVel) { } • Multi-line conditional actions: delimited by curly brackets • No ENDIF, ENDWHILE statements, as in PMAC/Turbo PMAC if/while ({condition}) { {command}; … } else { {command}; {command};… }

  18. Power PMAC “switch” Statement • Very similar to C “switch” statement – general syntax: switch ({expression}) { case {constant}: {command};…[break;] case {constant}: {command};… [break;] … [default: {command};…] } • Value of {expression} after switch rounded down to next integer • {constant} after case must be an integer • Optional break stops execution of a particular case • Otherwise execution can continue into next case • default can be used for when value matches no case • Limited to 256 cases unless declare more, e.g.: switch(P1),512(IDE automatically allocates minimum required number)

  19. Calling Subroutines and Subprograms • gosub{data} – Jump to label N{data}: of same program • No R-variable (stack) argument passing permitted • callsub{data} – Jump to label N{data}: of same program • R-variable (stack) argument passing is permitted • call{data} – Jump to subprog{int{data}} • Fractional part of {data} specifies jump label within program • Multiply fractional part by 1,000,000 to get jump label number • (Note that PMAC/Turbo PMAC multiplied by 100,000) • call500.123 jumps to subprog500 N123000: • Jump back in all cases on return • Implicit return at end of all subprograms • Calling can be up to 255 levels deep • PLCs as well as motion program (progs) can use these • Note that call is always to subprog (not prog or plc) • When top-level program is PLC, all subprograms obey PLC execution rules

  20. RS-274 “G-Code” Subroutine Calls • Basically the same as PMAC/Turbo PMAC scheme • For customizable execution of RS-274 programs • Treated as call commands to specific subprograms – by default: • G{data} - subprog1000 N{{data}*1000}: // Preparatory codes • M{data} - subprog1001 N{{data}*1000}: // Machine codes • T{data} - subprog1002 N{{data}*1000}: // Tool-select codes • D{data} - subprog1003 N{{data}*1000}: // Tool-data codes • Since line jump label numbers can be > 100,000, code numbers >= 100 (but < 1000) can be supported in these programs (new!) • Fractional code values (to thousandths) supported • Typically these subroutines will not use synchronizing line labels, as most users want to monitor only place in main part program • Subprograms used can be changed with Coord[x].Gprog, .Mprog, .Tprog, .Dprog saved setup elements, permitting different subroutines for different coordinate systems

  21. Passing Arguments to Subroutines with “read” • Supports pure “letter/number” program format of RS-274 “G-codes” • Permits sophisticated processing of CAD/CAM-generated programs • Similar to PMAC scheme, but with enhancements • read command in subroutine gets values associated with specified letters [e.g. read(X,Y,XX,YY) ] on calling line • Arguments read into subroutine local “D-variables” (not Q-variables) • “A” arg into D1, “B” into D2, …, “Z” into D26 • “AA” arg into D27, “BB” into D28, …, “ZZ” into D52 • Bits 0 – 51 of D0 note which arguments actually passed in latest read • Bit (n-1), with value 2n-1, shows whether new value read into Dn • One set of D-variables per coordinate system • No stack for subsequent read commands; watch for overwriting

  22. Sample G-Code Subprogram open subprog 1000 // Default G-code subprogram N0: rapid; return; // G00 RAPID mode N1000: linear; return; // G01 LINEAR mode N2000: circle1; return; // G02 CW CIRCLE mode N3000: circle2; return; // G03 CCW CIRCLE mode N4000: read(P); // G04 DWELL command if(D0 & $8000) dwell(D16 * 1000); // "P" dwell time in seconds return; N17000: normal K-1; return; // G17 XY plane set N18000: normal J-1; return; // G18 ZX plane set N19000: normal I-1; return; // G19 YZ plane set N40000: ccmode0; return; // G40 cutter comp off N41000: ccmode1; return; // G41 cutter comp on left N42000: ccmode2; return; // G42 cutter comp on right N61000: Coord[1].NoBlend = 1; return; // G61 exact stop mode N64000: Coord[1].NoBlend = 0; return; // G64 continuous mode N90000: abs; return; // G90 absolute move mode N91000: inc; return; // G91 incremental move mode close

  23. Sample “G-Code” Part Program open prog 15 // Open motion program buffer G17 G90 G64 // XY plane, abs mode, blended G00 X0 Y0 // Rapid move to origin G04 P1.75 // Dwell for 1750 msec G01 X5 F10 // Linear move to (5,0), speed 10 G03 Y10 J5 // CCW circle move to (5,10) G01 X0 // Linear move to (0,10) X-5 Y15 // Linear move to (-5,15) X-10 Y10 // Linear move to (-10,10) Y7.5 // Linear move to (-10,7.5) G03 Y2.5 J-2.5 // CCW circle move to (-10,2.5) G01 Y0 // Linear move to (-10,0) X-5 Y-5 // Linear move to (-5,-5) X0 Y0 // Linear move to (0,0) G04 P1 // Dwell for 1000 msec close

  24. Passing & Returning Variables with Subroutines • Using local (L) variables for C.S. (when starting from PROG) or PLC program • Variable Rn of calling routine equivalent to Ln of called • Rn of calling routine equivalent to L(n+{StackOffset}) of same • {StackOffset} is 256 by default • To change, set explicitly when entering calling program:open prog n,{StackOffset} • Total of 8192 L-variables per C.S. or PLC • 31 levels of passing to/from subroutines at default stack offset • Can support all 255 possible levels with {StackOffset} = 32 • IDE automatically allocates minimum required offset value

  25. Local Variable Stack Example • This example uses default “stack offset” of 256 • Other offsets can be declared • IDE declares optimal offsets automatically • Rn of calling routine equivalent to Ln of called routine • Rn of calling routine equivalent to L(n + StackOffset) of calling routine • Pass/return arguments should start with R0 of calling, L0 of called • IDE manages these definitions and assignments automatically

  26. Example of Passing and Returning Variables(No substitutions of variable or program names) • Subprogram to execute Pythagorean theorem open subprog 100 L3 = L0 * L0; // Uses R0 from calling routine L4 = L1 * L1; // Uses R1 from calling routine L2 = sqrt(L3 + L4); // Result will be R2 in calling routine close // Implicit return on close • Sample calling program: open prog 5 R0 = Motor[1].FltrVel * P50; // Will be L0 in subprogram R1 = Motor[2].FltrVel * P50; // Will be L1 in subprogram call 100; P60 = R2 * P51; // R2 was L2 in subprogram …

  27. Example of Passing and Returning Variables(Using substitutions of variable and program names) • User-specified program within IDE project manager: open subprog Pythag (Rise, Run, &Hypot) local RiseSqrd, RunSqrd; RiseSqrd = Rise * Rise; RunSqrd = Run * Run; Hypot = sqrt(RiseSqrd + RunSqrd); close • Automatically becomes for download: #define Pythag {auto-assigned #} open subprog Pythag // open subprog {auto-assigned #} #define Rise L0 // First variable in subprogram declaration #define Run L1 // Second variable in subprogram declaration #define Hypot L2 // Third variable in subprogram declaration #define RiseSqrd L3 // First internally declared local variable #define RunSqrd L4 // Second internally declared local variable RiseSqrd = Rise * Rise; // L3 = L0 * L0; RunSqrd = Run * Run; // L4 = L1 * L1 Hypot = sqrt(RiseSqrd + RunSqrd); // L2 = sqrt(L3 + L4); close

  28. Example of Passing and Returning Variables(continued) • Subroutine call statement in calling program written as call Pythag (XDist, YDist, &VecDist); • Automatically becomes for download: R0=XDist; R1=YDist; call Pythag; VecDist=R2; • Pythag is substituted by {auto-assigned #} • XDist and YDist are user-declared variables

  29. Power PMAC PLC Program Enhancements • Ability to use program-flow constructs formerly available to motion programs only • Line-jump labels (e.g. N550:) • goto, gosub, callsub jumps within programs • call jumps to subprogs (not other PLCs) • Local variable passing to subroutines with callsub and call • Ability to command axis moves directly • e.g. if (P1==1) X3.5 Y12.1 • Acts on C.S. addressed by PLC (set by value of Ldata.Coord) • rapid-mode moves only (C.S. automatically switched into this mode) • No automatic execution of pmatch function • Command only starts move; program execution is not suspended here • Move commands can break into running rapid moves (altered destination) • Debugging features • Cycle counters for instructions • Break points on instructions (at prescribed cycle count) • Single-step capability

  30. Power PMAC Program Direct Commands • Provide the equivalent of many on-line commands from within motion and (mainly) PLC programs • Syntax is longer version of equivalent on-line command • Largely replace the CMD"{on-line command}" syntax of Turbo PMAC • HOME, HOMEZ were only program commands like this in Turbo PMAC • Motor-specific direct commands act on addressed or listed motor(s) • If no list (e.g. jog+), acts on motor presently addressed by program • Ldata.Motor={expression} sets addressed motor in program • If has list (e.g. jog+1,3,5), acts on listed motor(s), does not change modally addressed motor • C.S.-specific direct commands act on addressed or listed C.S.(s) • If no list (e.g. abort), acts on C.S. presently addressed* by program • Ldata.coord={expression} sets addressed C.S. in program • If has list (e.g. abort2,4,6), acts on listed C.S.(s), does not change modally addressed C.S. * Motion program can only address CS executing it

  31. Program Direct Motor Commands • cout[{list}]:{data} – Command open-loop output of specified % of full • dkill[{list}] – Command motor kill (delayed for brake engagement) • home[{list}] – Command homing-search move • homez[{list}] – Command zero-move homing • jog+[{list}] – Command indefinite positive jog • jog-[{list}] – Command indefinite negative jog • jog/[{list}] – Command jog stop (or close loop) • jogret[{list}] – Command return to pre-jog position • jog[{list}]={data} – Command jog to specified position • jog[{list}]:{data} – Command jog of specified distance from desired • jog[{list}]^{data} – Command jog of specified distance from actual • jogret[{list}]={data} – Command jog to specified position, make it pre-jog pos • jog[{list}]={data}^{data} – Command triggered jog move • jog[{list}]:{data}^{data} – Command triggered jog move • jog[{list}]^{data}^{data} – Command triggered jog move • kill[{list}] – Command motor kill (immediate)

  32. Program Direct Coordinate System Commands • enable[{list}] – Put disabled motors in coordinate system(s) into closed-loop, enabled, zero-velocity state (already enabled motors not affected) • disable[{list}] – Put all motors in coordinate system(s) immediately into open-loop, disabled (“killed”) state • ddisable[{list}] – Put all motors in coordinate system(s) into open-loop, disabled, (“killed”) state after delay for brake engagement • abort[{list}] – Command abort (closed-loop stop) of C.S. motors and any executing motion program (equivalent to on-line a command); closes loop of open-loop enabled motors; does not enable killed motors • begin[{list}]:{data} – Point program counter to top (or labeled point) of specified motion program (equivalent to on-line b{constant} command) • hold[{list}] – Command feed-hold (zero time base) to suspend motion-program execution (equivalent to on-line h command) • lh\[{list}] – Command quick-stop in segmented lookahead to suspend motion-program execution (equivalent to on-line \ command) • lh<[{list}] – Command reverse execution (“retrace”) in segmented lookahead (equivalent to on-line < command)

  33. Program Direct Coordinate System Commands(continued) • lh>[{list}] – Command resumption of forward execution in segmented lookahead (equivalent to on-line > command) • run[{list}] – Command continuous motion-program execution from present point, or resume from feed-hold (equivalent to on-line r command) • step[{list}] – Command single-step motion-program execution from present point (equivalent to on-line s command) • start[{list}]:{data} – Point program counter to top (or labeled point) of specified motion program and start continuous execution (equivalent to on-line b{constant}r command) • stop[{list}] – Halt motion program execution at end of latest calculated move and rewind program counter to top • pause[{list}] – Halt motion program execution at end of latest calculated move (equivalent to on-line q command) • resume[{list}] – Re-start motion program execution at from suspended pause or hold state

  34. Transmitting Text Strings from Programs • Can transmit formatted text strings with send, cmd, system commands • sendn command transmits string to specified virtual port n = 0 to 4 • Port must be ready by running getsends nprogram • String can contain formatted expression values, control characters • Example: send2"Cycle # %u starting\n", P10; • cmd command transmits string to Power PMAC command parser • gpascii parser automatically active to receive string • String can contain formatted expression values (but no control characters) • Example: cmd"&2#4->%fZ", 25.4*ZaxisSf; • Can monitor execution with Ldata.CmdStatus, Ldata.CmdCount • If program direct command is available, should use it instead • system command transmits string to Linux OS (as from prompt) • Telnet/SSH communications thread automatically active to receive string • String can contain formatted expression values (but no control characters) • Example: system"/var/ftp/usrflash/Project/C\ Language/Background/ Programs/MyCApplication"

  35. Single-Step Execution of Programs • Available for both motion and PLC programs • Works differently in each type • Motion program single-step execution rules: • Done with on-line s or program direct step command • Operates on program already pointed to • Execution normally continues until next move or dwell command • If program was in continuous execution mode, halts execution at this point • However, if bstart program command encountered, execution continues until next bstop command • Does not matter how many move or dwell commands (if any) in between • Especially useful for PVT mode move sequences • PLC program single-step execution rules: • Done with on-line or buffered step plc {list} command • Next scan executes single program line only • Ready to resume execution in later scan at following program line • bstart and bstop program commands do not affect program execution

  36. Methods of Stopping Motion Program Execution • q [pause] – No new program calculations, finish executing already calculated moves • Does not begin to stop immediately (in general) • Decel rate specified by programmed move rules • Stays on programmed path (but no blend at stopped point) • Stops at programmed point • Can resume from stopped point with r [run] or s [step] • s [step] – One additional move calculation, finish executing calculated moves • h [hold] – Feed hold: Ramp time base to zero (%0) starting immediately • Decel rate specified by Coord[x].FeedHoldSlew • Stays on programmed path • Does not stop at programmed point (in general) • Can resume from stopped point with r [run] or s [step]

  37. Methods of Stopping Motion Program Execution • %0 – Set time base value to zero, starting immediately • Decel rate specified by Coord[x].TimeBaseSlew • Stays on programmed path • Does not stop at programmed point (in general) • Can resume from stopped point with % value > 0 • \ [lh\] – Quick stop in segmented lookahead, starting immediately • Decel rate specified by Motor[x].InvAmax (one motor controls) • Stays on programmed path • Does not stop at programmed point (in general) • Acts as “feed hold” outside of segmented lookahead • Can resume from stopped point with > [lh>], < [lh<], r [run], or s [step] • a [abort] – Abort program execution and moves, starting immediately • Decel rates specified by Motor[x].AbortTa and AbortTs (per motor) • Does not stay on programmed path (in general) • Does not stop at programmed point (in general) • Cannot resume from stopped point

  38. Motion Program Execution Status Elements • Not part of C.S. status words – computed on request from multiple status bits in those words • In Script environment, this is transparent to user • In C environment, must use API function call to access • Coord[x].ProgActive • True (1) if a motion program is running or suspended so that it can resume in the C.S. (from q [pause], s [step], h [hold], %0, \ [lh\] (*)) • False (0) if motion program has been stopped with a [abort] • Cannot open program buffer to clear if true • Coord[x].ProgRunning • True (1) if a motion program is running or suspended with h or %0 in the C.S. • False (0) if suspended/stopped with q, s , a, \ (*) • Coord[x].ProgProceeding • True (1) if a motion program is running or suspended with %0 in C.S. • False (0) if suspended/stopped with q, s, a, h, \ (*) * \ [lh\] command acts as h [hold] if outside of segmented lookahead move

  39. Starting and Stopping PLC Program Execution • Commands are both on-line and buffered program • enable plc [list]– Execute scan of listed PLC program(s) in turn in following cycles, starting next scan at top of program • disable plc [list] – Do not execute scan of listed PLC program(s) in following cycles; can only restart execution at top with enable or step • pause plc [list] – Stop execution at present point; do not execute scan of listed PLC program(s) in following cycles; can restart at paused point (e.g. on while command) with resume or step • resume plc [list] – Execute scan of listed PLC program(s) in turn in following cycles, starting next scan at paused/stepped point • step plc [list]– Execute single line of listed PLC program(s) in turn in next cycle, starting next scan at paused/stepped/disabled point. If issued from within affected program, suspends operation immediately; can resume/step from next line.

  40. cx & cpx One-Line One-Shot Programs • cx {program command(s)} executes as one-line PLC program • cpx {program command(s)} executes as one-line motion program (for addressed coordinate system) • “Program” is not saved in either case • Eliminates need for open/download/close/run cycle • Useful for “MDI” (manual data input) mode in CNC-type machines • Useful for quick checks of functionality in development • Single-line loops (while, do…while) permitted • Single-line if conditional branch actions permitted • Variable modification commands (e.g. P1 += 5) permitted • Axis move commands permitted (rapid mode only for cx) • Move commands operate on axes of addressed coordinate system • pmatch automatically executed for cpx, but not for cx command

More Related