งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Communication Technique สรไกร ไกรปุย หน่วยวิจัยโลจิสติกส์และวิศวกรรมสมองกลฝังตัว มหาวิทยาลัยบูรพา

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Communication Technique สรไกร ไกรปุย หน่วยวิจัยโลจิสติกส์และวิศวกรรมสมองกลฝังตัว มหาวิทยาลัยบูรพา"— ใบสำเนางานนำเสนอ:

1 Communication Technique สรไกร ไกรปุย หน่วยวิจัยโลจิสติกส์และวิศวกรรมสมองกลฝังตัว มหาวิทยาลัยบูรพา http://www.BAL-Labs.comhttp://www.BAL-Labs.com/

2 Prerequisites ★ TCP/IP Concept (Data Communication and Networking) ★ Serial port Interfacing (Microprocessor and Microcontroller Interfacing) ★ Database Connection (Mysql, MicrosoftSQL, PostgreSQL etc) ★ Web Application (PHP, Javascript etc.)

3 ❖ Part I: ✦ TCP/IP Concept (socket programming) ✦ Serial Communication ✦ Database Connection ✦ Multithreading Concept ❖ Part II: ✦ TCP/IP Concept (socket programming) ✦ Serial Communication ✦ Database Connection ✦ Multithreading Concept Contents

4 ❖ Part I: ✦ TCP/IP Concept (socket programming) ✦ Serial Communication ✦ Database Connection ✦ Multithreading Concept ❖ Part II: ✦ System Architecture ✦ C/C++ Language Programming ✦ JAVA Language Programming ✦ Visual C# Language Programming Contents

5 ❖ Part III: ✦ PHP Language Programming ✦ Ajax Technique Contents

6 Part I Theories and Concepts

7 TCP/IP Protocol Stack Packet Format

8 IP ICMP, IGMP ARP TCPUDP Socket FTP, Telnet, etc. NetBIOS Ethernet, Token Ring, etc Port Address

9 Embedded TCP/IP – Application Areas

10 Serial Port Connector Serial port คือ เป็นส่วนที่ใช้ในการเชื่อมต่อกับอุปกรณ์ภายนอกแบบอนุกรมตาม มาตรฐานการเชื่อมต่อข้อมูลแบบ RS232 จำกัดความยาวสายไว้ที่ 50 ฟุต ( หรือ ประมาณ 15 เมตร )

11 Serial Port Configuration Windows-based - COM1, COM2, COM3,… Linux-based (character device) - /dev/ttyS0, /devttyS1,… - /dev/ttyUSB0, /dev/ttyUSB1.... Baud rate ความเร็วในการสื่อสารบิตต่อวินาที ex. 9600, 14400, 19200, 56700.. Data bit จำนวนบิตใน 1 character Parity bit บิตสำหรับการเช็ค error ของการส่งข้อมูล Stop bit บิตสำหรับ detect end of character Flow control ชนิดการควบคุมการรับ - ส่งข้อมูล

12 Well-known Database Server Database Server ที่นิยมได้แก่ - Oracle - DB2 (IBM) - Ms SQL Server - MySQL - PostgreSQL - SYBASE Simplified database system environment

13 DBMS and Database Keywords Database Management System Defining a particular database in terms of its data types, structures, and constraints Constructing or Loading the initial database contents on a secondary storage medium Manipulating the database: Retrieval: Querying, generating reports Modification: Insertions, deletions and updates to its content Accessing the database through Web applications Processing and Sharing by a set of concurrent users and application programs – yet, keeping all data valid and consistent Basics keywords tablefieldrow, columnrecordsetselect, insert, delete, updateprimary key

14 ฐานข้อมูล (Database) กลุ่มของข้อมูลที่ถูกเก็บรวบรวมไว้ในที่เดียวกันอย่างเป็นระบบ เพื่อให้สามารถ ค้นหา แก้ไข ลบ เพิ่มเติมได้อย่างมีประสิทธิภาพ เทเบิล (Table) เป็นส่วนที่เก็บข้อมูลที่เกี่ยวกับสิ่งใดสิ่งหนึ่งไว้ เรคอร์ด (Record) และ ฟิลด์ (Field) Table จะแบ่งออกเป็น Row และ Column โดยแต่ละแถวคือข้อมูล 1 รายการ หรือ 1 record, ข้อมูลแต่ละส่วนของ record จะถูกแยกเก็บไว้ใน Column ต่างๆ ซึ่งเรียกว่า Field

15 คีย์หลัก (Primary Key) เป็น Field ที่ใช้แยกแยะ record ต่างๆ ใน Table นั้น เรามักกำหนดให้ Field หนึ่ง ( หรือมากกว่าก็ได้ ) ทำหน้าที่เป็น primary key เพื่อให้ มั่นใจว่าสามารถบ่งชี้ (identify) ได้ว่า record ใดเป็น record ใด ค่า primary key แต่ละ record ห้ามซ้ำกัน คีย์นอก (Foreign Key) เป็น Field ที่เก็บค่า field ที่เป็น Primary Key ของ table อื่นไว้ ใช้เพื่อแสดงการเชื่อมโยงระหว่าง record ใน table ทั้งสอง Field ที่เป็น foreign key สามารถมีซ้ำกันได้ใน record ต่างๆ Schema คือโครงสร้างของ Table ทั้งหมดในฐานข้อมูลนั้นๆ โดยทั่วไปแสดง Table name, Field, Primary Key, Foreign Key

