产品delta tau pmac运动控制器培训power program flow2011_第1页
产品delta tau pmac运动控制器培训power program flow2011_第2页
产品delta tau pmac运动控制器培训power program flow2011_第3页
产品delta tau pmac运动控制器培训power program flow2011_第4页
产品delta tau pmac运动控制器培训power program flow2011_第5页
免费预览已结束,剩余26页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Power PMAC Script Program Flow May 2011if (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 (MotorJogMo

2、tor.JogTa 0) / Accel & jerk times specified? JogDecelDist = MotorJogMotor.JogSpeed * MotorJogMotor.JogTa * 0.5; JogDecelDist += MotorJogMotor.JogSpeed * MotorJogMotor.JogTs * 0.5; JogDecelDist += MotorJogMotor.JogSpeed * (pow(MotorJogMotor.JogTs,2) / MotorJogMotor.JogTa) * 0.5; else / Zero accel spe

3、cified JogDecelDist = MotorJogMotor.JogSpeed * 200 * 0.5; / As for 200 msec Ta / if (JogTa 0) else / if (JogTa = 2048 bytesDefault 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 er

4、ases content of buffer, but preserves buffer itself&n close closes C.S. rotary buffer if open ( mended 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 th

5、at has not already been calculatedclear all buffers erases the buffers themselvesScript PLC Program Execution SequencingExecution of active PLC program automatically started at appropriate time in real-time interrupt (RTI) or background cycleExecution continues until end of program or end of (true)

6、while loop constitutes end of one “scan”Next scan does not start until next RTI or next turn in background cycleNext 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 ax

7、is move), program execution does not stop as motion program doesMust monitor in user code for end of moveSynchronous variable assignment useful to ensure move has startedNo need to place program within while loop to cause continued scans; Power PMAC will automatically call repeatedlyFor “one-shot” P

8、LC, last line of program should be disable plc nPower PMAC PLC Program ExecutionPLC 0 always executes in real-time interrupt (RTI)PLCs 1, 2, & 3 can execute in RTI or backgroundPLCs 4 31 always execute in backgroundSys.MaxRtPlc (= 0, 1, 2, or 3) sets highest numbered PLC to execute in RTISys.RtIntPe

9、riod sets RTI frequency (every Sys.RtIntPeriod+1 servo interrupts)Linux OS starts background scan after “sleep” interval (which releases processor for separate applications)enable plc list command (on-line or program) starts execution at next “slot” for scandisable plc list command (on-line or progr

10、am) prevents execution starting at next scanPower PMAC Program Line LabelsJump labels: e.g. N1200:, N4375821:Label must be at start of a program lineValue must be a constant (unsigned 32-bit integer), followed by a colonCan jump to label with goto, gosub, callsub, call, G, M, T, DJump command can us

11、e expression to specify label numberCan 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 colonExpression value truncated (if necessary) to unsigned 32-bit integerRegular assignment (at “loo

12、kahead” time) of value to Coordx.NcalcSynchronous assignment of value to Coordx.NsyncOccurs at start of actual execution of next move or dwellThis assignment reversible during lookahead retrace operationUseful for monitoring program and motion executionCommonly used in CNC-style applications for ope

13、rator displayOK to use both labels together: e.g. N1200: N1200 X10 Y20Power PMAC ConditionsUse 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 syntaxExpression must evaluate exactly to 0.0

14、 to be “false”8 standard comparators: =, !=, , =, , =, , !Note that = (single equals sign) is not a valid comparatorOutside of condition, = is synchronous assignment operator3 alternate comparators: , ! (stored as standard equivalent)Logical negation operator ! e.g. if (!(P1) P2+;2 conditional combi

15、natorial operators: & (and), | (or)e.g. while (P1=0) Power PMAC Conditional ActionsSingle-line conditional actions: same line as conditionalif (condition) command;else command;while (condition) command;Null action requires empty curly bracketse.g. while (Motor3.DesVel) Multi-line conditional actions

16、: delimited by curly bracketsNo ENDIF, ENDWHILE statements, as in PMAC/Turbo PMACif/while (condition) command;else command;command;Power PMAC “switch” StatementVery similar to C “switch” statement general syntax:switch (expression) case constant: command; break;case constant: command; break;default:

17、 command;Value of expression after switch rounded down to next integerconstant after case must be an integerOptional break stops execution of a particular caseOtherwise execution can continue into next casedefault can be used for when value matches no caseLimited to 256 cases unless declare more, e.

18、g.: switch(P1),512(IDE automatically allocates minimum required number)Calling Subroutines and Subprogramsgosubdata Jump to label Ndata: of same programNo R-variable (stack) argument passing permittedcallsubdata Jump to label Ndata: of same programR-variable (stack) argument passing is permittedcall

19、data Jump to subprogintdataFractional part of data specifies jump label within programMultiply fractional part by 1,000,000 to get jump label number(Note that PMAC/Turbo PMAC multiplied by 100,000)Jump back in all cases on returnImplicit return at end of all subprogramsCalling can be up to 255 level

20、s deepPLCs as well as motion program (progs) can use theseNote that call is always to subprog (not prog or plc)When top-level program is PLC, all subprograms obey PLC execution rulesRS-274 “G-Code” Subroutine CallsBasically the same as PMAC/Turbo PMAC schemeFor customizable execution of RS-274 progr

21、amsTreated as call commands to specific subprograms by default:Gdata - subprog1000 Ndata*1000:/ Preparatory codesMdata - subprog1001 Ndata*1000:/ Machine codesTdata - subprog1002 Ndata*1000:/ Tool-select codesDdata - subprog1003 Ndata*1000:/ Tool-data codesSince line jump label numbers can be 100,00

22、0, code numbers = 100 (but %fZ, 25.4*ZaxisSf;Can monitor execution with Ldata.CmdStatus, Ldata.CmdCountIf program direct command is available, should use it insteadsystem command transmits string to Linux OS (as from prompt)Telnet/SSH communications thread automatically active to receive stringStrin

23、g can contain formatted expression values (but no control characters)Example: system/var/ftp/usrflash/Project/C Language/Background/ Programs/MyCApplicationSingle-Step Execution of ProgramsAvailable for both motion and PLC programsWorks differently in each typeMotion program single-step execution ru

24、les:Done with on-line s or program direct step commandOperates on program already pointed toExecution normally continues until next move or dwell commandIf program was in continuous execution mode, halts execution at this ointHowever, if bstart program command encountered, execution continues until next bstop commandDoes not matter how many move or dwell commands (if any) in betweenEspecially useful for PVT mode move sequencesPLC program single-step execution

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论