“ Modbus TCP เป็น Protocol ที่ได้รับความนิยมสำหรับเชื่อมต่องานระบบ SCADA หรืออุปกรณ์ภายนอก หากมี Device ที่มีการเชื่อมต่อแบบ RS-232/485 สามารถใช้จอ HMI Proface เป็นตัวกลาง Mapping Address เพื่อแปลงเป็น Modbus TCP ได้ ”
การ Mapping Modbus TCP ของจอ HMI Proface ใช้ Driver Schneider Electric SA : MODBUS SLAVE
![](https://i2.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-28.png?w=650&ssl=1)
STEP 1 : การเพิ่ม Driver Modbus TCP
1. แถบ Project Window -> เลือก Device/PLC
2. คลิก Add Device/PLC
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-30.png?w=800&ssl=1)
3. เลือก Driver Schneider Electric SA :
- MODBUS SLAVE
- Port : Ethernet (TCP)
![](https://i1.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-31.png?w=450&ssl=1)
4. คลิกปุ่ม Add เพื่อเพิ่ม Driver Modbus TCP
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-32.png?w=800&ssl=1)
STEP 2 : การ Map Address ด้วย Global D-Script
5. แถบ Project Window -> เลือก Global D-Script
6. คลิก Create
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-35.png?w=700&ssl=1)
7. กำหนดเงื่อนไขและ Address ที่ต้องการ Mapping
![](https://i2.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-36.png?w=800&ssl=1)
- กำหนดเงือนไข Trigger : Timer
- กำหนดเวลา Timer Mapping (ตัวอย่าง Mapping ทุกๆ 3 วินาที)
![](https://i1.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-37.png?w=600&ssl=1)
- กำหนด Mapping Address ที่ต้องการ ในรูปแบบ [Modbus Address] = [PLC Address]
- เช่น [w:[Modbus]400001] = [w:[PLC1]V02000]
- สามารถเลือก Input Address เพื่อเลือก Modbus หรือ PLC Address ได้
![](https://i2.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-38.png?w=800&ssl=1)
8. กดปุ่ม Close -> คลิก Yes เพื่อ Confirm Script
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-39.png?w=500&ssl=1)
- หากเขียน D-Script ผิด จะขึ้นเป็นสีแดงและ D-Script จะไม่สามารถใช้งานได้
![](https://i1.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-40.png?w=800&ssl=1)
9. Global D-Script Mapping Address พร้อมใช้งาน
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-41.png?w=800&ssl=1)
STEP 2 : ทดสอบ Mapping Address เป็น Modbus RTU ด้วยโปรแกรม ModScan
![](https://i0.wp.com/www.kpt-machinery.com/wp-content/uploads/2021/07/image-42.png?w=800&ssl=1)
” สามารถใช้จอ HMI Proface เป็นตัวกลางสำหรับ Mapping Address เป็น Modbus TCP เพื่อประยุกต์ใช้งานใน Application อื่นๆ เพิ่มเติม เช่น SCADA, Gateway, Visual Basic, Node-red เป็นต้น “