• 沒有找到結果。

避障自走車之設計與製作

N/A
N/A
Protected

Academic year: 2021

Share "避障自走車之設計與製作"

Copied!
45
0
0

加載中.... (立即查看全文)

全文

(1)

Self-propelled Car with Obstacle Avoidance

作者:黃鈺雯、黃怡雯、洪淩桂、胡凱婷 系級:電機工程學系 學號:D0073500、D0073531、D0073425、D0073574 開課老師:何子儀 課程名稱:微處理機實習 開課系所:電機工程學系 開課學年: 101 學年度 第 2 學期

(2)

Keil C ??? 8052 LED 8052 關鍵字 關鍵字 關鍵字 關鍵字:::: Keil C

(3)

Abstract

The main purpose of this project is to design and implement a self-propelled vehicle with the function of obstacle avoidance. While the self-propelled car detects an obstacle, it can find out where it is, then shy away and go straight. The system software includes Keil C. The system hardware uses a microcontroller 8052 to set seconds and the function of countdown. After countdown, the self-propelled vehicle is started. By employing the front detector, any obstacle in front of the car can be detected, if there was, the vehicle will firstly go backward and turn left; then keep going forward.

Different buttons will be used to control the duration of time and the start of countdown. The timer of the microcontroller 8052 is used for countdown and the seven-segment LEDs display time of countdown. The obstacle detecting device is composed of an infrared LED and phototransistor. The detected signal will be fed to microcontroller, 8052. After processing the signals, it will be transmitted to the motor in such a way motor can respond the corresponding actions. Therefore the vehicle can go straight and shy away the obstacle.

If the countdown of the car is replaced by the electronic alarm clock, and the buzzer device is also added in vehicle, it can be considered as a moving alarm.

Keyword Keyword Keyword Keyword::::

(4)

... i Abstract ... ii ... iii ... 1 ... 3 ... 23 ... 24 ... 27 ... 28 ... 29 ... 30 ... 34 ... 41

(5)

8052 ( ) 2 1 8052 LED

(6)
(7)

2.1 (1)8052 (2) (3)74LS245 (4) (5) LED (6) (7) (8)LED 2.1 2.1

(8)

2.1.1 8052 8052 1. VCC 5V 2. GND 3. PORT0 I/O D0~7 A0~7 ALE 4. PORT1 I/O 5. PORT2 I/O A8~15 6. RST 2 7. ALE/PROG 1/6 PROM 8. PSEN 2 ROM ROM OE

(9)

9. EA/VPP EPROM 12 10.XTAL1, XTAL2 = 12 2.1 8052

(10)

2.1.2

2.2 capture

H Q5 Q3 ; Q7

(11)

2.3 layout capture layout 2.1.3 74LS245 74LS245 IO DIR 74LS245 LED 8 74LS245 A A B B /G ( ) DIR 8052 P0 P0

(12)

74LS245 74LS245 P0 74LS245 /CE DIR= 0 B A ; DIR= 1 A B CE A B 2.4 74LS245

(13)

2.1.4 ST-1KL3A phototransistor C-B 2.5 ST-1KL3A

(14)

2.1.5 LED GL-514 LED LED LED 2.6 GL-514 2.1.6 0 9 A

(15)

F b d i

(16)

3 8 COM

2.1.7

2.8

2.1.8 LED

(17)
(18)

2.2 (1) (2) (3) (4) (5) 2.2.1 2.10 3 (P0.0) (P0.1) (P0.2) 3 (PRINT) INPUT ( INC1) 99 99 0 99 1 PRINT ( DEC1) 0 0 99 0 1 PRINT

(19)

PRINT SHOW 5 ( COUNTDOWN) R4 25 0 0 LOOP1 LOOP1 SHOW R4 SHOW 25 1 COUNTDOWN COUNTDOWN R4 R4 SHOW 25 ( CARRUN) LOOP2 1 LED (P1.1~P1.4) ( ) P1.0 LED

(20)

P1.0 1 P1.0 1 0

(21)

2.2.2 (SHOW ) 10 R1 R2 COM P0.7 P0.6 R1 A R1 (TABLE) A P0.7 COM A P2 DATA COM R2 A P0.7 P0.6 200

(22)

R2 200 A=R0 B=10 A/B R1=A R2=B 2 COM R1 A A A COM (P0.7) A P2 DELAY COM (P0.7) B C

(23)

2.12 YES

NO

(24)

2.2.3 LED DUTY P3.3 3/4 DUTY LED (P1.1) P3.1 DELAY2 P3.1 DELAY1 RET

(25)

2.2.4

DUTY

(26)

2.2.5 LED(P1.3) R4-1 ? P3.3 DELAY2 P3.3 DELAY1 RET YES NO

(27)

. 1. 2. 3. LED LED 4. 3 1 1 99 5.

(28)

4.1 4.1 4.1 LED 4.2

(29)

LED

4.3

LED

LED

(30)

4.2

1.

2.

3.

(31)

1. 2. 3. 5.1 1. A. B. 2. A. 3. A. B.

(32)

Capture Layout

(33)

