1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Câu hỏi: Lập trình điều khiển đèn nháy: “VI ĐIỀU KHIỂN 89C51” ppt

27 337 2
Tài liệu đã được kiểm tra trùng lặp

Đ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

Tiêu đề Lập trình điều khiển đèn nháy: “Vi Điều Khiển 89C51”
Tác giả Vũ Duy Khang
Trường học Cao Đẳng Điện Lực
Chuyên ngành Điện A
Thể loại Đồ án
Định dạng
Số trang 27
Dung lượng 519,49 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Câu hỏi: Lập trình điều khiển đèn nháy: “VI ĐIỀU KHIỂN 89C51”Dùng đèn led điều khiển đấu anốt chung, tại cổng p1,p2 theo yêu cầu sau: 1Hiện từng chữ từ trái sang phải với tốc độ 1s/ chữ.

Trang 1

Câu hỏi: Lập trình điều khiển đèn nháy: “VI ĐIỀU KHIỂN 89C51”

Dùng đèn led điều khiển đấu anốt chung, tại cổng p1,p2 theo yêu cầu sau:

1)Hiện từng chữ từ trái sang phải với tốc độ 1s/ chữ.

2)Sáng dần từng kí tự từ trái sang phải với tốc độ 0,1s/ 1 kí tự.

3)Sáng dồn từ trái sang phải với tốc độ 0,1s /1 kí tự.

4)Chớp tắt dòng chữ trên 3 lần với tốc độ 0,5 s/1 lần.

1) Hiện dần từng chữ từ trái sang phải với tốc độ 1 giây/1 chữ:

org 0hmov tmod,#1mov p1,#1mov p2,#1yeucau1:

mov p1,#11111100bcall delay1

mov p1,#11000000bcall delay1

mov p1,#00000000bmov p2,#11111000blcall delay1

mov p2,#00000000b

Trang 2

call delay1mov p1,#11111111bmov p2,#11111111bcall delay1

jmp yeucau1

mov r7,#20kt:

mov th0,#3chmov tl0,#0b0hsetb tr0

loop:

jnb tf0,loopclr tr0

clr tf0djnz r7,ktret

end2) Hiện dần từng kí tự từ trái sang phải với tốc độ 0,1 giây/1 kí tự:

org 0hmov tmod,#1

Trang 3

mov p2,#1mov p1,#1

yeucau2:

mov p1,#11111110bcall delay01

mov p1,#11111100bcall delay01

mov p1,#11111000bcall delay01

mov p1,#11110000bcall delay01

mov p1,#11100000bcall delay01

mov p1,#11000000bcall delay01

mov p1,#10000000bcall delay01

mov p1,#00000000bcall delay01

mov p2,#11111110b

Trang 4

call delay01mov p2,#11111100bcall delay01

mov p2,#11111000bcall delay01

mov p2,#11110000bcall delay01

mov p2,#11100000bcall delay01

mov p2,#11000000bcall delay01

mov p2,#10000000bcall delay01

mov p2,#00000000bcall delay01

mov p2,#11111111bcall delay01

mov p1,#1jmp yeucau2delay01:

mov r7,#2

Trang 5

mov th0,#3chmov tl0,#0b0hsetb tr0

loop:

jnb tf0,loopclr tr0

clr tf0djnz r7,ktret

end

3)Sáng dồn từ trái sang phải với tốc độ 0,1s /1 kí tự:

org 0hmov p1,#1mov p2,#1mov tmod,#1sangdon:

clr p2.7call delay

Trang 6

setb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delaysetb p2.1clr p2.0call delay

Trang 7

setb p2.0clr p1.7call delaysetb p1.7clr p1.6call delaysetb p1.6clr p1.5call delaysetb p1.5clr p1.4call delaysetb p1.4clr p1.3call delaysetb p1.3clr p1.2call delaysetb p1.2clr p1.1call delay

Trang 8

setb p1.1clr p1.0call delay ;;;;;;;;;;;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2

Trang 9

clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6call delaysetb p1.6clr p1.5call delaysetb p1.5clr p1.4call delaysetb p1.4clr p1.3call delaysetb p1.3

Trang 10

clr p1.2call delaysetb p1.2clr p1.1call delay ;;;;;;;;;;;;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2

Trang 11

call delaysetb p2.2clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6call delaysetb p1.6clr p1.5call delaysetb p1.5clr p1.4call delaysetb p1.4clr p1.3

Trang 12

call delaysetb p1.3clr p1.2

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delay

Trang 13

setb p2.2clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6call delaysetb p1.6clr p1.5call delaysetb p1.5clr p1.4call delaysetb p1.4clr p1.3call delay ;;;;;;;;;;;;

Trang 14

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delaysetb p2.1

Trang 15

clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6call delaysetb p1.6clr p1.5call delaysetb p1.5clr p1.4call delay ;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5

Trang 16

call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6

Trang 17

call delaysetb p1.6clr p1.5call delay ;;;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delay

Trang 18

setb p2.2clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7call delaysetb p1.7clr p1.6call delay ;;;;;;;;;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5

Trang 19

clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delaysetb p2.1clr p2.0call delaysetb p2.0clr p1.7

clr p2.7call delaysetb p2.7clr p2.6

Trang 20

call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delaysetb p2.1clr p2.0

clr p2.7call delay

Trang 21

setb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delaysetb p2.2clr p2.1call delay ;;;;;;;;;;

clr p2.7call delaysetb p2.7

Trang 22

clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delaysetb p2.3clr p2.2call delay ;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5

Trang 23

call delaysetb p2.5clr p2.4call delaysetb p2.4clr p2.3call delay ;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delaysetb p2.6clr p2.5call delaysetb p2.5clr p2.4call delay ;;;;;;;;;

clr p2.7call delaysetb p2.7

Trang 24

clr p2.6call delaysetb p2.6clr p2.5call delay ;;;;;;;;;;

clr p2.7call delaysetb p2.7clr p2.6call delay ;;;;;;;;;;;

clr p2.7call delaymov p2,#1mov p1,#1jmp sangdon

mov r7,#2kt:

mov th0,#3chmov tl0,#0b0hsetb tr0

Trang 25

jnb tf0,loopclr tr0

clr tf0djnz r7,ktret

end

4)Chớp tắt dòng chữ trên 3 lần với tốc độ 0,5 s/1 lần:

org 0hmov tmod,#1mov p1,#1mov p2,#1yeucau4:

choptat:

call tatcall delay05call batcall delay05call tat

call delay05

Trang 26

call batcall delay05call tat

call delay05call batcall delay05

tat:

mov p1,#11111111bmov p2,#11111111bret

bat:

mov p1,#00000000bmov p2,#00000000bret

delay05: ;tao tre 0.5 giay

mov r6,#10kt:

mov th0,#3chmov tl0,#0b0hsetb tr0

Trang 27

jnb tf0,loopclr tr0

clr tf0djnz r6,ktret

end5)Mạch phần cứng đấu anốt chung:

Ngày đăng: 29/06/2014, 06:20

TỪ KHÓA LIÊN QUAN

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

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w