1. Trang chủ
  2. » Tài Chính - Ngân Hàng

Giao tiếp giữa vi điều khiển PIC với máy tính qua cổng USB điều khiển khối LED 3d

71 656 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 71
Dung lượng 1,9 MB

Nội dung

Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN LỜI CẢM ƠN Trước tiên xin gửi lời cảm ơn đến thầy, cô giáo Trường Đại Học Mở TPHCM, Ngành Điện - Điện tử nhiệt tình giảng dạy truyền đạt kiến thức, kinh nghiệm quí giá suốt bốn năm giảng đường đại học Tôi xin gửi lời cảm ơn sâu sắc đến THS Trần Quang Thuận, Thầy tận tình hướng dẫn, cung cấp tài liệu nhiều thông tin bổ ích suốt thời gian thực đồ án Tôi xin gửi lời cảm ơn đến tập thể lớp CN08B1, người học tập chia nhiều kiến thức suốt thời gian qua Cám ơn gia đình bên động viên suốt thời gian qua Một lần xin gửi lời cảm ơn chân thành sâu sắc TP.HCM , tháng năm 2013 Sinh viên thực Nguyễn Minh Giàu SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN LỜI MỞ ĐẦU Có thể nói, vi điều khiển phổ biến Việt Nam , đươc ứng dụng nhiều Ngày , tiến công nghệ bán dẫn thúc đẩy phát triển không ngừng ngành công nghiệp tự động , trình điều khiển tự động hóa điều khiển thời gian thực đặt yêu cầu lớn việc trao đổi liệu hệ thống hay phận hệ thống Với đề tài giao tiếp PIC với máy tính qua USB để điều khiển khối LED 3D giúp ta có nhìn tổng quát chức vi điều khiển giúp ta tìm hiểu thêm phần giao tiếp máy tính từ có ứng dụng cao lĩnh vực điều khiển tự động SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN MỤC LỤC Lời cảm ơn Lời mở đầu CHƯƠNG I : TỔNG QUAN ĐỀ TÀI 1.1 Tìm hiểu PIC18F4550 1.1.1 Giới thiệu PIC18F4550 1.1.2 Sơ đồ Khối 1.1.3 Module USB PIC18F4550 1.2 Sơ lược linh kiện dùng mạch 1.2.1 IC ghi dịch 74HC595 1.2.2 IC đệm ULN2803 1.2.3 MOSFETs IRF 9640 CHƯƠNG II : TỔNG QUAN VỀ GIAO TIẾP USB 2.1 Giới thiệu giao tiếp USB 2.2 Cấu trúc truyền dẫn USB 2.3 Các dạng truyền dẫn USB CHƯƠNG III : THIẾT KẾ PHẦN CỨNG 3.1 Tổng quát phần cứng 3.2 Khối điều khiển 3.3 Khối hiển thị 3.3.1 Phần hiển thị lớp 3.3.2 Phần hiển thị cột 3.4 Khối LED CUBE 12X12X12 3.5 Khối nguồn CHƯƠNG IV : LẬP TRÌNH VÀ THIẾT KẾ GIAO DIỆN 4.1 Giới thiệu phần mềm dùng đồ án 4.1.1 PROTUES 4.1.2 CCS C COMPILERS 4.1.3 WINDRIVER 4.1.4 MICROSOFT VISUAL STUDIO 4.2 Firmware cho PIC18F4550 4.2.1 Firmware PIC18F4550 4.2.2 Phân tích Firmware 4.3 Giao diện giao tiếp PIC18F4550 máy tính 4.3.1 Phần code giao diện giao tiếp 4.3.2 Phân tích 4.4 Lưu đồ giải thuật CHƯƠNG V : THI CÔNG SẢN PHẨM 5.1 Sơ đồ mạch 5.2 Phần cứng hoàn chỉnh 5.3 Giao diện điều khiển hoàn chỉnh TÀI LIỆU THAM KHẢO SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 1 1 5 9 11 12 12 13 14 14 15 17 18 20 20 20 21 22 23 24 24 33 36 36 53 55 58 58 60 63 67 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN CHƯƠNG I : TỔNG QUAN ĐỀ TÀI 1.1 Giới thiệu sơ lược PIC18F4550 1.1.1 Giới thiệu PIC18F4550 Hình 1.1 – PIC18F4550 PIC18F4550 vi xử lý đa chức có giá thành phù hợp PIC18F4550 sản phẩm họ vi xử lý PIC thông dụng công ty Microchip Mỹ có trụ sở đặt Chandler, Arizona (Mỹ) Về tính PIC18F4550 phù hợp với ứng dụng từ đơn giản đến phức tạp Cũng dòng PIC khác ngôn ngữ lập trình assembler , người dùng lập trình PIC ngôn ngữ C quen thuộc thông qua phần mềm hỗ trợ (PIC18C , CCS , MIKROC …) Ưu điểm vi xử lý PIC18F4550 PIC hỗ trợ kết nối USB, nghĩa có mạch USB gắn bên có sẵn chân đầu để nối trực tiếp với máy tính mà không cần mạch kéo hay mạch gắn khác PIC18F4550 có nhớ chương trình 32KB , nhớ RAM 2KB , EEPROM 256 Byte để lưu trữ liệu , ports điều khiển , định thời bit ( Timer0 Timer2 ) , định thời 16 bit ( Timer1 Timer 3) , biến đổi ADC 10 bit có 13ngõ vào (AN0 AN12) , sử dụng thạch anh tối đa 48Mhz… Năng lượng tiêu thụ : PIC18F4550 1.1.2 MIN (mA) 200 MAX (mA) 300 Sơ đồ chân SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN Hình 1.2 – Các kiểu chân PIC18F4550 thông dụng SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN Bảng 1.1 - chức chân PIC18F4550 Chân PIC , 14 33 40 15 17, 23 26 19 22 , 27 30 10 , 14 ,13 23 ,24 11,32 12,31 33,34,35 33 34 Ký hiệu RA0 RA5 , RA6 RB0 RB7 RC0 RC2 , RC4 RC7 RD0 RD3 , RD4 RD7 RE0 RE2 , RE3 CLKO,CLKI D- , D+ MCLR AN0 AN12 VCC/VDD GND INT0,INT1,INT2 SDA SCL Chức PORT A PORT B PORT C PORT D PORT E lấy xung clock ( thạch anh ) Dùng kết nối USB Chân RESET Dùng lấy tín hiệu ADC Chân nguồn MASS Các ngắt Vào Data nối tiếp đồng I2C Vào Clock nối tiếp I2C 1.1.3 Module USB PIC18F4550 Module USB vi điều khiển PIC18F4550 trang bị SIE (Serial Interface Engine ) 2.0 hỗ trợ tốc độ full speed low speed cho phép giao tiếp với host USB Bên cạnh có số thành phần hỗ trợ cho SIE USB RAM , truyền nhận Transceiver , khối tạo nguồn cho module USB , khối giao tiếp với truyền nhận Transceiver USB bên ngoài, cho phép định nghĩa endpoint linh động USB RAM … Sơ đồ khối module USB PIC18F4550 : SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN Hình 1.3 – Module USB PIC 18F4550 Để điều khiển module USB , Microchip cung cấp cho người sử dụng ghi điều khiển.Một số ghi liên quan đến module USB sau : • • • • • • USB Control register (UCON) : ghi chứa bit điều khiển module USB USB Configuration register (UCFG) : ghi chứa bit điều khiển cấu hình module USB USB Transfer Status register (USTAT) : ghi chứa bit trạng thái module USB USB Device Address register (UADDR) : ghi chứa địa module USB cung cấp host Frame Number registers (UFRMH:UFRML) : ghi chứa số thứ tự khung liệu nhận Endpoint Enable registers (UEPn) : ghi chứa bit điều khiển endpoint.Có tất 16 ghi UEPn điều khiển 16 endpoint module USB Ngoài có số ghi chứa bit cho phép ngắt module USB.Để hiểu rõ chức cụ thể ghi tham khảo thêm datasheet PIC18F4550 SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 1.2 Sơ lược linh kiện dùng mạch 1.2.1 IC 74HC595 Hình 1.4 – IC 74HC595 74HC595 IC ghi dịch bit kết hợp chốt liệu với ngõ ra.Thường dùng mạch quét LED matrix, đoạn …để tiết kiệm số chân vi điều khiển dủng mở rộng số chân điều khiển việc nối tiếp đầu vào liệu IC khác 74HC595 có ngõ mức có dòng tầm 35mA , điện áp hoạt động từ 2V – 6V Bảng 1.2 – Chức chân cùa 74HC595 Chân Ký hiệu Chức 15 , Q0 Q7 Các chân Ngõ 8/16 GND/VCC Mass/Nguồn 13 OE Chân enable tích cực mức thấp cho phép ngõ hoạt động 10 MR Khi chân tích cực mức thấp liệu IC bị xóa 11 SH_CP Khi có xung clock cạnh sườn xuống bit dịch vào IC 12 ST_CP Khi có xung clock cạnh sườn lên xuất liệu 14 DS Đưa liệu vào IC Nguyên tắc hoạt động 74HC595 : Ta hình dung đơn giản hoạt động đưa liệu vào IC giống “ xếp hàng “ Đầu tiên ta đưa liệu vào chân DS , sau ta tác dụng xung vào chân SH để ghi vào IC giống dưa người vào hàng , sau ta làm bước tương tự để đưa liệu vào lúc ta hình dung người thứ vào hàng đứng vị trí người thứ người thứ tiến lên phía trước ,cứ ta đưa liệu vào IC đến đủ ta tác dụng xung vào chân ST để đưa toàn liệu SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN Bảng 1.3 – Thông số hoạt động IC SER ß DS SRCLK ß SH_CP SRCLR ß MR RCLK ß ST_CP 1.2.2 IC ULN2803 Hình 1.5 – IC ULN2803 ULN2803 IC đệm đảo với ngõ ngõ tương ứng có cấu tạo bên cặp Darlington Khi ngõ vào mức cao, transistor kích dẫn, tương ứng ngõ đưa xuống chân GND tức mức thấp Khi ngõ vào mức thấp, transistor không kích dẫn, ngõ tương ứng trạng thái ngõ thả Để tạo mức cần gắn thêm điện trở treo ngõ IC ULN2803 SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN Bên ULN 2803 có mắc thêm Diode tránh dòng ngược điều khiển thiết bị có cuộn dây (ví dụ: rơle …) Bảng 1.4 – Thông số ULN2803 1.2.3 MOSFET IRF 9640 Hình 1.6 – IRF 9640 Mosfet Transistor hiệu ứng trường (Metal Oxide Semiconductor Field Effect Transistor) transistor đặc biệt có cấu tạo hoạt động khác với transistor thông thường , Mosfet có nguyên tắc hoạt động dựa hiệu ứng từ trường để tạo dòng điện , linh kiện có trở kháng đầu vào lớn thích hợp cho khuyếch đại nguồn tín hiệu yếu , Mosfet sử dụng nhiều mạch nguồn Monitor, nguồn máy tính Với ứng dụng cho mạch LED CUBE ta dùng Mosfet có tần số đóng cắt cao transistor , thích hợp dùng có mạch quét LED dùng tần số lớn SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN { timer12.Interval = speed - 10; effect12(); i ; x++; if (i == 0) { timer12.Enabled = false; } if (x == 33) { x = 0; } } private void effect01( ) { DWORD dwBuffSize = 49; byte[] buffer = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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F,0xF0,0xFF, SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 58 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 0xFF,0xFF,0xF0,0xFF,0xC0,0x3F,0xC0,0x3F,0x80,0x1F,0x80,0x1F,0x80,0x1F,0x80,0x1F,0 xC0,0x3F,0xC0,0x3F,0xF0,0xFF,0xFF,0xFF, 0xE0,0x7F,0xC0,0x3F,0x80,0x1F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x 00,0x0F,0x80,0x1F,0xC0,0x3F,0xE0,0x7F, 0xC0,0x3F,0x80,0x1F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x 00,0x0F,0x00,0x0F,0x80,0x1F,0xC0,0x3F, 0x80,0x1F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x80,0x1F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0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0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 59 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x80,0x1F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x80,0x1F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F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0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F, 0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x0 0,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F }; for (int j = 0; j < 5; j++) { byte[] buffer01 = new byte[49]; buffer01[0] = 1; for (int i = 1; i < 49; i++) { buffer01[i] = buffer[(i - 1) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer01, dwBuffSize, TIME_OUT, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer02 = new byte[49]; buffer02[0] = 2; for (int i = 1; i < 49; i++) { buffer02[i] = buffer[(i + 47) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer02, dwBuffSize, TIME_OUT, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer03 = new byte[49]; buffer03[0] = 3; for (int i = 1; i < 49; i++) { buffer03[i] = buffer[(i + 95) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer03, dwBuffSize, TIME_OUT, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 60 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN byte[] buffer04 = new byte[49]; buffer04[0] = 4; for (int i = 1; i buffer04[i] = buffer[(i + 143) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer04, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer05 = new byte[49]; buffer05[0] = 5; for (int i = 1; i buffer05[i] = buffer[(i + 191) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer05, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer06 = new byte[49]; buffer06[0] = 6; for (int i = 1; i buffer06[i] = buffer[(i + 239) + (x * 288)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer06, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); } } } private void effect02( ){…….} private void effect03( ){…….} private void effect04( ){…….} private void effect05( ){…….} private void effect06( ){…….} private void effect07( ){…….} private void effect08( ){…….} private void effect09( ){…….} private void effect10( ){…….} private void effect11( ){…….} private void effect12( ){…….} < 49; i++) { TIME_OUT, < 49; i++) { TIME_OUT, < 49; i++) { TIME_OUT, }} Dùng cho phương pháp quét lớp Về không khác phương pháp dùng cho quét cột , khác biệt số byte truyền lần khác ta cần thay đổi số lượng byte cần phải truyền lần Dưới hiệu ứng dùng cho phương pháp quét lớp : private void Airscrew1( ) //hiệu ứng có hình dạng chong chóng xoay { DWORD dwBuffSize = 56; byte[] buffer = { 2,36,64,2,36,64,2,36,64,2,36,64,2,36,64,2,36,64, 4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32, 8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16, 144,0,9,144,0,9,144,0,9,144,0,9,144,0,9,144,0,9, 96,0,6,96,0,6,96,0,6,96,0,6,96,0,6,96,0,6, 96,0,6,96,0,6,96,0,6,96,0,6,96,0,6,96,0,6, 144,0,9,144,0,9,144,0,9,144,0,9,144,0,9,144,0,9, 8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16, 4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32, 2,36,64,2,36,64,2,36,64,2,36,64,2,36,64,2,36,64, 1,24,128,1,24,128,1,24,128,1,24,128,1,24,128,1,24,128, 1,24,128,1,24,128,1,24,128,1,24,128,1,24,128,1,24,128,//1 SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 61 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 4,72,128,4,72,128,4,72,128,4,72,128,4,72,128,4,72,128, 8,132,64,8,132,64,8,132,64,8,132,64,8,132,64,8,132,64, 16,2,33,16,2,33,16,2,33,16,2,33,16,2,33,16,2,33, 32,1,18,32,1,18,32,1,18,32,1,18,32,1,18,32,1,18, 224,0,14,224,0,14,224,0,14,224,0,14,224,0,14,224,0,14, 112,0,7,112,0,7,112,0,7,112,0,7,112,0,7,112,0,7, 72,128,4,72,128,4,72,128,4,72,128,4,72,128,4,72,128,4, 132,64,8,132,64,8,132,64,8,132,64,8,132,64,8,132,64,8, 2,33,16,2,33,16,2,33,16,2,33,16,2,33,16,2,33,16, 1,18,32,1,18,32,1,18,32,1,18,32,1,18,32,1,18,32, 0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64, 2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,//2 8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0, 16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129, 32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66, 32,2,34,32,2,34,32,2,34,32,2,34,32,2,34,32,2,34, 224,1,30,224,1,30,224,1,30,224,1,30,224,1,30,224,1,30, 120,128,7,120,128,7,120,128,7,120,128,7,120,128,7,120,128,7, 68,64,4,68,64,4,68,64,4,68,64,4,68,64,4,68,64,4, 66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4, 129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8, 0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16, 0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32, 4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,//3 16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,8,130,32,8,130,32,8,130,32,8,130,32,8,130,32,8,130, 32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66, 224,3,62,224,3,62,224,3,62,224,3,62,224,3,62,224,3,62, 124,192,7,124,192,7,124,192,7,124,192,7,124,192,7,124,192,7, 66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4, 65,16,4,65,16,4,65,16,4,65,16,4,65,16,4,65,16,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8, 0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16, 8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,//4 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,8,130,32,8,130,32,8,130,32,8,130,32,8,130,32,8,130, 224,7,126,224,7,126,224,7,126,224,7,126,224,7,126,224,7,126, 126,224,7,126,224,7,126,224,7,126,224,7,126,224,7,126,224,7, 65,16,4,65,16,4,65,16,4,65,16,4,65,16,4,65,16,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8, SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 62 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,//5 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 224,15,254,224,15,254,224,15,254,224,15,254,224,15,254,224,15,254, 127,240,7,127,240,7,127,240,7,127,240,7,127,240,7,127,240,7, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,//6 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 127,240,7,127,240,7,127,240,7,127,240,7,127,240,7,127,240,7, 224,15,254,224,15,254,224,15,254,224,15,254,224,15,254,224,15,254, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,//7 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 65,16,4,65,16,4,65,16,4,65,16,4,65,16,4,65,16,4, 126,224,7,126,224,7,126,224,7,126,224,7,126,224,7,126,224,7, 224,7,126,224,7,126,224,7,126,224,7,126,224,7,126,224,7,126, 32,8,130,32,8,130,32,8,130,32,8,130,32,8,130,32,8,130, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1, 128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,//8 128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8, 64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4, 65,16,4,65,16,4,65,16,4,65,16,4,65,16,4,65,16,4, 66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4, 124,192,7,124,192,7,124,192,7,124,192,7,124,192,7,124,192,7, 224,3,62,224,3,62,224,3,62,224,3,62,224,3,62,224,3,62, 32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66, 32,8,130,32,8,130,32,8,130,32,8,130,32,8,130,32,8,130, 32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2, 16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1, SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 63 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0, 0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,//9 0,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,16, 129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8, 66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4, 68,64,4,68,64,4,68,64,4,68,64,4,68,64,4,68,64,4, 120,128,7,120,128,7,120,128,7,120,128,7,120,128,7,120,128,7, 224,1,30,224,1,30,224,1,30,224,1,30,224,1,30,224,1,30, 32,2,34,32,2,34,32,2,34,32,2,34,32,2,34,32,2,34, 32,4,66,32,4,66,32,4,66,32,4,66,32,4,66,32,4,66, 16,8,129,16,8,129,16,8,129,16,8,129,16,8,129,16,8,129, 8,128,0,8,128,0,8,128,0,8,128,0,8,128,0,8,128,0, 4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0, 0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,//10 1,18,32,1,18,32,1,18,32,1,18,32,1,18,32,1,18,32, 2,33,16,2,33,16,2,33,16,2,33,16,2,33,16,2,33,16, 132,64,8,132,64,8,132,64,8,132,64,8,132,64,8,132,64,8, 72,128,4,72,128,4,72,128,4,72,128,4,72,128,4,72,128,4, 112,0,7,112,0,7,112,0,7,112,0,7,112,0,7,112,0,7, 224,0,14,224,0,14,224,0,14,224,0,14,224,0,14,224,0,14, 32,1,18,32,1,18,32,1,18,32,1,18,32,1,18,32,1,18, 16,2,33,16,2,33,16,2,33,16,2,33,16,2,33,16,2,33, 8,132,64,8,132,64,8,132,64,8,132,64,8,132,64,8,132,64, 4,72,128,4,72,128,4,72,128,4,72,128,4,72,128,4,72,128, 2,32,0,2,32,0,2,32,0,2,32,0,2,32,0,2,32,0, 0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,0,4,64,//11 }; for (int j = 0; j < 5; j++) { byte[] buffer01 = new byte[55]; buffer01[0] = 1; for (int i = 1; i buffer01[i] = buffer[(i - 1) + (x * 216)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer01, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer02 = new byte[55]; buffer02[0] = 2; for (int i = 1; i buffer02[i] = buffer[(i + 53) + (x * 216)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer02, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer03 = new byte[55]; buffer03[0] = 3; for (int i = 1; i buffer03[i] = buffer[(i + 107) + (x * 216)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer03, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); byte[] buffer04 = new byte[55]; buffer04[0] = 4; for (int i = 1; i buffer04[i] = buffer[(i + 161) + (x * 216)]; } usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer04, dwBuffSize, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)); } } SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 < 55; i++) { TIME_OUT, < 55; i++) { TIME_OUT, < 55; i++) { TIME_OUT, < 55; i++) { TIME_OUT, 64 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN 4.4.2 Phân tích Hình 4.7 – Giao diện giao tiếp với máy tính Phần giới thiệu phần mềm WINDRIVER có đề cập đến file thư viện led_cube_lib.dll wdapi_dotnet1010.dll , thư viện quan trọng việc viết chương trình giao tiếp với máy tính.Khi add thư viện vào phần References project ta lập visual studio Chúng ta sử dụng chủ yếu thư viện led_cube_lib.dll ,còn wdapi_dotnet1010.dll thư viện kèm theo muốn sử dụng thư viện Các ủy quyền lớp để quản lý có led_cube_lib.dll mà ta cần quan tâm ( ta xem phần phần Object Browser led_cube_lib.dll ) : • • • • • D_USER_ATTACH_CALLBACK : Khởi tạo việc truyền nhận liệu D_USER_DETACH_CALLBACK : Thông báo cho người sử dụng việc kết nối hay kết thúc việc truyền nhận D_USER_TRANSFER_COMPLETION : Gán kiện truyền nhận kết thúc vào hàm xử lý đọc viết liệu USB xây dựng D_USER_POWER_CHANGE_CALLBACK : Sử dụng để thông báo có thay đổi nguồn dây USB LED_CUBE_Device : Chứa hàm để thực việc cài đặt cấu hình cho thiết bị USB hay hàm theo dõi trạng thái truyền nhận thiết bị SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 65 Đồ án tốt nghiệp • • • GVHD : THS TRẦN QUANG THUẬN LED_CUBE_ DeviceManager : quản lý thiết bị USB số lượng thiết bị USB gắn vào LED_CUBE_ Pipe : chứa nhiều hàm để thực việc đọc viết liệu , kiểm tra truyền nhận , kiểm soát việc khởi động dừng đường ống … Pipelist : Quản lý đường ống truyền nhận thiết bị Nguyên lý hoạt động giao diện giao tiếp USB Với yêu cầu phần cứng cần truyền liệu xuống PIC ,các công việc lại PIC đảm trách Chế đô truyền FULLSPEED thiết lập số byte truyền lần tối đa ta gửi lần tối đa 64 byte Với phương pháp quét cột để LED CUBE hiển thị hiệu ứng tĩnh cần có mảng 288 byte gửi xuống PIC , số lượng vượt cho phép chia nhỏ mảng truyền làm mảng nhỏ , mảng có 48byte chia nhỏ từ mảng lớn byte định hướng.Với phương pháp quét lớp mảng gồm 216 byte ta chia mảng nhỏ , mổi mảng gồm 54 byte chia byte định hướng Hiệu ứng động LED CUBE nói nôm na tập hợp hiệu ứng tĩnh với thời gian số khung hình việc truyền liệu từ máy tính xuống PIC định.Để hiểu thêm ta phân tích số phần quan trọng giao diện giao tiếp USB : Phần giao diện v Nút nhấn RUN Dùng để khởi động hiệu ứng bất với thông số ta chọn.Nút RUN có nhiệm vụ mở TIMER với thông số điều khiển hiệu ứng ta chọn v Nút nhấn STOP Dừng lại TIMER thực thi v Phần CHỌN HIỆU ỨNG Tên hiệu ứng nằm combobox , ta chọn hiệu ứng dẫn ta đến phần có chứa hàm để gửi mảng liệu xuống PIC v Phần TIME Chính số lần lặp TIMER với mức thời gian có combobox, không đòi hỏi xác thời gian mức tương đối dụ đơn giản cho việc thiế lập thời gian này: giả sử x số lần lặp TIMER giá trị ban đầu , TIMER thực lần x tăng lên , đến giá trị ta chọn tự động tắt TIMER , hiệu ứng dừng lại SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 66 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN v Phần SPEED Là khoản cách thời gian lần thực thi TIMER với lệnh sau : timer1.Interval = speed; với speed thời gian cách lần lặp đơn vị ( ms ) Vậy tốc độ hiệu ứng hoàn toàn phụ thuộc hoàn toàn vào thời gian truyền mảng liệu Phần code giao diện Trong phần code giao diện có nhiều hàm khác , nhiên có số hàm khai báo sau phải hiểu bắt buộc phải có muốn thực phần giao tiếp Ø D_USER_ATTACH_CALLBACK dDeviceAttachCb = new D_USER_ATTACH_CALLBACK(UserDeviceAttach);D_USER_DETACH_CAL LBACK dDeviceDetachCb = new D_USER_DETACH_CALLBACK (UserDeviceDetach); uDevManager = new LED_CUBE_DeviceManager (dDeviceAttachCb, dDeviceDetachCb, DEFAULT_VENDOR_ID, DEFAULT_PRODUCT_ID, DEFAULT_DRIVER_NAME, DEFAULT_LICENSE_STRING); : đăng ký hàm kiện ATTACH_CALLBACK , DETACH_CALLBACK khởi tạo đối tượng quản lý thiết bị USB uDevManager Ø private const string DEFAULT_LICENSE_STRING = "6C3CC2CFE89E7AD042444C655646F21A0BF3FDEB.EMBRACE": phần khai báo quan trọng có ảnh hưởng đến việc máy tính có nhận diện thiêt bị ta hay không Chúng ta lấy dòng string phần mã nguồn giao diện WINDRIVER tạo Ø private PROJECT_USB_4550_DeviceManager uDevManager : khai báo khời tạo đối tượng quản lý USB Ø private LED_CUBE _Device usb_device : khai báo đối tượng USB Ø private LED_CUBE _Pipe usb_pipe_trs : khai báo đối tượng ống truyền Ø private LED_CUBE _Pipe usb_pipe_rev : khai báo đối tượng ống nhận Ø DWORD dwBuffSize = 49 : Truyền lần tối đa 49 byte Ø DWORD dwBuffSize = 56 : Truyền lần tối đa 56 byte Ø byte[ ] buffer01 = new byte[49]; buffer01[0] = 1; for (int i = 1; i < 49; i++) { buffer01[i] = buffer[(i - 1) + (x * 288)]; } : phần chia mảng liệu lớn buffer thành mảng liệu nhỏ để gửi , “x” số mảng nhỏ 288 byte có buffer Ø byte[ ] buffer01 = new byte[55]; buffer01[0] = 1; for (int i = 1; i < 55; i++) { buffer01[i] = buffer[(i - 1) + (x * 216)]; } : phần chia mảng liệu lớn buffer thành mảng liệu nhỏ để gửi , “x” số mảng nhỏ 216 byte có buffer Ø usb_pipe_trs.UsbPipeTransferAsync(false, 0, buffer01, dwBuffSize, TIME_OUT, new D_USER_TRANSFER_COMPLETION(Transfer_trs_Completion)) : gọi lệnh gửi tất byte lưu đệm buffer01 SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 67 Đồ án tốt nghiệp GVHD : THS TRẦN QUANG THUẬN TÀI LIỆU THAM KHẢO Luận văn tốt nghiệp – Giao tiếp với máy tính qua cổng USB ứng dụng giao tiếp giao tiếp ngoại vi - PHẠM HÙNG KIM KHÁNH - 02DT1 - TRƯỜNG ĐẠI HỌC KỸ THUẬT CÔNG NGHỆ TP.HCM Vi điều khiển PIC ứng dụng - Nguyễn Thế Anh - Trường ĐHQGHN Các giải pháp lập trình C# - NGUYỄN NGỌC BÌNH PHƯƠNG & THÁI THANH PHONG USB COMPLETE Third Edition - JAN AXELSON Hướng dẫn giao tiếp USB - Nguyễn Ngọc Hưng Lớp TKTL 40 Học Viện KTQS Hướng dẫn giao tiếp USB - Ngô Đăng Hiền - Học Viện Hải Quân Những Website dùng để tham khảo thêm : http://dientuvietnam.net http://picvietnam.com http://www.microchip.com http://goccay.vn http://www.instructables.com http://led3dcube.tk SVTH : Nguyễn Minh Giàu – MSSV : 0851030024 68 ... khiển tự động hóa điều khiển thời gian thực đặt yêu cầu lớn vi c trao đổi liệu hệ thống hay phận hệ thống Với đề tài giao tiếp PIC với máy tính qua USB để điều khiển khối LED 3D giúp ta có nhìn... TRẦN QUANG THUẬN CHƯƠNG II : TỔNG QUAN VỀ GIAO TIẾP USB 2.1 Giới thiệu giao tiếp USB USB ( Universal Serial Bus ) giải pháp nhanh chóng linh động để thực giao tiếp máy tính thiết bị ngoại vi ... TỔNG QUAN VỀ GIAO TIẾP USB 2.1 Giới thiệu giao tiếp USB 2.2 Cấu trúc truyền dẫn USB 2.3 Các dạng truyền dẫn USB CHƯƠNG III : THIẾT KẾ PHẦN CỨNG 3.1 Tổng quát phần cứng 3.2 Khối điều khiển 3.3 Khối

Ngày đăng: 02/07/2017, 17:35

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w