3 13 3 20 3 27 4 8 4 23 ( ) ( ) ( ) ( ) ( ) 5 1 5 3 5 8 5 15 5 22 ( ) ( ) ( ) Orcad & Layout ( ) ( ) 5 25 5 29 6 1 6 5 6 7 ( ) ( ) ppt( ) ( ) ( ) 6 9 6 10 PPT ( ) ( )

(34)

:

(35)

2 4 : CAPTURE LAYOUT

(36)

... BJT

DEBUG

:

Keil

(37)

Layout

(38)

ASM

ORG 0000H

MOV P3,#00H

;---INPUT---

START: MOV DPTR,#TABLE

MOV R0,#3

INPUT: JNB P0.0,COUNTDOWN

JNB P0.1,INC1

JNB P0.2,DEC1

PRINT: MOV R6,#5

PRINT1: ACALL SHOW

DJNZ R6,PRINT1

SJMP INPUT

INC1: CJNE R0,#99,INC2

MOV R0,#0

SJMP PRINT

INC2: INC R0

SJMP PRINT

DEC1: CJNE R0,#0,DEC2

MOV R0,#99 SJMP PRINT DEC2: DEC R0 SJMP PRINT ;---COUNTDOWN--- COUNTDOWN: MOV R4,#25 LOOP: CJNE R0,#0,LOOP1 SJMP LOOP2 LOOP1: ACALL SHOW

(39)

DJNZ R0,COUNTDOWN

MOV R4,#25

LOOP2: ACALL SHOW

DJNZ R4,LOOP2 ;---CAR-RUN--- CARRUN: SETB P1.1 SETB P1.2 SETB P1.3 SETB P1.4 TEST: JNB P1.0,TURN ACALL RUN SJMP CARRUN TURN: MOV R0,#25 TURNBACK: ACALL BACK DJNZ R0,TURNBACK SETB P1.2 MOV R0,#25 TURNLEFT: ACALL LEFT DJNZ R0,TURNLEFT SJMP CARRUN ;---SHOW--- SHOW: MOV R3,#200 MOV A,R0 MOV B,#10 DIV AB MOV R1,A MOV R2,B SETB P0.7 SETB P0.6 SHOW1: MOV A,R1 MOVC A,@A+DPTR

(40)

CLR P0.7 MOV P2,A ACALL DELAY SETB P0.7 MOV A,R2 MOVC A,@A+DPTR CLR P0.6 MOV P2,A ACALL DELAY SETB P0.6 DJNZ R3,SHOW1 RET ;---DELAY**FOR**SHOW--- DELAY: MOV R7,#50 DL: DJNZ R7,DL RET ;---LONG DELAY--- DELAY1: MOV R6,#3 DL2: MOV R7,#250 DL1: DJNZ R7,DL1 DJNZ R6,DL2 RET ;---SHORT DELAY--- DELAY2: MOV R6,#1 DL4: MOV R7,#250 DL3: DJNZ R7,DL3 DJNZ R6,DL4 RET ;---RUN--- RUN: CLR P1.1 MOV P3,#10010110B

(41)

CLR P3.1 ACALL DELAY2 SETB P3.1 ACALL DELAY1 RET ;---TURN BACK--- BACK: CLR P1.2 MOV P3,#01101001B MOV R4,#100 BACK1: CLR P3.3 ACALL DELAY2 SETB P3.3 ACALL DELAY1 DJNZ R4,BACK1 RET ;---TURN LEFT--- LEFT: CLR P1.3 MOV P3,#00001001B MOV R4,#100 LEFT1: CLR P3.3 ACALL DELAY2 SETB P3.3 ACALL DELAY1 DJNZ R4,LEFT1 RET ;---TABLE--- TABLE: DB 00000010B ;0 DB 10011110B ;1 DB 00100100B ;2 DB 00001100B ;3 DB 10011000B ;4

(42)

DB 01001000B ;5 DB 01000000B ;6 DB 00011010B ;7 DB 00000000B ;8 DB 00011000B ;9 END

(43)
(44)
(45)

[1] “ ” 80 12 [2] 8052 :http://zh.wikipedia.org/zh-tw/Intel_8051 [3] : http://tinyurl.com/bmoevbe [4] : http://elearning.stut.edu.tw/control/i_electronics/chap1/new_page_1326.h tm [5] : http://zh.wikipedia.org/wiki/%E4%B8%83%E5%8A%83%E7%AE%A1

參考文獻

相關文件

Too good security is trumping deployment Practical security isn’ t glamorous... USENIX Security

The format of the URI in the first line of the header is not specified. For example, it could be empty, a single slash, if the server is only handling XML-RPC calls. However, if the

substance) is matter that has distinct properties and a composition that does not vary from sample

It is well known that second-order cone programming can be regarded as a special case of positive semidefinite programming by using the arrow matrix.. This paper further studies

Courtesy: Ned Wright’s Cosmology Page Burles, Nolette & Turner, 1999?. Total Mass Density

If growing cities in Asia and Africa can provide clean, safe housing, the future of the people moving there should be a very good one... What is the main idea of the

Good joke tellers can add whatever they want to the joke as they tell it, but they clearly know the details of the beginning , mi ddle and ending of the joke.. It is also

For a vehicle moving 60 mph, compute the received carrier frequency if the mobile is moving.. directly toward