Do 2 con Led ma trận của thầy bị hư nên mình bỏ 2 dòng cuối để thể hiện đúng chữ ( thầy chấp nhận)
PROCESSOR 16F877A
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
#INCLUDE <16f877a.inc>
DEM1 EQU 20H
DEM2 EQU 21H
ORG 0000H
BCF STATUS,5
BCF STATUS,6
CLRF PORTB
CLRF PORTC
CLRF PORTD
BSF STATUS,5
CLRF TRISB
CLRF TRISC
CLRF TRISD
BCF STATUS,5
MAIN
MOVLW B'00110011'
MOVWF PORTC
MOVLW B'11111110'
MOVWF PORTB
CALL DELAY
MOVLW B'00100001'
MOVWF PORTC
MOVLW B'11111101'
MOVWF PORTB
CALL DELAY
MOVLW B'00100100'
MOVWF PORTC
MOVLW B'11111011'
MOVWF PORTB
CALL DELAY
MOVLW B'00100100'
MOVWF PORTC
MOVLW B'11110111'
MOVWF PORTB
CALL DELAY
MOVLW B'00100100'
MOVWF PORTC
MOVLW B'11101111'
MOVWF PORTB
CALL DELAY
MOVLW B'00000100'
MOVWF PORTC
MOVLW B'11011111'
MOVWF PORTB
CALL DELAY
MOVLW B'10001100'
MOVWF PORTC
MOVLW B'10111111'
MOVWF PORTB
CALL DELAY
MOVLW B'11111111'
MOVWF PORTC
MOVLW B'11111111'
MOVWF PORTB
CALL DELAY
MOVLW B'01111111'
MOVWF PORTD
MOVLW B'00000000'
MOVWF PORTC
CALL DELAY
MOVLW B'10111111'
MOVWF PORTD
MOVLW B'00000000'
MOVWF PORTC
CALL DELAY
MOVLW B'11011111'
MOVWF PORTD
MOVLW B'11100111'
MOVWF PORTC
CALL DELAY
MOVLW B'11101111'
MOVWF PORTD
MOVLW B'11000011'
MOVWF PORTC
CALL DELAY
MOVLW B'11110111'
MOVWF PORTD
MOVLW B'10011001'
MOVWF PORTC
CALL DELAY
MOVLW B'11111011'
MOVWF PORTD
MOVLW B'00111100'
MOVWF PORTC
CALL DELAY
MOVLW B'11111101'
MOVWF PORTD
MOVLW B'01111110'
MOVWF PORTC
CALL DELAY
MOVLW B'11111111'
MOVWF PORTD
MOVLW B'11111111'
MOVWF PORTC
CALL DELAY
GOTO MAIN
DELAY
BSF STATUS,5
MOVLW B'0000'
MOVWF OPTION_REG
BCF STATUS,5
MOVLW D'25'
MOVWF DEM1
BATDAU
MOVLW D'230'
MOVWF TMR0
BSF STATUS,5
BCF OPTION_REG,5
BCF STATUS,5
LOOP
BTFSS INTCON,2
GOTO LOOP
BCF INTCON,2
DECFSZ DEM1,1
GOTO BATDAU
RETURN
END
đã test ok..bài này đóng file hex rùi nạp Pic chấm điểm là very good...chắc được 8 điểm thui...hihi
Trả lờiXóasao giờ vẫn còn viết kiểu này cho dài giữ vậy ?
Xóa