Kênh Tên Miền chuyên cung cấp tên miền đẹp, giá rẻ! Hãy liên hệ kỹ thuật: 0914205579 - Kinh doanh: 0912191357 để được tư vấn, hướng dẫn miễn phí, Cảm ơn quý khách đã ủng hộ trong thời gian qua!
Monday, August 1, 2011

Hôm nay rảnh Chip chia sẻ cho các bạn code trái tim 32 led chay chip 89C51.Đây chỉ là Demo chạy thử sẽ còn nhiều thiếu sót mong các bạn góp ý thêm để chip hoàn thiện hơn.Sau đây là code và Demo Video chạy thử.

MẠCH TRÁI TIM 32 LED BETA PHIÊN BẢN MỚI TĂNG HIỆU ỨNG TẠI ĐÂY.?



VIDEO DEMO:






CODE:
ORG 00H
MAIN:
CALL CTA
CALL CTB
CALL CTC
CALL CTD
CALL CTE
CALL CTF
CALL CTG
CALL CTH
CALL CTI
CALL CTK
JMP MAIN
CTA:;CHAY DON
MOV A,#00000011B
LAP:MOV P0,A
CALL DELAY
RL A
CJNE A,#00000011B,LAP
MOV A,#00000011B
LAPA:MOV P2,A
CALL DELAY
RL A
CJNE A,#00000011B,LAPA
MOV A,#00000011B
LAPB:MOV P3,A
CALL DELAY
RL A
CJNE A,#00000011B,LAPB
MOV A,#11000000B
LAPC:MOV P1,A
CALL DELAY
RR A
CJNE A,#11000000B,LAPC
RET
CTB:;SANG DAN VONG
MOV A,#00H
LAPD:SETB C
RLC A
MOV P0,A
CALL DELAY
CJNE A,#0FFH,LAPD
MOV A,#00H
LAPE:SETB C
RLC A
MOV P2,A
CALL DELAY
CJNE A,#0FFH,LAPE
MOV A,#00H
LAPF:SETB C
RLC A
MOV P3,A
CALL DELAY
CJNE A,#0FFH,LAPF
MOV A,#00H
LAPH:SETB C
RRC A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPH
RET
CTC:;TAT DAN VONG
MOV A,#0FFH
LAPDD:CLR C
RLC A
MOV P0,A
CALL DELAY
CJNE A,#00H,LAPDD
MOV A,#0FFH
LAPEE:CLR C
RLC A
MOV P2,A
CALL DELAY
CJNE A,#00H,LAPEE
MOV A,#0FFH
LAPFF:CLR C
RLC A
MOV P3,A
CALL DELAY
CJNE A,#00H,LAPFF
MOV A,#0FFH
LAPHH:CLR C
RRC A
MOV P1,A
CALL DELAY
CJNE A,#00H,LAPHH
RET
CTD:;TIM SANG TU TREN XUONG
MOV A,#00H
LAPF1:SETB C
RLC A
MOV P0,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPF1
MOV R6,#00H
MOV R7,#00H
LAPYT:
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
SETB C
MOV A,R7
RLC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#0FFH,LAPYT
RET
CTE:;TAT TRAI TIM
MOV R6,#0FFH
MOV R7,#0FFH
LAPYO:
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
CALL DELAY
CLR C
MOV A,R7
RRC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#00H,LAPYO
MOV A,#0FFH
LAPF101:CLR C
RRC A
MOV P0,A
MOV P1,A
CALL DELAY
CJNE A,#00H,LAPF101
RET
CTF:;TIM SANG LEN XUONG
MOV A,#00H
LAPF7:SETB C
RLC A
MOV P0,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPF7
MOV R6,#00H
MOV R7,#00H
LAPYP:
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
CALL DELAY
SETB C
MOV A,R7
RRC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#0FFH,LAPYP
RET
CTG:;SANG QUAY TRAI
MOV R6,#00H
MOV R7,#00H
LAPYL:
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
SETB C
MOV A,R7
RRC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#0FFH,LAPYL
MOV A,#00H
LAPF125:SETB C
RRC A
MOV P0,A
MOV P3,A
CALL DELAY
CJNE A,#0FFH,LAPF125
MOV R6,#0FFH
MOV R7,#0FFH
LAPYI:
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
CLR C
MOV A,R7
RRC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#00H,LAPYI
MOV A,#0FFH
LAPF126:CLR C
RRC A
MOV P0,A
MOV P3,A
CALL DELAY
CJNE A,#00H,LAPF126
RET
CTH:;SANG QUAY PHAI
MOV A,#00H
LAPF121:SETB C
RLC A
MOV P0,A
MOV P3,A
CALL DELAY
CJNE A,#0FFH,LAPF121
MOV R6,#00H
MOV R7,#00H
LAPYF:
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
SETB C
MOV A,R7
RRC A
MOV R7,A
MOV P1,R7
CALL DELAY
CJNE R7,#0FFH,LAPYF
MOV A,#0FFH
LAPF122:CLR C
RLC A
MOV P0,A
MOV P3,A
CALL DELAY
CJNE A,#00H,LAPF122
MOV R6,#0FFH
MOV R7,#0FFH
LAPYE:
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CLR C
MOV A,R7
RRC A
MOV R7,A
MOV P1,R7
CALL DELAY
CJNE R7,#00H,LAPYE
RET
CTI:;NHAP NHAY
MOV R7,#5
SOLAN1:
MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV P3,#00H
CALL DELAY
MOV P0,#0FFH
MOV P1,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
CALL DELAY
DJNZ R7,SOLAN1
RET
CTK:
MOV A,#00H
LAPF2:SETB C
RLC A
MOV P0,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPF2
MOV R6,#00H
MOV R7,#00H
LAPYZ:
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
SETB C
MOV A,R7
RLC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#0FFH,LAPYZ
;CON 1
MOV R6,#00H
MOV R7,#00H
LAPY9:
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
CALL DELAY
SETB C
MOV A,R7
RRC A
MOV R7,A
MOV P2,R7
CALL DELAY
CJNE R7,#0FFH,LAPY9
MOV A,#00H
LAPF8:SETB C
RLC A
MOV P0,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPF8
RET
DELAY:
MOV R1,#150
LAPK:MOV R0,#150
LAPL:
NOP
NOP
NOP
DJNZ R0,LAPL
DJNZ R1,LAPK
RET
END


(SĐ nguyên lý + file Hex + ASM)Khi nhấn nút "Tải Về Máy", bạn sẽ vào trang quảng cáo, vui lòng chờ 5 giây. Nút  hiện ra ở góc phải phía trên, nhấn vào để đến trang xem phim.
Blog Điện Tử | Tin Học

0 comments:

Post a Comment

domain, domain name, premium domain name for sales

Popular Posts