




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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 “l(fā)oo
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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 鋼鐵冶金與耐火材料工程作業(yè)指導(dǎo)書
- 社交媒體平臺(tái)開發(fā)與技術(shù)應(yīng)用指南
- 貴州企業(yè)招聘2025貴州貴旅國(guó)際旅行服務(wù)有限公司招聘筆試參考題庫(kù)附帶答案詳解
- 新零售智慧安防解決方案手冊(cè)
- 銅川2025年陜西銅川市事業(yè)單位招聘帶編入伍高校畢業(yè)生3人筆試歷年參考題庫(kù)附帶答案詳解
- 湖南2025年湖南省住房和城鄉(xiāng)建設(shè)廳所屬事業(yè)單位選調(diào)筆試歷年參考題庫(kù)附帶答案詳解
- 海南2025年國(guó)家糧食和物資儲(chǔ)備局海南儲(chǔ)備物資管理處招聘16人筆試歷年參考題庫(kù)附帶答案詳解
- 磷酸奧司他韋膠囊聯(lián)合連花清瘟顆粒治療流行性感冒的觀察
- 營(yíng)養(yǎng)與排泄的護(hù)理課件
- 工程標(biāo)準(zhǔn)化施工手冊(cè)安裝工程部分
- 幼兒園餐廚垃圾回收合同
- 圖論算法在供應(yīng)鏈管理中的應(yīng)用
- 《養(yǎng)老機(jī)構(gòu)認(rèn)知障礙照護(hù)專區(qū)設(shè)置與服務(wù)規(guī)范》
- 交警安全防護(hù)
- 任務(wù)4 聚酯縮聚生產(chǎn)操作-工藝流程
- 新修訂煙草專賣法主要內(nèi)容
- 車輛維護(hù)定期檢查
- 不同溫度鹽度對(duì)鹵蟲
- 急性腦血管病的護(hù)理查房
- 膿毒血癥指南(醫(yī)生版)課件
- 資本市場(chǎng)與上市籌劃-講義宋麗夢(mèng)老師課件
評(píng)論
0/150
提交評(píng)論