有問題的嵌入式系統是PIC 16F877,我試圖用incfsz遞增PORTC寄存器,但它仍然爲0.教程說這是可能的,但我無法獲得它工作。無法在嵌入式系統中增加寄存器
list p=16f877
include "p16f877.inc"
__CONFIG _CP_OFF & _CPD_OFF & _LVP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _XT_OSC
org 0x000 ; Start at the reset vector
nop ; Reserved for ICD in debu mode
Init
banksel PORTC
clrf PORTC ; Clear PORTC initially
; Set up the Timer0 control register
banksel OPTION_REG
movlw B'10000111' ; Internal clock, prescaler assigned to Timer0
movwf OPTION_REG ; prescaler, 1:256
clrf TRISC ; PORTC all output
banksel PORTC ; Back to Bank 0
movlw B'00000000'
Main
; Timer0 delay for acquisition
btfss INTCON,T0IF ; Loop until T0IF = 1 (TMR0 rollover)
goto Main
bcf INTCON,T0IF
incfsz PORTC , F
goto Main
LoopWhilePushed ; Loop if PORTB<0> = 0 (pressed)
btfss PORTB,0
goto LoopWhilePushed
goto Main ; Do it again
end
對stackoverflow的迴應應在相關答案下的評論中作出。 – 2012-02-09 19:41:55