LIST P=16F946 ; list directive to define processor
#INCLUDE <P16F946.INC> ; processor specific variable definitions
;*******************************************
ORG 00H
NOP
GOTO MAIN
ORG 05H
;*******************************************
MAIN
BCF STATUS,RP0 ;Bank 0
BCF STATUS,RP1 ;
CLRF PORTA ;Init PORTA
BSF STATUS,RP0 ;Bank 1
BCF STATUS,RP1 ;
MOVLW 07h ;Set RA<2:0> to digital I/O
MOVWF CMCON0 ;关闭比较器
CLRF ANSEL ;Make all PORTA I/O
MOVLW 0F0h ;Set RA<7:4> as inputs and set RA<3:0> as outputs
MOVWF TRISA ;
;*******************************************
LOOP
BCF STATUS,RP0
BCF STATUS,RP1
CALL DISPLAY
CALL SCANKEYS
CALL DELAY5MS ;延时5MS
GOTO LOOP
;*******************************************
DISPLAY
RETURN
SCANKEYS
RETURN
DELAY5MS
RETURN
;*******************************************
END
显示如下:
Message[302] C:\PROJECT\LI.ASM 32 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\PROJECT\LI.ASM 33 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\PROJECT\LI.ASM 35 : Register in operand not in bank 0. Ensure that bank bits are correct.
不知道那里的问题,望赐教。谢! |