为什么D0不闪烁?

时间:2019-07-18 02:22:35

标签: assembly microcontroller pic mplab

我正在尝试闪烁D0,但D0仅保持点亮状态。我该如何解决?

list r=dec

    include P16f684.inc

    __CONFIG _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO 

 Cblock 0x20 ; start of GPR

count ;

 endc ; This directive must be
 ; supplied to terminate the
 ; cblock list
;
 ;
; ----- main program --------------

 org 0x000 ; Hex address 0x000, the first
 ; program memory location
;
start BCF STATUS,RP0 ; Select Bank 0
;
 CLRF PORTA ; Initialize PORTA (all zeros)
;
 MOVLW 7 ; Load w with 7
 MOVWF CMCON0 ; Load CMCON0 with 7
 ; Turns off comparators
;
 BSF STATUS,RP0 ; Select Bank 1
;
 CLRF ANSEL ; Shut off ADC (digital I/O)
;
 MOVLW b'001111' ; Load w ? RA4 and RA5 outputs
 MOVWF TRISA ; copy w to TRIS PORTA
;
 BCF STATUS,RP0 ; Select Bank 0
;
Loop BSF PORTA,4 ; Make RA4 high -- D0 ON
;
 CALL Delay ; Goto the delay routine
;
 BCF PORTA,4 ; Make RA4 low -- D0 OFF
;
 CALL Delay ; Goto the delay routine
;
 GOTO Loop ; Do it again
;
;
Delay MOVLW 10 ; Decimal 10
 MOVWF count ; Initialize counter to 10
Repeat DECFSZ count,f ; Decrement counter
 GOTO Repeat ; If counter <> 0
 RETURN ; If counter = 0 (end delay)
;
 end

0 个答案:

没有答案