用DW做的查表程序 zhuan
在QL200上验证过了,烧写的时候选HS,禁止看门狗,QL200上是4M的HS,0~9 的数字在数码管1.5S递增显示;********************TEST4.ASM******************************
LIST P=16F877A
INCLUDE "P16F877A.INC"
;******************查表编程与实验***************************
ADDR EQU 20H
NUM EQU 21H
TMP EQU 22H
DELN1 EQU 23H
DELN2 EQU 24H
DELN3 EQU 25H
;***********************************************************
ORG 00H
NOP
NOP
GOTO MAIN
ORG 05H
LOOP BCF INTCON,GIE
BTFSC INTCON,GIE
GOTO LOOP
MAIN MOVLW 00H
MOVWF NUM
MOVLW 02H
MOVWF PORTA
MOVLW 0FFH
NOP
XIANSHI MOVWF PORTD
BSF STATUS,RP0
MOVLW 00H
MOVWF TRISD
MOVWF TRISA
CALL DELAY
CLRF STATUS
XUNHUAN INCF NUM,1
MOVF NUM,0
CLRF STATUS
XORLW 0BH
BTFSS STATUS,Z
GOTO CHABIAO
GOTO MAIN
CHABIAO MOVF NUM,0
ADDLW 6FH
MOVWF TMP
CLRF STATUS
MOVLW 00H
BSF STATUS,RP1
MOVWF EEADRH
CLRF STATUS
MOVF TMP,0
BSF STATUS,RP1
MOVWF EEADR
BSF STATUS,RP0
BSF EECON1,RD
BSF EECON1,EEPGD
NOP
NOP
BSF STATUS,RP1
BCF STATUS,RP0
MOVF EEDATA,0
CLRF STATUS
MOVWF TMP
MOVF TMP,0
GOTO XIANSHI
ORG 60H
DELAY MOVLW 008H
MOVWF DELN3
DLY1 MOVLW 0FFH
MOVWF DELN2
DLY2 MOVLW 0FFH
MOVWF DELN1
DLY3 DECFSZ DELN1
GOTO DLY3
DECFSZ DELN2
GOTO DLY2
DECFSZ DELN3
GOTO DLY1
NOP
RETLW 0
ORG 70H
BIAO DW 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90
END
页:
[1]