hehe. mới học pic16 có file viết bứng AMS gửi lên anh em nào thích thì xem ngen1
;CHUONG TRINH TEST BO DINH THOI TIMER0
;MCU: PIC16F877A
;TAO KHOANG DINH THOI 1s TAI PORTB
;THACH ANH 4MHz
;MPLAB IDE v7.31
;CHUC CAC BAN MAY MAN
;\\\\\\\\\\\\\\\\\\=*=//////////////////
;CHUONG TRINH :
PROCESSOR 16F877A
#INCLUDE <P16F877A.INC>
DEM EQU 20H
ORG 0000H
BCF STATUS,5
BCF STATUS,6
CLRF PORTB
BSF STATUS,5
CLRF TRISB
BCF STATUS,5
main
CLRF PORTB
call delay_1s
movlw H'18'
movwf PORTB
call delay_1s
movlw H'3C'
movwf PORTB
call delay_1s
movlw H'7E'
movwf PORTB
call delay_1s
movlw H'FF'
movwf PORTB
call delay_1s
GOTO main
delay_1s
BSF STATUS,5
BCF STATUS,6
BCF OPTION_REG,3
BSF OPTION_REG,2
BCF OPTION_REG,1
BCF OPTION_REG,0
BCF STATUS,5
MOVLW D'125'
MOVWF DEM
TMR0_HOAT_DONG
MOVLW D'5'
MOVWF TMR0
BSF STATUS,5
BCF OPTION_REG,5
BCF STATUS,5
KT_CO_TRAN
BTFSS INTCON,2
GOTO KT_CO_TRAN
BCF INTCON,2
DECFSZ DEM
GOTO TMR0_HOAT_DONG
RETURN
END
;CHUONG TRINH TEST BO DINH THOI TIMER0
;MCU: PIC16F877A
;TAO KHOANG DINH THOI 1s TAI PORTB
;THACH ANH 4MHz
;MPLAB IDE v7.31
;CHUC CAC BAN MAY MAN
;\\\\\\\\\\\\\\\\\\=*=//////////////////
;CHUONG TRINH :
PROCESSOR 16F877A
#INCLUDE <P16F877A.INC>
DEM EQU 20H
ORG 0000H
BCF STATUS,5
BCF STATUS,6
CLRF PORTB
BSF STATUS,5
CLRF TRISB
BCF STATUS,5
main
CLRF PORTB
call delay_1s
movlw H'18'
movwf PORTB
call delay_1s
movlw H'3C'
movwf PORTB
call delay_1s
movlw H'7E'
movwf PORTB
call delay_1s
movlw H'FF'
movwf PORTB
call delay_1s
GOTO main
delay_1s
BSF STATUS,5
BCF STATUS,6
BCF OPTION_REG,3
BSF OPTION_REG,2
BCF OPTION_REG,1
BCF OPTION_REG,0
BCF STATUS,5
MOVLW D'125'
MOVWF DEM
TMR0_HOAT_DONG
MOVLW D'5'
MOVWF TMR0
BSF STATUS,5
BCF OPTION_REG,5
BCF STATUS,5
KT_CO_TRAN
BTFSS INTCON,2
GOTO KT_CO_TRAN
BCF INTCON,2
DECFSZ DEM
GOTO TMR0_HOAT_DONG
RETURN
END
Comment