1 / 12

8-1

8-1. 8-2. 8-1. 8-1. PLC 應用程式的副程式功能可以提供一個結構化程式設計方式,因此可以減化複雜系統之設計。 ( 請先教第九章後再教本章內容,因為範例採用很多應用指令 ). 8-1 副程式說明 FEND :主程式結束 CALL :呼叫副程式 SRET :副程式返回 P0~P63 :運算元指標. 8-1. 8-2. 8-2 副程式運用 應用一 動作說明:

vaughan
Download Presentation

8-1

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. 8-1 8-2

  2. 8-1 8-1 PLC應用程式的副程式功能可以提供一個結構化程式設計方式,因此可以減化複雜系統之設計。 (請先教第九章後再教本章內容,因為範例採用很多應用指令)

  3. 8-1副程式說明 FEND:主程式結束 CALL:呼叫副程式 SRET:副程式返回 P0~P63:運算元指標 8-1

  4. 8-2 8-2副程式運用 應用一 動作說明: 以3個按鈕開關來選擇3個不同的程式,當按下PB1開關時,則就會執行自保電路,若按下PB2開關則會執行閃爍電路,若按下PB3關關則會執行電氣連鎖電路,若想換另一個程式則需按PB0開關停止動作及復歸。 1.接線圖 8-2

  5. 2.階梯圖 8-2

  6. 應用二 動作說明: 此程式是以左右移跑馬燈為主程式,雙向跑馬燈為副程式,當左右移跑馬燈來回3次之後,呼叫副程式雙向跑馬燈,副程式來回3次之後返主副程式,動作依此循環。 8-2

  7. 1.外部接線圖 8-2 2.階梯圖

  8. 應用三 動作說明: 8-2 此程式是以四個不同的程式為副程式,並透過四個選擇開關做動作選擇。 (1)第一個副程式動作說明:當SW1 On時, Y00~Y07以1 Sec時間閃爍。

  9. (2) 第二個副程式動作說明:當SW2 On時, Y00~Y17以1 Sec時間右移1個位元。 8-2 (3) 第三個副程式動作說明:當SW3 On時, Y00~Y17以1 Sec時間左移1個位元。

  10. (4)第四個副程式動作說明:當SW4 On時, Y00~Y03ON,並以1 Sec時間左移1個位元。 補充說明: ①初始Y07~Y00=00001111 ②利用內部提供1 秒時脈 (M8013) 做位元 左/右移。 ③先令M0=Y07,因Y07~Y00左移會使Y07溢位出,Y10當來 源Y07~Y00左移,再將M0當來源Y17~Y10右移。 8-2

  11. 1.外部接線圖 8-2

  12. 2.階梯圖 8-2

More Related