PIC单片机在ICD 上做一个简单的查表程序
;PIC;;;;;;;;;;;;;;;include <p16f877.inc>
status equ 03h ;2004/4/28
rp0 equ 05h ;
z equ 02h ;1-2-3-9-1
pcl equ 02h
portd equ 08h
trisd equ 88h
mm equ 20h
Count equ 22h
Count1 equ 23h
Count2 equ 24h
org 10
start
bsf status,rp0
clrf trisd
bcf status,rp0
movlw 0
movwf mm
main
call table ;mm=0查表返回后mm=b'11111000'
movwf portd
call delay
incf mm
movlw 0x09 ; if mm=5 goto start,mm become zero
subwf mm,0
btfsc status,z
goto start
goto main
delay
clrf Count
clrf Count1
movlw 0x0f
movwf Count2
PP
decfsz Count,f
goto PP
decfsz Count1,f
goto PP
decfsz Count2,f
goto PP
return
table
movf mm,0
addwF PCL,1
retlw b'00000110' ;1
retlw b'01011011'
retlw b'01001111'
retlw b'01100110'
retlw b'01101101' ;5
retlw b'01111101'
retlw b'00000111'
retlw b'01111111'
retlw b'01101111'
retlw b'00111111' ;0
end
页:
[1]