![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyf7Yl5C4jZ2Lf-dtZKMckwLb41YUj_bYCI6eUsj2wJIbGGTAdhYLBjjXSY0qBYDLmY3msJys8gXvL89T4_kshfFmzOKx9Lsx7lJVW5w3tV3Z-0vDqRDNm97qmS19ujBS83TtOHfb3A68/s400/2011-08-25_222118.png)
Buồn quá,Chip viết code demo led 32 - Trái tim các bạn xem thử nhé.nếu hay,chip sẽ Post tiếp mạch nguyên lý +Mạch in + Code lập trình Asm + Hex.
;Ban quyen thuoc ve Blog Dien Tu|Tin Hoc
;Designer By Chipkool
;http://Chipkool.tk
;Moi chi tiêt cac ban vui long comment ben duoi bai viet nhé
ORG 00H
MAIN:
CALL CHIP28
CALL CHIP29
CALL CHIP26
CALL CHIP25
CALL CHIP1
CALL CHIP20
CALL CHIP2
CALL CHIP3
CALL CHIP4
CALL CHIP5
CALL CHIP6
CALL CHIP7
CALL CHIP8
CALL CHIP9
CALL CHIP10
CALL CHIP11
CALL CHIP12
CALL CHIPR
CALL CHIPS
CALL CHIP13
CALL CHIP14
CALL CHIP16
CALL CHIP17
CALL CHIP18
CALL CHIP19
CALL CHIP20
CALL CHIP21
CALL CHIP22
CALL CHIP23
CALL CHIP24
CALL CHIP27
JMP MAIN
CHIP1:;SANG CHAY 2LED QUA LAI
MOV A,#00111111B
LAPY:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RR A
CJNE A,#00111111B,LAPY
MOV A,#11111100B
LAPYY:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RL A
CJNE A,#11111100B,LAPYY
MOV A,#0FFH
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
MOV A,#0FFH;SANG DAN
LAPIO:CLR C
RRC A
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
CJNE A,#00H,LAPIO
MOV A,#00H;TAT DAN
LAPIU:SETB C
RLC A
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPIU
RET
CHIP2:;SANG CHAY 3LED
MOV A,#00011111B
LAPSH:MOV P0,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH
MOV A,#0FFH
MOV P0,A
MOV A,#00011111B
LAPSH1:MOV P2,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH1
MOV A,#0FFH
MOV P2,A
MOV A,#00011111B
LAPSH2:MOV P3,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH2
MOV A,#0FFH
MOV P3,A
MOV A,#00011111B
LAPSH3:MOV P1,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH3
MOV A,#0FFH
MOV P1,A
RET
CHIP3:;SANG DAN VONG
MOV A,#0FFH
LAPC:
CLR C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#00H,LAPC
MOV A,#0FFH
LAPC1:
CLR C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#00H,LAPC1
MOV A,#0FFH
LAPC2:
CLR C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#00H,LAPC2
MOV A,#0FFH
LAPC3:
CLR C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#00H,LAPC3
RET
CHIP4:;TAT DAN
MOV A,#00H
LAPD:
SETB C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#0FFH,LAPD
MOV A,#00H
LAPD1:
SETB C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#0FFH,LAPD1
MOV A,#00H
LAPD2:
SETB C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#0FFH,LAPD2
MOV A,#00H
LAPD3:
SETB C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#0FFH,LAPD3
RET
CHIP5:;TIM SANG DAN TREN XUONG
MOV R5,#0FFH
MOV R6,#0FFH
LAPG:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#00H,LAPG
MOV R5,#0FFH
MOV R6,#0FFH
LAPH:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPH
RET
CHIP6:;TAT TIM DUOI LEN
MOV R5,#00H
MOV R6,#00H
LAPHH:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPHH
MOV R5,#00H
MOV R6,#00H
LAPGG:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPGG
RET
CHIP7:;TIM SANG 2 BEN
MOV R5,#0FFH
MOV R6,#0FFH
LAPI:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPI
RET
CHIP8:;TAT TRAI TIM SANG 2 BEN
MOV R5,#00H
MOV R6,#00H
LAPI1:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPI1
RET
CHIP9:;2 NUA TTIM TREN DUOI
MOV R1,#0FFH
MOV R2,#0FFH
MOV R5,#0FFH
MOV R6,#0FFH
LAPUI:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
CLR C
MOV A,R1
RRC A
MOV R1,A
MOV P3,R1
CALL DELAY
CLR C
MOV A,R2
RLC A
MOV R2,A
MOV P2,R2
CALL DELAY
CJNE R5,#00H,LAPUI
RET
CHIP10:;TAT TIM TU GIUA RA
MOV R1,#00H
MOV R2,#00H
MOV R5,#00H
MOV R6,#00H
LAPUII:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P0,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
SETB C
MOV A,R1
RLC A
MOV R1,A
MOV P3,R1
CALL DELAY
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P2,R2
CALL DELAY
CJNE R5,#0FFH,LAPUII
RET
CHIP11:;TRAI TIM TREN XUONG
MOV R5,#0FFH
MOV R6,#0FFH
LAPO:
CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P0,R6
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPO
RET
CHIP12:;SANG TIM TU DUOI LEN
MOV R5,#0FFH
MOV R6,#0FFH
LAPK:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#00H,LAPK
MOV R5,#0FFH
MOV R6,#0FFH
LAPL:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPL
RET
CHIPR:;TAT TIM TREN XUONG
MOV R5,#00H
MOV R6,#00H
LAPLL:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPLL
MOV R5,#00H
MOV R6,#00H
LAPKK:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPKK
RET
CHIPS:;NHAP NHAY
MOV R5,#5
LAPVT:
MOV P0,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
MOV P1,#0FFH
CALL DELAY
MOV P0,#00H
MOV P2,#00H
MOV P3,#00H
MOV P1,#00H
CALL DELAY
DJNZ R5,LAPVT
RET
CHIP13:;TAT CHAY DUOI
MOV A,#10000000B
LAPM:MOV P0,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM
MOV A,#10000000B
LAPM1:MOV P2,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM1
MOV A,#10000000B
LAPM2:MOV P3,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM2
MOV A,#10000000B
LAPM3:MOV P1,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM3
RET
CHIP14:;TAT DAN VONG
MOV A,#00H
LAPD0:
SETB C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#0FFH,LAPD0
MOV A,#00H
LAPD11:
SETB C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#0FFH,LAPD11
MOV A,#00H
LAPD22:
SETB C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#0FFH,LAPD22
MOV A,#00H
LAPD33:
SETB C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#0FFH,LAPD33
RET
CHIP16:;CHEO TRAI TIM 1
MOV R5,#0FFH
MOV R6,#0FFH
LAPII:
CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPII
RET
CHIP17:;TAT CHEO TTIM
MOV R5,#00H
MOV R6,#00H
LAPIIE:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPIIE
RET
CHIP18:;ON CHEO TRAI TIM 2
MOV R5,#0FFH
MOV R6,#0FFH
LAPIII:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPIII
RET
CHIP19:;TAT CHEO TTIM2
MOV R5,#00H
MOV R6,#00H
LAPIE:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPIE
RET
CHIP20:;SANG QUAY VONG 3LAN
MOV R5,#5
BIG1:
MOV A,#00011111B
LAPZ:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPZ
DJNZ R5,BIG1
MOV A,#0FFH
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
RET
CHIP21:;SANG NUA VONG TRAI TIM TRAI
MOV R5,#0FFH
MOV R6,#0FFH
LAPPT:CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#00H,LAPPT
MOV R5,#0FFH
MOV R6,#0FFH
LAPPU:CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPPU
RET
CHIP22:;OFF NUA VONG TT LEFT
MOV R5,#00H
MOV R6,#00H
LAPPI:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPPI
MOV R5,#00H
MOV R6,#00H
LAPPR:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPPR
RET
CHIP23:;SANG NUA VONG TT SANG PHAI
MOV R5,#0FFH
MOV R6,#0FFH
LAPPS:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPPS
MOV R5,#0FFH
MOV R6,#0FFH
LAPPX:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#00H,LAPPX
RET
CHIP24:;OFF NUA VONG TT SANG PHAI
MOV R5,#00H
MOV R6,#00H
LAPPV:SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#0FFH,LAPPV
MOV R5,#00H
MOV R6,#00H
LAPPL:SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#0FFH,LAPPL
RET
CHIP25:;SANG TAT CHEO GOC
MOV R5,#5
LAPOP:
MOV P1,#00H
MOV P2,#00H
CALL DELAY
MOV P0,#0FFH
MOV P3,#0FFH
CALL DELAY
MOV P0,#00H
MOV P3,#00H
CALL DELAY
MOV P1,#0FFH
MOV P2,#0FFH
CALL DELAY
DJNZ R5,LAPOP
RET
CHIP26:;CHAY 2LED UP/DOWN
MOV R5,#00111111B
MOV R6,#11111100B
LAPTI:MOV A,R5
RR A
MOV R5,A
MOV P0,R5
CALL DELAY
MOV A,R6
RL A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R5,#00111111B,LAPTI
MOV R5,#00111111B
MOV R6,#11111100B
LAPTU:MOV A,R5
RR A
MOV R5,A
MOV P2,R5
CALL DELAY
MOV A,R6
RL A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R5,#00111111B,LAPTU
MOV R5,#11111100B
MOV R6,#00111111B
LAPTE:MOV A,R5
RL A
MOV R5,A
MOV P2,R5
CALL DELAY
MOV A,R6
RR A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R5,#11111100B,LAPTE
MOV R5,#11111100B
MOV R6,#00111111B
LAPTC:MOV A,R5
RL A
MOV R5,A
MOV P0,R5
CALL DELAY
MOV A,R6
RR A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R5,#11111100B,LAPTC
RET
CHIP27:;NHAP NHAY NUA TRAI TIM
MOV R5,#6
BIGE:
MOV P1,#00H
MOV P3,#00H
CALL DELAY
MOV P0,#0FFH
MOV P2,#0FFH
CALL DELAY
MOV P0,#00H
MOV P2,#00H
CALL DELAY
MOV P1,#0FFH
MOV P3,#0FFH
CALL DELAY
DJNZ R5,BIGE
RET
CHIP28:;CHAY 1 LED 2 NUA TTIM
MOV R5,#5
BIGQ:
MOV A,#01111111B
LAPQ:MOV P0,A
MOV P3,A
CALL DELAYS
RR A
CJNE A,#01111111B,LAPQ
MOV P0,#0FFH
MOV P3,#0FFH
MOV A,#01111111B
LAPQ2:MOV P2,A
MOV P1,A
CALL DELAYS
RR A
CJNE A,#01111111B,LAPQ2
DJNZ R5,BIGQ
MOV P2,#0FFH
MOV P1,#0FFH
RET
CHIP29:;ON/OFF 2 NUA VONG TTIM SANG PHAI
MOV R5,#0FFH;ON
MOV R6,#0FFH
LAPY7:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAYS
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAYS
CJNE R6,#00H,LAPY7
MOV R5,#0FFH
MOV R6,#0FFH
LAPY8:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAYS
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAYS
CJNE R6,#00H,LAPY8
MOV R1,#00H;OFF
MOV R2,#00H
LAPY9:SETB C
MOV A,R1
RRC A
MOV R1,A
MOV P0,R1
CALL DELAYS
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P3,R2
CALL DELAYS
CJNE R2,#0FFH,LAPY9
MOV R1,#00H
MOV R2,#00H
LAPY10:SETB C
MOV A,R1
RRC A
MOV R1,A
MOV P2,R1
CALL DELAYS
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P1,R2
CALL DELAYS
CJNE R2,#0FFH,LAPY10
RET
END
;Designer By Chipkool
;http://Chipkool.tk
;Moi chi tiêt cac ban vui long comment ben duoi bai viet nhé
ORG 00H
MAIN:
CALL CHIP28
CALL CHIP29
CALL CHIP26
CALL CHIP25
CALL CHIP1
CALL CHIP20
CALL CHIP2
CALL CHIP3
CALL CHIP4
CALL CHIP5
CALL CHIP6
CALL CHIP7
CALL CHIP8
CALL CHIP9
CALL CHIP10
CALL CHIP11
CALL CHIP12
CALL CHIPR
CALL CHIPS
CALL CHIP13
CALL CHIP14
CALL CHIP16
CALL CHIP17
CALL CHIP18
CALL CHIP19
CALL CHIP20
CALL CHIP21
CALL CHIP22
CALL CHIP23
CALL CHIP24
CALL CHIP27
JMP MAIN
CHIP1:;SANG CHAY 2LED QUA LAI
MOV A,#00111111B
LAPY:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RR A
CJNE A,#00111111B,LAPY
MOV A,#11111100B
LAPYY:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RL A
CJNE A,#11111100B,LAPYY
MOV A,#0FFH
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
MOV A,#0FFH;SANG DAN
LAPIO:CLR C
RRC A
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
CJNE A,#00H,LAPIO
MOV A,#00H;TAT DAN
LAPIU:SETB C
RLC A
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
CJNE A,#0FFH,LAPIU
RET
CHIP2:;SANG CHAY 3LED
MOV A,#00011111B
LAPSH:MOV P0,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH
MOV A,#0FFH
MOV P0,A
MOV A,#00011111B
LAPSH1:MOV P2,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH1
MOV A,#0FFH
MOV P2,A
MOV A,#00011111B
LAPSH2:MOV P3,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH2
MOV A,#0FFH
MOV P3,A
MOV A,#00011111B
LAPSH3:MOV P1,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPSH3
MOV A,#0FFH
MOV P1,A
RET
CHIP3:;SANG DAN VONG
MOV A,#0FFH
LAPC:
CLR C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#00H,LAPC
MOV A,#0FFH
LAPC1:
CLR C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#00H,LAPC1
MOV A,#0FFH
LAPC2:
CLR C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#00H,LAPC2
MOV A,#0FFH
LAPC3:
CLR C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#00H,LAPC3
RET
CHIP4:;TAT DAN
MOV A,#00H
LAPD:
SETB C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#0FFH,LAPD
MOV A,#00H
LAPD1:
SETB C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#0FFH,LAPD1
MOV A,#00H
LAPD2:
SETB C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#0FFH,LAPD2
MOV A,#00H
LAPD3:
SETB C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#0FFH,LAPD3
RET
CHIP5:;TIM SANG DAN TREN XUONG
MOV R5,#0FFH
MOV R6,#0FFH
LAPG:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#00H,LAPG
MOV R5,#0FFH
MOV R6,#0FFH
LAPH:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPH
RET
CHIP6:;TAT TIM DUOI LEN
MOV R5,#00H
MOV R6,#00H
LAPHH:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPHH
MOV R5,#00H
MOV R6,#00H
LAPGG:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPGG
RET
CHIP7:;TIM SANG 2 BEN
MOV R5,#0FFH
MOV R6,#0FFH
LAPI:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPI
RET
CHIP8:;TAT TRAI TIM SANG 2 BEN
MOV R5,#00H
MOV R6,#00H
LAPI1:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P3,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPI1
RET
CHIP9:;2 NUA TTIM TREN DUOI
MOV R1,#0FFH
MOV R2,#0FFH
MOV R5,#0FFH
MOV R6,#0FFH
LAPUI:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P1,R6
CALL DELAY
CLR C
MOV A,R1
RRC A
MOV R1,A
MOV P3,R1
CALL DELAY
CLR C
MOV A,R2
RLC A
MOV R2,A
MOV P2,R2
CALL DELAY
CJNE R5,#00H,LAPUI
RET
CHIP10:;TAT TIM TU GIUA RA
MOV R1,#00H
MOV R2,#00H
MOV R5,#00H
MOV R6,#00H
LAPUII:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P0,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
SETB C
MOV A,R1
RLC A
MOV R1,A
MOV P3,R1
CALL DELAY
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P2,R2
CALL DELAY
CJNE R5,#0FFH,LAPUII
RET
CHIP11:;TRAI TIM TREN XUONG
MOV R5,#0FFH
MOV R6,#0FFH
LAPO:
CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P0,R6
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPO
RET
CHIP12:;SANG TIM TU DUOI LEN
MOV R5,#0FFH
MOV R6,#0FFH
LAPK:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#00H,LAPK
MOV R5,#0FFH
MOV R6,#0FFH
LAPL:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPL
RET
CHIPR:;TAT TIM TREN XUONG
MOV R5,#00H
MOV R6,#00H
LAPLL:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPLL
MOV R5,#00H
MOV R6,#00H
LAPKK:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPKK
RET
CHIPS:;NHAP NHAY
MOV R5,#5
LAPVT:
MOV P0,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
MOV P1,#0FFH
CALL DELAY
MOV P0,#00H
MOV P2,#00H
MOV P3,#00H
MOV P1,#00H
CALL DELAY
DJNZ R5,LAPVT
RET
CHIP13:;TAT CHAY DUOI
MOV A,#10000000B
LAPM:MOV P0,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM
MOV A,#10000000B
LAPM1:MOV P2,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM1
MOV A,#10000000B
LAPM2:MOV P3,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM2
MOV A,#10000000B
LAPM3:MOV P1,A
CALL DELAY
RR A
CJNE A,#10000000B,LAPM3
RET
CHIP14:;TAT DAN VONG
MOV A,#00H
LAPD0:
SETB C
RRC A
CALL DELAY
MOV P0,A
CJNE A,#0FFH,LAPD0
MOV A,#00H
LAPD11:
SETB C
RRC A
CALL DELAY
MOV P2,A
CJNE A,#0FFH,LAPD11
MOV A,#00H
LAPD22:
SETB C
RRC A
CALL DELAY
MOV P3,A
CJNE A,#0FFH,LAPD22
MOV A,#00H
LAPD33:
SETB C
RRC A
CALL DELAY
MOV P1,A
CJNE A,#0FFH,LAPD33
RET
CHIP16:;CHEO TRAI TIM 1
MOV R5,#0FFH
MOV R6,#0FFH
LAPII:
CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPII
RET
CHIP17:;TAT CHEO TTIM
MOV R5,#00H
MOV R6,#00H
LAPIIE:
SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPIIE
RET
CHIP18:;ON CHEO TRAI TIM 2
MOV R5,#0FFH
MOV R6,#0FFH
LAPIII:
CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPIII
RET
CHIP19:;TAT CHEO TTIM2
MOV R5,#00H
MOV R6,#00H
LAPIE:
SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P1,R5
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P2,R6
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPIE
RET
CHIP20:;SANG QUAY VONG 3LAN
MOV R5,#5
BIG1:
MOV A,#00011111B
LAPZ:MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
CALL DELAY
RR A
CJNE A,#00011111B,LAPZ
DJNZ R5,BIG1
MOV A,#0FFH
MOV P0,A
MOV P2,A
MOV P3,A
MOV P1,A
RET
CHIP21:;SANG NUA VONG TRAI TIM TRAI
MOV R5,#0FFH
MOV R6,#0FFH
LAPPT:CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#00H,LAPPT
MOV R5,#0FFH
MOV R6,#0FFH
LAPPU:CLR C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
CLR C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#00H,LAPPU
RET
CHIP22:;OFF NUA VONG TT LEFT
MOV R5,#00H
MOV R6,#00H
LAPPI:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P1,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P2,R6
CALL DELAY
CJNE R6,#0FFH,LAPPI
MOV R5,#00H
MOV R6,#00H
LAPPR:SETB C
MOV A,R5
RLC A
MOV R5,A
MOV P3,R5
CALL DELAY
SETB C
MOV A,R6
RLC A
MOV R6,A
MOV P0,R6
CALL DELAY
CJNE R6,#0FFH,LAPPR
RET
CHIP23:;SANG NUA VONG TT SANG PHAI
MOV R5,#0FFH
MOV R6,#0FFH
LAPPS:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#00H,LAPPS
MOV R5,#0FFH
MOV R6,#0FFH
LAPPX:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#00H,LAPPX
RET
CHIP24:;OFF NUA VONG TT SANG PHAI
MOV R5,#00H
MOV R6,#00H
LAPPV:SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R6,#0FFH,LAPPV
MOV R5,#00H
MOV R6,#00H
LAPPL:SETB C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAY
SETB C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R6,#0FFH,LAPPL
RET
CHIP25:;SANG TAT CHEO GOC
MOV R5,#5
LAPOP:
MOV P1,#00H
MOV P2,#00H
CALL DELAY
MOV P0,#0FFH
MOV P3,#0FFH
CALL DELAY
MOV P0,#00H
MOV P3,#00H
CALL DELAY
MOV P1,#0FFH
MOV P2,#0FFH
CALL DELAY
DJNZ R5,LAPOP
RET
CHIP26:;CHAY 2LED UP/DOWN
MOV R5,#00111111B
MOV R6,#11111100B
LAPTI:MOV A,R5
RR A
MOV R5,A
MOV P0,R5
CALL DELAY
MOV A,R6
RL A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R5,#00111111B,LAPTI
MOV R5,#00111111B
MOV R6,#11111100B
LAPTU:MOV A,R5
RR A
MOV R5,A
MOV P2,R5
CALL DELAY
MOV A,R6
RL A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R5,#00111111B,LAPTU
MOV R5,#11111100B
MOV R6,#00111111B
LAPTE:MOV A,R5
RL A
MOV R5,A
MOV P2,R5
CALL DELAY
MOV A,R6
RR A
MOV R6,A
MOV P3,R6
CALL DELAY
CJNE R5,#11111100B,LAPTE
MOV R5,#11111100B
MOV R6,#00111111B
LAPTC:MOV A,R5
RL A
MOV R5,A
MOV P0,R5
CALL DELAY
MOV A,R6
RR A
MOV R6,A
MOV P1,R6
CALL DELAY
CJNE R5,#11111100B,LAPTC
RET
CHIP27:;NHAP NHAY NUA TRAI TIM
MOV R5,#6
BIGE:
MOV P1,#00H
MOV P3,#00H
CALL DELAY
MOV P0,#0FFH
MOV P2,#0FFH
CALL DELAY
MOV P0,#00H
MOV P2,#00H
CALL DELAY
MOV P1,#0FFH
MOV P3,#0FFH
CALL DELAY
DJNZ R5,BIGE
RET
CHIP28:;CHAY 1 LED 2 NUA TTIM
MOV R5,#5
BIGQ:
MOV A,#01111111B
LAPQ:MOV P0,A
MOV P3,A
CALL DELAYS
RR A
CJNE A,#01111111B,LAPQ
MOV P0,#0FFH
MOV P3,#0FFH
MOV A,#01111111B
LAPQ2:MOV P2,A
MOV P1,A
CALL DELAYS
RR A
CJNE A,#01111111B,LAPQ2
DJNZ R5,BIGQ
MOV P2,#0FFH
MOV P1,#0FFH
RET
CHIP29:;ON/OFF 2 NUA VONG TTIM SANG PHAI
MOV R5,#0FFH;ON
MOV R6,#0FFH
LAPY7:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P0,R5
CALL DELAYS
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P3,R6
CALL DELAYS
CJNE R6,#00H,LAPY7
MOV R5,#0FFH
MOV R6,#0FFH
LAPY8:CLR C
MOV A,R5
RRC A
MOV R5,A
MOV P2,R5
CALL DELAYS
CLR C
MOV A,R6
RRC A
MOV R6,A
MOV P1,R6
CALL DELAYS
CJNE R6,#00H,LAPY8
MOV R1,#00H;OFF
MOV R2,#00H
LAPY9:SETB C
MOV A,R1
RRC A
MOV R1,A
MOV P0,R1
CALL DELAYS
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P3,R2
CALL DELAYS
CJNE R2,#0FFH,LAPY9
MOV R1,#00H
MOV R2,#00H
LAPY10:SETB C
MOV A,R1
RRC A
MOV R1,A
MOV P2,R1
CALL DELAYS
SETB C
MOV A,R2
RRC A
MOV R2,A
MOV P1,R2
CALL DELAYS
CJNE R2,#0FFH,LAPY10
RET
END
Moi chi tiết các ban vui lòng comment địa chỉ Gmail bên dưới bên dưới bài viết nhé!Để Chip gửi tất cả cho.hì hì^^!
Blog Điện Tử | Tin Học