Chương 2 :Giao thức ghép nối ppsx

31 307 0
Chương 2 :Giao thức ghép nối ppsx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

P&I-Ch2: Protocols 1 ch. 2 giao thøc ghÐp nèi (Interfacing Protocols) Bao gåm: - Giao thøc ghÐp nèi - §Æc ®iÓm lËp tr×nh I/O P&I-Ch2: Protocols 2 2.1. Interface Protocols: • K/n: Lµ c¸c qui ®Þnh: – Signals – Data format – Rate – Error detection & correction – Command & Response set – Scenario (kÞch b¶n) ISO 7 layer Model (Ref. Computer networks) Cã thÓ ph©n chia thµnh 2 nhãm chÝnh: • Transport-Oriented Protocols (1 4) (!!!) – PhysicAL (wire, cable, connector, port), DataLink (CRC, CS, Token), NetWork (Comm. 2 networks ), Transport (Err-protected raw infor), • Application-Oriented Protocols (5 7) : – Session (Opening, End), Presentation (Common Language) vµ Application (Read/Write, Start/Stop, FileTransfer) P&I-Ch2: Protocols 3 2.1. Interface Protocols: 2.1.1. Signals: Khi thiết kế, xây dựng ghép nối máy tính, cần chú ý đặc biệt tới tín hiệu theo các yêu cầu: Hơn 1 thiết bị? => bus/mạng hay không ? => dùng bit (trờng) địa chỉ. Nếu dùng bus => Standard bus hay không? IDE v LPT-mode 0 cables l bus? tại sao? Data: Xa /gần, nhanh/chậm => Serial vs Parallel Xa: Daisy chain cho t/h hoặc nguồn cấp Các tín hiệu điều khiển và trạng thái: Control signals Status signals Handshaking signals - bt tay P&I-Ch2: Protocols 4 • Daisy chain: –Nối các thiết bị có khoảng cách từ vài đến vài chục m, đầu ra của port (module) thứ n nối với đầu vào của n+1 – Dùng cho tín hiệu (// & nt), nguồn cung cấp, handshake P&I-Ch2: Protocols 5 2.1. Interface Protocols: 2.1.1. Signals: • VÝ dô 1: PC-LPT handshaking: PC LPT port Line Printer SLCT SLTC_in H×nh 2.1.a. LPT handshake Signal P&I-Ch2: Protocols 6 2.1. Interface Protocols: 2.1.1. Signals: • VÝ dô 2: PC Comm-Modem handshaking: RTS CTS DTR DSR PC 1 Comm Port Modem or PC 2 Comm Port H×nh 2.1.b. CommPort Handshake Signals •Ph−¬ng ph¸p biÕn ®æi tÝn hiÖu: biªn, tÇn, pha, dßng, quang (c¸p quang, Ir) P&I-Ch2: Protocols 7 2.1. Interface Protocols: 2.1.1. Signals: • T/c vật lý của tín hiệu: - Direction: In/Out, Input voltage: -0.5V to Vcc +0.5V -Mức điện áp: Mức áp ? (TTL (transistor transistor logic- [0 0.8V/ 2 5V]) , 12V/ 24V/48V ) - Single End (đơn cực) vs Differential (vi sai) signals -Khả năng tải - dòng điện ra: (Fan Out, Loading): + Number of Standard/LS TTL loads, + Sink: dòng vào – LowLevel, (cỡ mA), + Source: dòng ra – HighLevel, mA/uA.(H. 2.1.c) • Nối chung/ghép nối bus đơn giản: 3 state (Hi Z), open collector (Open Drain), Mux – dồn kênh, Switch - khóa. • Hot swap – hot plugible: Y/c Vcc và t/h ( www.atmel.com ) • Cách ly (isolation): Relay, Opto Coupler, IrLED • Bus Slot, Connector, chuẩn, số chân (pin) P&I-Ch2: Protocols 8 P&I-Ch2: Protocols 9 S¬ ®å c¸ch ly quang häc ®/v tÝn hiÖu In/Out: Hình 2.2. Opto Coupler P&I-Ch2: Protocols 10 • Connectors: – D shell: DB9, DB25, – DIN, Cable & Connectors: H×nh 2.3.a. Connectors • Cable: • Flat, • Coaxial, • Shield, • Twisted Pair • Normal • Optical Fiber [...]... 110-16F 170-17F 180-1EF 1F0-1FF 20 0 -20 F PIC #2, B kh u tiờn ngt s 2, IRQ8 IRQ15 DMAC #2, 3 kờnh DRQ 16 bit reserved, dnh AVAILABLE, dnh Hard Drive 1 (AT) AVAILABLE Hard Drive 0 (AT) Game Adapter P&I-Ch2: Protocols 27 21 0 -21 7 22 0 -26 F 27 8 -27 F 28 0-2A1 2A2-2A3 2B0-2DF 2E2-2E3 2E8-2EF 2F0-2F7 2F8-2FF 300-31F 320 -32F Expansion Card Ports AVAILABLE Parallel Port 2/ LPT2 AVAILABLE clock EGA/Video Data Acquisition... P&I-Ch2: Protocols 20 2. 1 Interface Protocols: 2. 1.6 Kịch bản đối thoại Scenario: Liệt kê các trờng hợp có thể rồi áp Master các phép xử lý tơng ứng để đảm bảo việc ghép nối: không mất tin, thừa tin, quẩn, treo Thờng xây dựng: Step List hoặc Chart: Time Out ! ENQ Slave ACK NAK nothing Hinh 2. 4 Scenario Chart P&I-Ch2: Protocols 21 Hình 2. 5 USB Interlayer Interconnection Model P&I-Ch2: Protocols 22 2. 2... usually use I/O ports 22 0 -22 F Data acquisition cards frequently use 300-31F P&I-Ch2: Protocols 30 Bài tập chơng 2 2.1 Tham khảo một số giao thức: MODBUS (AEG) modbus.org, ProfiBus, ASI (Siemens), RTU ASCII (ABB), I2C từ đó thiết kế đồ án môn học: hệ thu thập - điều khiển phân tán (Mini SCADA) 2. 2 USB Protocol 2. 3 Thiết kế giao thức truyền file giữa 2 máy tính (LPT/ Comm) P&I-Ch2: Protocols 31 ... field - 2 byte ID CRC - gap - data field: 5 12 byte - 2 byte CRC FTP, Kermit, X-Modem Protocols: 128 [25 6] B/pack P&I-Ch2: Protocols 13 Hình 2. 3.d USB data packet format Byte số liệu/character/frame: (truyền không đồng bộ, RS -23 2, RS-485, RS- 422 ): ký tự hay byte đợc định dạng thành 1 frame: 1 start bit = 0, 5/6/7/8 data bit, D0 first, [parity: Even/ Odd], 1 / [1.5 / 2] stop bit = 1(s) P&I-Ch2: Protocols... vạch/digit (b&w) A(National): VN 893, CN 690-6 92, JP 45-49, GE 400-440, RU 460-469 B: com/ org C: Product D - Check sum, right most: (right to left): 10 - [(D2*3 + D3*1 + D4*3 + D5*1 + D13*1)mod10] Ví dụ: 893 123 45 123 4 7 CODE 128 , Zebra, check sum modulo 103 P&I-Ch2: Protocols 17 2. 1 Interface Protocols: 2. 1.5 Command & Response (Result/Reaction) set: Ghép Intelligent Devices (Computerized devices... Synchronous/Asynchronous? Modulation/Demodulation => tốc độ bao nhiêu kbps/kBps, tốc độ chuẩn? Vớ d: LPT: SPP mode: 50 100kBps - software, ECP: 2 4 MBps - DMA LAN Ethernet IEEE 8 02. 3: 10/100 Mbps dual speed RS2 32: 24 00/ 4800/P&I-Ch2: Protocols 9600/ 1 920 0 bps 15 2. 1 Interface Protocols: 2. 1.4 Kiểm tra, sửa lỗi, nâng cao độ tin cậy: Khi trao đổi thông tin thờng hay gây ra lỗi, đặc biệt truyền xa/ chuyển đổi t/h Nhiều... P&I-Ch2: Protocols 25 Ph lc PCs I/O Port Map Port (hex) 000-00F 020 -02F 040-05F 060-06F 070-071 080-083 Port Assignments DMA Controller, kh truy nhp trc tip 1, 4 kờnh 8 bit Master PIC 825 9A, u tiờn ngt 1, IRQ0 IRQ7 PIT, Programmable Interval Tim Keyboard Port, Real Time Clock v 64 byte CMOS-RAM DMA Page Register, gi a ch cao P&I-Ch2: Protocols 26 0A0-0AF 0C0-0CF 0E0-0EF 110-16F 170-17F 180-1EF 1F0-1FF 20 0 -20 F...Hình 2. 3.b Optical Connector & Sơ đồ: P&I-Ch2: Protocols 11 Hình 2. 3.c Sợi cáp quang: P&I-Ch2: Protocols 12 2.1 Interface Protocols: 2. 1 .2 Format số liệu: đối với file/text: số liệu nhiều => khi trao đổi (vi DAS, PLC, Digi-Oscilloscope, GPS, TelSat ) đóng gói số liệu (packaging)... (nh PIC, PIT, PPI ) => thiếu IO space Sẽ dùng thêm kiểu Mem Mapped IOs P&I-Ch2: Protocols 24 2. 2 .2 Lệnh In/Out: (x86) : Lệnh IN và OUT: chỉ dùng các thanh ghi Accumulator: 8 bit: AL, 16 bit: AX và 32 bit: EAX Chế độ địa chỉ: o Direct: for IO space: 0 0FFh Ví dụ: in al,60h ; Read KB port out 23 Eh, ax ; lệnh sai, IOaddr >25 5 out 61h, al ; beep, set/reset key flag o Indirect: for IO space 0 0FFFFh,... reaction set Các câu lệnh và trả lời có syntax riêng (cấu trúc và ngữ pháp) P&I-Ch2: Protocols 18 2. 1 Interface Protocols: 2. 1.5 Command & Response (Result) set: Case Studies: lệnh AT và Response Hayes MODEMs: Lệnh: ATDT 126 0 ' Với nhiều Options Trả lời (reaction) OK [Error] Connect @1 920 0 (result) Lệnh FX Printer: Esc * m, n1, n2; Sel Graph Mode Tham khảo các bộ lệnh của các thiết bị chuyên dùng: GPS, . 100kBps - software, ECP: 2 4 MBps - DMA LAN Ethernet IEEE 8 02. 3: 10/100 Mbps dual speed RS2 32: 24 00/ 4800/ 9600/ 1 920 0 bps P&I-Ch2: Protocols 16 2. 1. Interface Protocols: 2. 1.4. Kiểm tra, sửa. to left): 10 - [(D2*3 + D3*1 + D4*3 + D5*1 + D13*1)mod10] VÝ dô: 893 123 45 123 4 7 • CODE 128 , Zebra, check sum modulo 103 P&I-Ch2: Protocols 18 2. 1. Interface Protocols: 2. 1.5. Command &. Full Sector: gap - 5 byte ID field - 2 byte ID CRC - gap - data field: 5 12 byte - 2 byte CRC. FTP, Kermit, X-Modem Protocols: 128 [25 6] B/pack. P&I-Ch2: Protocols 14 Byte sè liÖu/character/frame:

Ngày đăng: 08/08/2014, 17:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan