Creating & Using Function block (FB) - siemens.asia · Function Block ... TIA Siemens - Edit View...

2
Creating & Using Function block (FB) Totally Integrated Automation Portal กำหนดชื่อให้กับ Function Block Ctrl_MotorClick OK เสร็จแล้วให้ Compile Function block 3 7 2 4 Click Function Block สร้ำง tag name, data type และ start value (ถ้ำมี ) สำหรับเป็นขำ Parameter “Input”, “Output” ของ FB Double Click Add new block 5 Function Block ที่ถูกสร้ำงขึ ้น 1 เขียน Program สำหรับ control motor 6 Drag & Drop Function blockไปยัง Main [OB] 8 9 Click OK 1. สร้าง Function Block (FB) 2. สร้าง Tags ใน FB 3. เขียน Program สาหรับ FB 4. Compile FB ตั ้งชื่อ Instant DB

Transcript of Creating & Using Function block (FB) - siemens.asia · Function Block ... TIA Siemens - Edit View...

Page 1: Creating & Using Function block (FB) - siemens.asia · Function Block ... TIA Siemens - Edit View Project Insert Save project Project tree Devices Test UDT 171110 Add new device UDT

Creating & Using Function block (FB)

Totally Integrated Automation Portal

ก ำหนดช่ือใหก้บั Function Block “Ctrl_Motor”

Click OK

เสร็จแลว้ให ้Compile Function block

3

7

2

4

Click Function Block

สร้ำง tag name, data type และ start value (ถำ้มี) ส ำหรับเป็นขำ Parameter

“Input”, “Output” ของ FB

Double Click Add new block

5

Function Block ท่ีถูกสร้ำงข้ึน

1

เขียน Program ส ำหรับ control motor 6

Drag & Drop Function blockไปยงั Main [OB] 8

9

Click OK

1. สร้าง Function Block (FB) 2. สร้าง Tags ใน FB 3. เขียน Program ส าหรับ FB 4. Compile FB

ตั้งช่ือ Instant DB

Page 2: Creating & Using Function block (FB) - siemens.asia · Function Block ... TIA Siemens - Edit View Project Insert Save project Project tree Devices Test UDT 171110 Add new device UDT

Creating & Using Function block (FB)

Totally Integrated Automation Portal

ตวัอยำ่งกำรใช ้Function block เดียวกนั ส ำหรับกำร control Motor หลำยๆ ตวั

ส ำหรับกำร control Motor ตวัท่ี 1

ส ำหรับกำร control Motor ตวัท่ี 2

Go online test

เม่ือ “Start_M1” เท่ำกบั true (เป็นกำรสัง่ให ้Motor 1 ท ำงำน)

เม่ือ “Run_M1” เท่ำกบั true ดว้ย

เม่ือ “Start_M2” เท่ำกบั true (เป็นกำรสัง่ให ้Motor 1 ท ำงำน)

เม่ือ “Run_M1” เท่ำกบั true ดว้ย

เม่ือ “Stop_M1” เท่ำกบั true (เป็นกำรสัง่หยดุกำรท ำงำนของ Motor 1)

เม่ือ “Run_M1” เท่ำกบั false ดว้ย (หยดุกำรท ำงำน)

Function Block ท่ีไดจ้ำกสร้ำงข้ึน

By…Suwichada