1. Trang chủ
  2. » Luận Văn - Báo Cáo

Thiết kế và thi công bãi đỗ xe tự động sử dụng vi điều khiển MSP430G2553

70 7 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 70
Dung lượng 0,95 MB

Nội dung

.+2È/8 ҰN TӔT NGHIӊP ĈҤI HӐ&Ĉ¬1 ҸNG 75Ѭ Ӡ1*Ĉ ҤI HӐ&6Ѭ3+ ҤM KHOA VҰ7/é WX Ĉ͉WjL THIӂT Kӂ9¬7+,&Ð1*%­,Ĉ ӚXE TӴ ĈӜNG SӰ DӨ1*9,Ĉ, ӄU KHIӆN MSP430G2553 1Jѭ ӡi thӵc hiӋ n : PHҤM THӎHIӄN NGA MAI THӎTUYӂ71*Ỉ1 Lӟp : 10CVL KRi : 2010 - 2014 1JjQK : VҰ7/é+ ӐC 1Jѭ ӡLKѭ ӟng dүn : ThS PHҤ0;8Ỉ17581* .+2È/8 ҰN TӔT NGHIӊP /Ӡ,&Ҧ0Ѫ1 Sau nhӳQJ QăPӗ WKiQJ L WUrQ ӃQKj QJ JK ӡQJ WUѭ FK~QJ ӧc hӑ W{L c tұ S Yj ÿm ÿ tiӃ p thu nhiӅ u kiӃ n thӭc mӟi tӯsӵchӍbҧ o tұ QWuQKF ӫDTXêWK ҫ \F{FQJY ӟi sӵJL~S ÿ ӥcӫa bҥ QEqÿk\OjNKR ҧ ng thӡLJLDQÿ ҫ \êQJKƭDÿ ӕi vӟLFK~QJW{L KyDOX ұ n tӕ t nghiӋ p UD ӡQJ WUѭӅ Oj n tҧ ng Q quan trӑQJ Yj ҩ uÿiQK mӝ Wӟ Eѭ c ngoһ G c mӟi cuӝ Fÿ ӡi cӫ a mӛLFK~QJW{L &K~QJ W{L [LQFKkQWKjQKF ҧ PѫQ EDQOmQKÿ ҥ o Khoa Vұ W/êWUѭ ӡQJĈ ҥ i Hӑ F6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YLÿL Ӆ u khiӇ n MSP430G2553 +uQK : KiӃ QWU~F5,6&F ӫa CPU +uQK &iFWKDQKJKLF ӫa CPU +uQK : Bӝtҥ o xung nhӏ p +uQK 6ѫÿ ӗkhӕ i cӫ a Timer_A +uQK : Cӡngҳ t chӃÿӝVRViQKYjOѭXWU ӳ +uQK 6ѫÿ ӗkhӕ i cӫ a Timer_B +uQK /('SKiWK ӗ ng ngoҥ i +uQK : LED thu hӗng ngoҥ i +uQK 6ѫÿ ӗQJX\rQOêWRjQP ҥ ch +uQK 6ѫÿ ӗQJX\rQOêNK ӕi hiӇ n thӏ/('ÿR ҥ n +uQK /('ÿR ҥ n +uQK /('ÿR ҥ n vӟi Anode ±Kathode chung +uQK : IC74HC595 +uQK 6ѫÿ ӗFKkQ,&+& .+2È/8 ҰN TӔT NGHIӊP +uQK 6ѫÿ ӗQJX\rQOêNK ӕi vi ÿL Ӆ u khiӇ n +uQK 6ѫÿ ӗQJX\rQOêNK ӕLÿL Ӆ u khiӇ Qÿ ӝ QJFѫ +uQK Ĉ ӝQJFѫ6HUYR +uQK : Cҩ u tҥ o cӫDÿ ӝ QJFѫ6HUYR +uQK6ѫÿ ӗQJX\rQOêNK ӕi nguӗn +uQK6ѫÿ ӗlayout mҥ FKÿL Ӆ u khiӇ QWUXQJWkP +uQK 6ѫÿ ӗbӕWUtOLQKNL Ӌ n mҥ FKÿL Ӆ u khiӇ QWUXQJWkP +uQK0{KuQKEmLÿ ӛxe tӵÿӝ ng .+2È/8 ҰN TӔT NGHIӊP '$1+6È&+%Ҧ1*%,ӆ8 Bҧ ng 1.1: Bҧ ng liӋ WNrFiFWKDQKJKLÿL Ӆ u khiӇ n Timer_A Bҧ ng 1.2: Bҧ ng liӋ WNrFiFWKDQKJKLF ӫa Timer_B Bҧ ng 3.1: Bҧ ng giҧ LPm/(' ÿR ҥ n Anode chung Bҧ ng 3.2: Bҧ ng giҧ LPm/('ÿR ҥ n Cathode chung .+2È/8 ҰN TӔT NGHIӊP 7Ӯ9,ӂ77Ҳ7 PC : Program Counter MSP : Mixed Signal Microcontroller LED : Light Emitters Diode SP : Stack Pointer CPU : Central Processing Unit RAM : Random Access Memory ROM : Read Only Memory UART : Universal Asinchonus Receiver Transmitter ADC : Analog Digital Converte IC : Integrated Circuit SR : Status Register MCU : Micro Controller Unit WDT : Watchdog Timer DCO : Digitally Controlled Oscillator CG : Constant Generator PWM : Pulse Width Modulation ALU : Arithmetics Logic Unit SPI : Serial Peripheral Bus DVD : Digital Versatile Disc RICS : Reduced Instruction Set Computer LCD : Liquid Crystal Display *Li trӏcӫa JKL7$5FyWK Ӈÿѭ ӧc ghi hoһ Fÿ ӑ c bӣi phҫ n mӅ P1yFyNK ҧQăQJW ҥ o mӝ t ngҳ WNKLÿ Ӄ PWUjQ 7KDQK JKL thӇbӏ 7$5 [Ri Fy NKL VHW Ӌ cELW set bit 7$&/ 7$&/5ÿ ӗng thӡLFNJQJ[RiJLiWU ӏlӵa chӑn cho bӝchia xung hoһ c chӃ ÿ ӝÿ Ӄ POrQKD\ÿ Ӄ m xuӕng x Lӵa chӑ n nguӗQ[XQJYjE ӝchia xung: 7LPHU Ӈlӵ Fy a chӑnWK nguӗn tӯxung tӯACLK, SMCLK hoһ c sӱ dөng nguӗn xung nJRjLWK{QJTXD7$&/.KR һ c INCLK Nguӗ n xung ÿѭ ӧc lӵa chӑ n nhӡELW7$66(/[&iF ӗQ[XQJÿѭ ӧc chӑ QFyWK QJXӇ ÿmÿѭ ӧc chia 2, hoһ c BӝFKLD[XQJÿѭ ӧc reset set bit TACLK x tFKKR ҥ t Timer: 7LPHUFyWK Ӈÿѭ ӧFNtFKKR ҥ t hoһ FNtFKKR ҥ t lҥ i bҵ QJFiFFiFKV 27 .+2È/8 ҰN TӔT NGHIӊP - 7LPHUÿ Ӄ PNKL0&;!YjQJX ӗ Q[XQJÿmNtFKKR ҥ t - KL7LPHUÿDQJKR ҥ Wÿ ӝng ӣchӃÿ ӝÿӃ POrQKR һ Fÿ Ӄ m xuӕ QJFy thӇdӯng Timer bҵ QJFiFKJKL7$&& R0=0, Timer sӁNtFKKR ҥ t trӣlҥ i NKLJLiWU ӏJKLYjR7$&&5NKiF*LiWU ӏÿ Ӄ POrQV Ӂbҳ Wÿ ҫ u tӯ0 x &iFFK Ӄÿ ӝhoҥ Wÿ ӝng cӫa Timer: Timer hoҥ Wÿ ӝng ӣ4 chӃÿӝ : chӃÿӝdӯng, chӃÿӝÿӃ POrQFK Ӄÿӝ tiӃ p tө c, chӃÿ ӝÿ Ӄ POrQ[X ӕng x &iFQJ ҳ t cӫa Timer_A: &yKDLQJ ҳ Wÿѭ ӧc tҥ o Timer_A: - Vector ngҳ t TACCR0 cho TRCCR0 CCIFG - Vector ngҳ t TAIV cho tҩ t cҧFiFF ӡngҳ W&&,)*NKiFYj Trong chӃÿ ӝOѭXWU ӳ&&,)*ÿѭ ӧFVHWNKLJLiWU ӏcӫDWLPHUÿѭ ӧFOѭX trӳdo ghi TACCRx Trong chӃÿӝVR ViQK ҩ W Nu ӡCCIFG E F ÿѭ ӧc set nӃ X7$5ÿ Ӄ m tӟLJLiWU ӏ7$&&5[&yWK Ӈsӱdөng phҫ n mӅ m ÿ Ӈset hoһ F[RiE ҩ WNuF ӡngҳ W&&,)*QjR7 ҩ t cҧFiFF ӡngҳ t CCIFG \rXF ҫ u mӝ t ngҳ WNKLELW&&,(Yj*,(ÿѭ ӧc set Ngҳ W 7$&&5 &&,)* ҳ t cӫD 7LPHUB$ Oj QJ mӭF ѭX Fy WLrQ nhҩ t Cӡngҳ t TACCR0 CCIFG tӵÿ ӝng reset ngҳ W7$&&5ÿѭ ӧc phөc vө +uQK& ӡngҳt chӃÿӝVRViQKYjOѭXWU ӳ 28 .+2È/8 ҰN TӔT NGHIӊP x 7KDQKJKLÿL Ӆ u khiӇ n Timer_A: Bҧng 1.1: Bҧng liӋ WNrFiFWKDQKJKLÿL Ӆ u khiӇ n Timer_A Register Short Form Register Address Initial State type Timer_A control TACTL Read/write 0160h Reset with POR Timer_A counter TAR Read/write 0170h Reset with POR Timer_A capture/compare control TACCTL0 Read/write 0162h Reset with POR Timer_A capture/compare TACCR0 Read/write 0172h Reset with POR Timer_A capture/compare control TACCTL1 Read/write 0164h Reset with POR Timer_A capture/compare TACCR1 Read/write 0174h Reset with POR Timer_A capture/compare control TACCTL2 Read/write 0166h Reset with POR Timer_A capture/compare TACCR2 Read/write 0176h Reset with POR Timer_A interrup vector TAIV Read/write 012Eh Reset with POR ™ Timer_B: 7LPHUB% ӝÿ ӏ nhOj thӡL E ELW Ӈhoҥ W ӝ Fy ng ÿӣ2WK chӃÿ ӝ7LPHU Yj &RXQWHU 7LPHUB% ӭQJ ÿD ӭF FK QăQJ ÿiS FDSWXUHVR ViQK FNJQJFyNK ҧQăQJW ҥ o ngҳ WNKLQyÿ Ӄ PWUjQKR һ FFiFWKDQKJKL ViQK x Ĉһ FWtQK - /jP ӝ W7LPHU&RXQWHUELWNK{QJÿ ӗng bӝvӟi chӃÿӝhoҥ Wÿ ӝng - &yWK Ӈlӵa chӑ QYjF ҩ XKuQKQJX ӗ n xung - &yW ӯ3 tӟLWKDQKJKLFyWK Ӈcҩ XKuQKFDSWXUHFRPSD - Cҩ XKuQKÿ ҫ u vӟi chӃÿӝPWM - Chӕ WQJ}YjRYjQJ}UDNK{QJÿ ӗng bӝ 29 .+2È/8 ҰN TӔT NGHIӊP +uQK6ѫÿ ӗkhӕi cӫa Timer_B 30 .+2È/8 ҰN TӔT NGHIӊP x &iFWKDQKJKLF ӫ a Timer_B: Bҧ ng 1.2: Bҧng liӋ WNrFiFWKDQKJKLF ӫa Timer_B Register Short Form Register Address Initial State type Timer_B control TBCTL Read/write 0180h Reset with POR Timer_B counter TBR Read/write 0190h Reset with POR Timer_B capture/compare control TBCCTL0 Read/write 0182h Reset with POR Timer_B capture/compare TBCCR0 Read/write 0192h Reset with POR Timer_B capture/compare control TBCCTL1 Read/write 0184h Reset with POR Timer_B capture/compare TBCCR1 Read/write 0194h Reset with POR Timer_B capture/compare control TBCCTL2 Read/write 0186h Reset with POR Timer_B capture/compare TBCCR2 Read/write 0196h Reset with POR Timer_B capture/compare control TBCCTL3 Read/write 0188h Reset with POR Timer_B capture/compare TBCCR3 Read/write 0198h Reset with POR Timer_B capture/compare control TBCCTL4 Read/write 018Ah Reset with POR Timer_B capture/compare TBCCR4 Read/write 019Ah Reset with POR Timer_B capture/compare control TBCCTL5 Read/write 018Ch Reset with POR Timer_B capture/compare TBCCR5 Read/write 019Ch Reset with POR Timer_B capture/compare control TBCCTL6 Read/write 018Eh Reset with POR Timer_B capture/compare TBCCR6 Read/write 019Eh Reset with POR Timer_B interrupt vector TBIV Read only 011Eh Reset with POR x &iFFK Ӄÿ ӝhoҥ Wÿ ӝng cӫa Timer_B: Timer_B hoҥ Wÿ ӝ ng ӣ4 chӃÿӝ : chӃ ÿ ӝdӯng, chӃÿӝÿ Ӄ POrQFK ӃÿӝOLrQW ө c, chӃÿ ӝÿӃ POrQ[X ӕng x &iFQJ ҳ t cӫa Timer_B: &yKDLQJ ҳ Wÿѭ ӧc tҥ o Timer_B: - Vector ngҳ t TBCCR0 cho TBCCR0 CCIFG - Vector ngҳ t TBIV cho tҩ t cҧFiFF ӡngҳ W&&,)*NKiFYj7 Vector ngҳ W 7%&&5 ҳ WOj Fy ӭF ӝ QJ P ÿ ѭX WLrQ ҩ t FDR Timer_B QK tҥ o Cӡngҳ t TBCCR0 CCIFG tӵÿӝ ng reset ngҳ W7%&&5ÿѭ ӧc phөc vө 31 .+2È/8 ҰN TӔT NGHIӊP x Hoҥ Wÿ ӝng cӫa Timer_B: Timer hoҥ Wÿ ӝ ng ӣchӃÿӝCounter Khi hoҥ Wÿ ӝng ӣchӃÿ ӝÿӃ PJLi trӏWKDQKJKL7%5WăQJKR һ c giҧ m theo cҥ QKOrQF ӫa xung clock Thanh JKL7%5FyWK Ӈghi hoһ Fÿ ӑF7LPHUB%FyWK Ӈtҥ o ngҳ WNKLÿ Ӄ PWUjQ 7KDQK JKL 7%5 Ӈÿѭ ӧF FNJQJ [Ri ҵ ng ciFK Fy E WK VHW ELW KLELWQj\ÿѭ ӧFVHWÿ ӗng thӡLFNJQJUHVHWO ҥ LJLiWU ӏcӫa bӝFKLDYjJ trӏÿӃ m ĈӝGjL WKDQK JKL ҩ S FKR 7%5 7LPHU ;XQJ Ӈlҩ y tӯnguӗ Fy Fn WK xung ACLK hoһ c SMCLK hoһ c tӯnguӗQ[XQJQJRjL7%&/ ӗn [XQJÿѭ ӧc lӵa chӑn nhӡbit TBSSELx, nguӗ Q[XQJÿѭ ӧc lӵa chӑ QFy thӇÿmÿѭ ӧc chӍWUѭ ӟc 2, hoһ F*LiWU ӏcӫa bӝchia bӏreset set bit TBCLR x tFKKR ҥ t Timer: 7LPHUFyWK Ӈÿѭ ӧc khӣLÿ ӝng hoһ c khӣLÿ ӝng lҥ i bҵ QJFiFFiFKV 7LPHUÿ Ӄ m MCx >YjQJX ӗ n xung clock hoҥ Wÿ ӝng + Khi timer hoҥ Wÿ ӝng ӣmӝ t hai chӃÿ ӝXSXSGRZQ Ӈ dӯng hoҥ Wÿ ӝ ng cӫa timer bҵ QJFiFKÿ һ W7%&/ 7LPHU ӧFNtFK hoҥ t trӣlҥ LNKLJLiWU ӏQj\NKiF.KLNtFKKR ҥ t trӣlҥ LJLiWU ӏcӫa timer bҳ Wÿ ҫ u tӯ0 1.4 KӃ t luұ n: 1KѭY ұ y qXDFKѭѫQJQj\ FK~QJWDÿmWuPKLӇXÿѭӧFP GzQJYLÿLӅXNKLӇQ063FөWKӇKѫQ WuPKLӇX ÿѭӧFFҩXWU~FÿһF OêKRҥWÿӝQJFNJQJQKѭFKӭFQăQJWӯQJF G2553 32 .+2È/8 ҰN TӔT NGHIӊP &+ѬѪ1*&Ѫ6Ӣ/é7+8

Ngày đăng: 26/06/2021, 19:36

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

TÀI LIỆU LIÊN QUAN

w