16 SQL Command INSERT INTO Table1 VALUES(value1,value2,…) SELECT Column1, Column2 FROM Table1 UPDATE Table1 SET Column1 = Value1, Column2 = Value2 WHERE Some_Column = Some_Value DELETE FROM Table1 WHERE Some_Column = Some_Value DDL (Data Definition Language) คำสั่งที่ใช้ในการเตรียมที่เก็บข้อมูล คำสั่งสร้าง / แก้ไข / ลบ - ฐานข้อมูล, Table, Key ฯลฯ DML(Data Manipulation Language) คำสั่งที่ใช้ในการทำงานกับข้อมูล คำสั่งกลุ่ม Insert, Update, Delete, Retrieve(Select)

17 Multithreading concept Thread คือ หน่วยการทำงานย่อยที่อยู่ใน process (light weight process) Multithreading คือการทำงานของหลายๆ thread ใน 1 process

18 Thread Libraries - POSIX Thread (pthread) A POSIX standard (IEEE 1003.1c) API for thread creation and synchronization API specifies behavior of the thread library, implementation is up to development of the library Common in UNIX operating systems (Solaris, Linux, Mac OS X) - WIN32 Thread The primary data structures of a thread include: ETHREAD (executive thread block) KTHREAD (kernel thread block) TEB (thread environment block) - Java Thread Java threads are managed by the JVM Java threads may be created by: Extending Thread class Implementing the Runnable interface

19 Part II Programming Techniques

20 Programming Techniques 3 องค์ประกอบหลัก ในการพัฒนาระบบเพื่อเฝ้าติดตามและแจ้งเตือนของระบบ (Monitoring and Alert System) ส่วนที่ 1 : ( ภายใน Production Line) ✴ การติดต่อระหว่าง STM32 Board และ เครื่อง WorkStation ผ่านพอร์ตอนุกรม RS232 ส่วนที่ 2 : ( การเชื่อมต่อกับระบบฐานข้อมูลกลาง ) ✴ การติดต่อระหว่างโปรแกรมภายในเครื่อง WorkStation และ MySQL Database Server ส่วนที่ 3 : ( การใช้เทคนิค Multi-threading ในโลกความเป็นจริง ) ✴ การใช้เทคนิค Threading เพื่อรับค่าผ่าน Serial Port ที่ถูกเชื่อมต่ออยู่กับ STM32 Board

21 C/C++ Language Programming Compiler & Library - gcc compiler (current version 4.4.5) - libmysqlclient-dev - libpthread Installation library (linux ubuntu) - sudo apt-get install libmysqlclient-dev

22 C/C++ serial port Open & initialize

23 C/C++ serial port Read data from serial port

24 C/C++ Database Connect to MySQL

25 C/C++ Database Insert data to MySQL

26 C/C++ compile & run Command (on linux) compile - gcc myapp.c –o myapp –lpthread –lmysqlclient run -./myapp

27 Java Language Complier and Library - IDE ที่นิยม Eclipse, Netbeans - JDK 1.5+ (current version 1.6) - Serial port library (RXTXcomm) - MySQL Connector (recommend 5.0.8)

28 Java Installation Installation of rxtxSerial copy rxtxSerial.dll to [JDKdirectory]\jre\bin\rxtxSerial.dll copy RXTXcomm.jar to [JDK-directory]\jre\lib\ext\RXTXcomm.jar Installation of mysqlconnector copy mysql-connector-java-5.0.8-bin.jar to [JDK-directory]\jre\lib\ext\ mysql-connector-java-5.0.8-bin.jar

29 Java code serial port Identify port name

30 Java code serial port Initialize serial port

31 Java code serial port Read data from serial port

32 Java code Database Connect to MySQL

33 Java code Database Insert data to MySQL

34 Java compile & run Compile & Run command javac MyClass.java java MyClass Eclipse IDE press ctrl + F11

35 .NET Language Compiler and Library -.NET Framework 2.0+(current version3.5) - MySQL Connector (recommend 5.0.9)

36 .NET Installation Install mysql connector/net Create a new project Add reference to: MySql.Data Add “using MySql.Data.MySqlClient;”

37 .NET Code serial port Port setting

38 .NET Code serial port Read data from serial port by Event

39 .NET Code Database Open connection & insert data

40 .NET Compile & run Compile & run - press F6 (build) - press F5 (build & run)

41 Part III Web Application Techniques

42 Web-based Monitor Why Web-based monitoring ? - สะดวกต่อผู้ใช้ไม่ต้องติดตั้งโปรแกรมในเครื่อง - สะดวกต่อผู้ดูแลระบบในการแก้ไขปรับปรุง - สามารถเฝ้าดูได้จากทุกที่ ที่มี internet - ค่าใช้จ่ายและค่าบำรุงรักษาต่ำลง

43 PHP & MySQL ขั้นตอนการแสดงผลทาง web browser - request to Web server - PHP connect & query database - response to web browser

44 PHP Code Connect & query from MySQL

45 Ajax technique Ajax ( Asynchronous JavaScript And XML) คือ เทคนิค การพัฒนา web application โดยทำงานอยู่เบื้องหลัง เพื่อให้ตอบสนองต่อผู้ใช้ได้ดียิ่งขึ้น

46 Ajax Technique

47

48


ดาวน์โหลด ppt Communication Technique สรไกร ไกรปุย หน่วยวิจัยโลจิสติกส์และวิศวกรรมสมองกลฝังตัว มหาวิทยาลัยบูรพา

งานนำเสนอที่คล้ายกัน


Ads by Google