組み込みシステムは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に関する回答が必要です。 –